@@ 1,72 1,37 @@
-require("compe").setup(
- {
- enabled = true,
- autocomplete = true,
- debug = false,
- min_length = 1,
- preselect = "enable",
- throttle_time = 80,
- source_timeout = 200,
- resolve_timeout = 800,
- incomplete_delay = 400,
- max_abbr_width = 100,
- max_kind_width = 100,
- max_menu_width = 100,
- documentation = {
- border = {"", "", "", " ", "", "", "", " "}, -- the border option is the same as `|help nvim_open_win|`
- winhighlight = "NormalFloat:CompeDocumentation,FloatBorder:CompeDocumentationBorder",
- max_width = 120,
- min_width = 60,
- max_height = math.floor(vim.o.lines * 0.3),
- min_height = 1
- },
- source = {
- path = true,
- buffer = true,
- calc = true,
- nvim_lsp = true,
- nvim_lua = true,
- vsnip = true,
- ultisnips = true,
- luasnip = true
- }
- }
-)
-local t = function(str)
- return vim.api.nvim_replace_termcodes(str, true, true, true)
-end
+-- Copied from https://github.com/hrsh7th/nvim-cmp/?tab=readme-ov-file#recommended-configuration
+local cmp = require('cmp')
+cmp.setup({
+ snippet = {
+ -- REQUIRED - you must specify a snippet engine
+ expand = function(args)
+ vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
+ end
+ },
+ window = {
+ completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered()
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<C-b>'] = cmp.mapping.scroll_docs(-4),
+ ['<C-f>'] = cmp.mapping.scroll_docs(4),
+ ['<C-Space>'] = cmp.mapping.complete(),
+ ['<C-e>'] = cmp.mapping.abort(),
+ ['<CR>'] = cmp.mapping.confirm({select = true}) -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ }),
+ sources = cmp.config.sources({
+ {name = 'nvim_lsp'}, {name = 'vsnip'} -- For vsnip users.
+ }, {{name = 'buffer'}})
+})
+require("cmp_git").setup()
+-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline({'/', '?'}, {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {{name = 'buffer'}}
+})
-local check_back_space = function()
- local col = vim.fn.col(".") - 1
- return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil
-end
-
--- Use (s-)tab to:
---- move to prev/next item in completion menuone
---- jump to prev/next snippet's placeholder
-_G.tab_complete = function()
- if vim.fn.pumvisible() == 1 then
- return t "<C-n>"
- elseif vim.fn["vsnip#available"](1) == 1 then
- return t "<Plug>(vsnip-expand-or-jump)"
- elseif check_back_space() then
- return t "<Tab>"
- else
- return vim.fn["compe#complete"]()
- end
-end
-_G.s_tab_complete = function()
- if vim.fn.pumvisible() == 1 then
- return t "<C-p>"
- elseif vim.fn["vsnip#jumpable"](-1) == 1 then
- return t "<Plug>(vsnip-jump-prev)"
- else
- -- If <S-Tab> is not working in your terminal, change it to <C-h>
- return t "<S-Tab>"
- end
-end
-
-vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
-vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
-vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
-vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
+-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline(':', {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({{name = 'path'}}, {{name = 'cmdline'}}),
+ matching = {disallow_symbol_nonprefix_matching = false}
+})
@@ 1,65 1,65 @@
local nvim_lsp = require("lspconfig")
---########################
---#### Set up LSPs ####
---########################
+local capabilities = require('cmp_nvim_lsp').default_capabilities()
+-- ########################
+-- #### Set up LSPs ####
+-- ########################
--
-- TypeScript
nvim_lsp.tsserver.setup {
- flags = {
- debounce_text_changes = 150
- }
+ capabilities = capabilities,
+ flags = {debounce_text_changes = 150}
}
-- Clojure
-nvim_lsp.clojure_lsp.setup{}
+nvim_lsp.clojure_lsp.setup {capabilities = capabilities}
local util = require("lspconfig.util")
-- Rust
-nvim_lsp.rust_analyzer.setup({})
+nvim_lsp.rust_analyzer.setup({
+ capabilities = capabilities,
+ diagnostics = {enable = true}
+})
-- Python LSP
-nvim_lsp.pylsp.setup(
- {
- cmd = {"/home/noah/.envs/nvim/bin/pylsp"},
- root_dir = function(fname)
- local root_files = {
- "pants.toml",
- "pyproject.toml",
- "setup.py",
- "setup.cfg",
- "Pipfile"
- }
- return util.find_git_ancestor(fname) or util.root_pattern(unpack(root_files))(fname)
- end
- }
-)
+nvim_lsp.pylsp.setup({
+ capabilities = capabilities,
+ cmd = {"/home/noah/.envs/nvim/bin/pylsp"},
+ root_dir = function(fname)
+ local root_files = {
+ "pants.toml", "pyproject.toml", "setup.py", "setup.cfg", "Pipfile"
+ }
+ return util.find_git_ancestor(fname) or
+ util.root_pattern(unpack(root_files))(fname)
+ end
+})
-- More Python, I like it strict
-nvim_lsp.pyright.setup{}
-nvim_lsp.ruff_lsp.setup{}
+nvim_lsp.pyright.setup {capabilities = capabilities}
+nvim_lsp.ruff_lsp.setup {capabilities = capabilities}
---nvim_lsp.scheme_langserver.setup{}
+-- nvim_lsp.scheme_langserver.setup{}
-- Golang
-nvim_lsp.gopls.setup{}
+nvim_lsp.gopls.setup {capabilities = capabilities}
-- Lots of things
---nvim_lsp.diagnosticls.setup(
+-- nvim_lsp.diagnosticls.setup(
-- {
-- flags = {
-- debounce_text_changes = 150
-- }
-- }
---)
+-- )
-- JSON
-nvim_lsp.jsonls.setup{}
-nvim_lsp.jsonls.setup{}
+nvim_lsp.jsonls.setup {capabilities = capabilities}
+nvim_lsp.jsonls.setup {capabilities = capabilities}
-- Vim
-nvim_lsp.vimls.setup{}
+nvim_lsp.vimls.setup {capabilities = capabilities}
-nvim_lsp.bashls.setup{}
-nvim_lsp.ccls.setup{}
-nvim_lsp.asm_lsp.setup{}
-nvim_lsp.lua_ls.setup{
+nvim_lsp.bashls.setup {capabilities = capabilities}
+nvim_lsp.ccls.setup {capabilities = capabilities}
+nvim_lsp.asm_lsp.setup {capabilities = capabilities}
+nvim_lsp.lua_ls.setup {
+ capabilities = capabilities,
settings = {
Lua = {
runtime = {
@@ 75,17 75,15 @@ nvim_lsp.lua_ls.setup{
library = vim.api.nvim_get_runtime_file("", true)
},
-- Do not send telemetry data containing a randomized but unique identifier
- telemetry = {
- enable = false
- }
+ telemetry = {enable = false}
}
}
}
-nvim_lsp.fennel_ls.setup{}
+nvim_lsp.fennel_ls.setup {capabilities = capabilities}
-- Whenever an LSP is attached to a buffer
local on_attach = function(ev)
- --Enable completion triggered by <c-x><x-o>
+ -- Enable completion triggered by <c-x><x-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
local opts = {noremap = true, silent = true, buffer = ev.buf}
@@ 99,7 97,9 @@ local on_attach = function(ev)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
- vim.keymap.set("n", "<space>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts)
+ vim.keymap.set("n", "<space>wl", function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end, opts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts)
@@ 108,9 108,8 @@ local on_attach = function(ev)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts)
- vim.keymap.set("n", "<space>f", function()
- vim.lsp.buf.format{ async = true }
- end, opts)
+ vim.keymap.set("n", "<space>f",
+ function() vim.lsp.buf.format {async = true} end, opts)
vim.keymap.set("n", "<space>s", vim.lsp.buf.workspace_symbol, opts)
-- require'completion'.on_attach(client, bufnr)
@@ 2,195 2,146 @@
local ensure_lazy = function()
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
- vim.fn.system(
- {
- "git",
- "clone",
- "--filter=blob:none",
- "https://github.com/folke/lazy.nvim.git",
- "--branch=stable", -- latest stable release
- lazypath
- }
- )
+ vim.fn.system({
+ "git", "clone", "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release
+ lazypath
+ })
end
vim.opt.rtp:prepend(lazypath)
end
local lazy_bootstrap = ensure_lazy()
-if lazy_bootstrap then
- print("Bootstrapped lazy.nvim")
-end
+if lazy_bootstrap then print("Bootstrapped lazy.nvim") end
-require("lazy").setup(
- {
- -- Color themes
- "shaunsingh/nord.nvim",
- "shaunsingh/moonlight.nvim",
- "folke/tokyonight.nvim",
- "cranberry-clockworks/coal.nvim",
- "hardselius/warlock",
- {
- "rebelot/kanagawa.nvim",
- opts = {compile = true}
- },
- -- show indents and whitespace characters
- "lukas-reineke/indent-blankline.nvim",
- -- Completion
- "hrsh7th/nvim-compe",
- "hrsh7th/vim-vsnip",
- -- nvim lsp plugins
- "neovim/nvim-lspconfig",
- {
- "nvimdev/lspsaga.nvim",
- dependencies = {
- "nvim-tree/nvim-web-devicons",
- "nvim-treesitter/nvim-treesitter"
- },
- opts = {lightbulb = {enable = false}},
- event = "LspAttach"
- },
- -- Syntax Highlighting from the future
- {
- "nvim-treesitter/nvim-treesitter",
- init = function()
- vim.cmd([[":TSUpdate"]])
- end
- },
- -- GitGutter, shows inline difs
- "airblade/vim-gitgutter",
- -- Git wrapper plugin
- "tpope/vim-fugitive",
- -- surround with pairs ))))))
- --"tpope/vim-surround",
- -- Auto format tool
- {"sbdchd/neoformat", lazy = true, cmd = "Neoformat"},
- -- Distraction free writing: GoYo + Limelight
- {"junegunn/limelight.vim", lazy = true, ft = "markdown"},
- {"junegunn/goyo.vim", lazy = true, ft = "markdown"},
- -- Golang plugins
- --use {"fatih/vim-go", run = ":GoUpdateBinaries", lazy = true, ft = "go"}
- {
- "ray-x/go.nvim",
- ft = "go",
- lazy = true,
- dependencies = {
- "ray-x/guihua.lua",
- "neovim/nvim-lspconfig",
- "nvim-treesitter/nvim-treesitter"
- }
- },
- {
- "nvim-lualine/lualine.nvim",
- dependencies = {"nvim-tree/nvim-web-devicons"}
- },
- "junegunn/fzf.vim",
- {
- dir = "~/.fzf",
- build = function()
- vim.fn["fzf#install"](0)
- end,
- dependencies = {"junegunn/fzf.vim"}
- },
- -- Polyglot
- "sheerun/vim-polyglot",
- -- Telescope, find anything fast
- "nvim-lua/plenary.nvim",
- {"nvim-telescope/telescope.nvim", dependencies = {"nvim-lua/plenary.nvim"}},
- "nvim-telescope/telescope-symbols.nvim",
- {"folke/trouble.nvim", dependencies = "nvim-tree/nvim-web-devicons"},
- -- Which key is bound?
- "folke/which-key.nvim", -- literally the best plugin ever
- -- Lithsps
- {
- "guns/vim-sexp",
- ft = {"hy", "scheme", "clojure"},
- }, -- ))))))
- {"hiphish/rainbow-delimiters.nvim"},
- --{"gpanders/nvim-parinfer", ft = {"scheme", "lisp", "fennel", "clojure", "lua"}},
- --{
- -- "eraserhd/parinfer-rust",
- -- build = "RUSTFLAGS='-C target-feature=+crt-static' cargo build --release",
- -- ft = {"scheme", "lisp", "fennel", "clojure", "lua"},
- --},
- -- Conjure, lisp is magical
- {
- "Olical/conjure",
- ft = {"scheme", "lisp", "fennel", "clojure", "lua"},
- config = function()
- vim.g["conjure#client#scheme#stdio#command"] = "gxi"
- vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "%d*> $?"
- end
- },
- {"p1xelHer0/gerbil.nvim", ft = "scheme"},
- -- Fennel, Luasthp
- {"jaawerth/fennel.vim", lazy = true, ft = "fennel"},
- {"rktjmp/hotpot.nvim", lazy = true, ft = "fennel"},
- {"Olical/nfnl", ft = "fennel"},
- -- Rust stuff
- {
- "simrat39/rust-tools.nvim",
- ft = {"rust"},
- config = function()
- local rt = require("rust-tools")
- rt.setup(
- {
- server = {
- on_attach = function(_, bufnr)
- -- Hover actions
- vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, {buffer = bufnr})
- -- Code action groups
- vim.keymap.set(
- "n",
- "<Leader>a",
- rt.code_action_group.code_action_group,
- {buffer = bufnr}
- )
- end
- }
- }
- )
- end,
- dependencies = {"nvim-lua/plenary.nvim"}
+require("lazy").setup({
+ -- Color themes
+ "shaunsingh/nord.nvim", "shaunsingh/moonlight.nvim",
+ "folke/tokyonight.nvim", "cranberry-clockworks/coal.nvim",
+ "hardselius/warlock", "sainnhe/everforest",
+ {"catppuccin/nvim", name = "catppuccin", priority = 1000},
+ {"rebelot/kanagawa.nvim", opts = {compile = true}},
+ -- show indents and whitespace characters
+ "lukas-reineke/indent-blankline.nvim", -- Completion
+ "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path", "hrsh7th/cmp-vsnip", "hrsh7th/vim-vsnip",
+ "petertriho/cmp-git", -- nvim lsp plugins
+ "neovim/nvim-lspconfig", {
+ "nvimdev/lspsaga.nvim",
+ dependencies = {
+ "nvim-tree/nvim-web-devicons", "nvim-treesitter/nvim-treesitter"
},
- {"mfussenegger/nvim-dap", lazy = true, ft = {"c", "rust"}},
- {
- "saecki/crates.nvim",
- tag = "v0.4.0",
- dependencies = {"nvim-lua/plenary.nvim"},
- config = function()
- require("crates").setup()
- end,
- ft = {"rust"}
- },
- -- RISC-V Assembly syntax highlighting
- {"kylelaker/riscv.vim", ft = "riscv"},
- -- Hare Stuff
-
- -- Haredoc
- {url = "https://git.sr.ht/~torresjrjr/vim-haredoc", ft = {"hare"}},
- -- Hare.vim
- {url = "https://git.sr.ht/~sircmpwn/hare.vim", ft = {"hare"}},
- -- TCL
- {"lewis6991/tree-sitter-tcl", build = "make"},
- -- LF
- {"ptzz/lf.vim", cmd = {"Lf"}, dependencies = {"voldikss/vim-floaterm"}},
- -- Copilot
- -- use {"github/copilot.vim", lazy = true, cmd = {"Copilot"}}
- -- Mason
- {
- "williamboman/mason.nvim",
- init = function()
- vim.cmd([[":MasonUpdate"]])
- end,
- dependencies = {
- "williamboman/mason-lspconfig.nvim",
- "mfussenegger/nvim-dap",
- "jose-elias-alvarez/null-ls.nvim"
- },
- config = function()
- require("mason").setup()
- end
+ opts = {lightbulb = {enable = false}},
+ event = "LspAttach"
+ }, -- Syntax Highlighting from the future
+ {
+ "nvim-treesitter/nvim-treesitter",
+ init = function() vim.cmd([[":TSUpdate"]]) end
+ }, -- GitGutter, shows inline difs
+ -- "airblade/vim-gitgutter", -- Git wrapper plugin
+ -- "tpope/vim-fugitive",
+ {
+ "NeogitOrg/neogit", "nvim-lua/plenary.nvim", -- required
+ "sindrets/diffview.nvim", -- optional - Diff integration
+ "nvim-telescope/telescope.nvim"
+ }, "akinsho/git-conflict.nvim", -- surround with pairs ))))))
+ -- "tpope/vim-surround",
+ -- Auto format tool
+ {"sbdchd/neoformat", lazy = true, cmd = "Neoformat"},
+ -- Distraction free writing: GoYo + Limelight
+ {"junegunn/limelight.vim", lazy = true, ft = "markdown"},
+ {"junegunn/goyo.vim", lazy = true, ft = "markdown"}, -- Golang plugins
+ -- use {"fatih/vim-go", run = ":GoUpdateBinaries", lazy = true, ft = "go"}
+ {
+ "ray-x/go.nvim",
+ ft = "go",
+ lazy = true,
+ dependencies = {
+ "ray-x/guihua.lua", "neovim/nvim-lspconfig",
+ "nvim-treesitter/nvim-treesitter"
}
},
- nil
-)
+ {
+ "nvim-lualine/lualine.nvim",
+ dependencies = {"nvim-tree/nvim-web-devicons"}
+ }, "junegunn/fzf.vim", {
+ dir = "~/.fzf",
+ build = function() vim.fn["fzf#install"](0) end,
+ dependencies = {"junegunn/fzf.vim"}
+ }, -- "romgrk/barbar.nvim", -- Polyglot
+ "sheerun/vim-polyglot", -- Telescope, find anything fast
+ "nvim-lua/plenary.nvim",
+ {"nvim-telescope/telescope.nvim", dependencies = {"nvim-lua/plenary.nvim"}},
+ "nvim-telescope/telescope-symbols.nvim",
+ {"folke/trouble.nvim", dependencies = "nvim-tree/nvim-web-devicons"},
+ -- Which key is bound?
+ "folke/which-key.nvim", -- literally the best plugin ever
+ -- Lithsps
+ {"guns/vim-sexp", ft = {"hy", "scheme", "clojure"}}, -- ))))))
+ {"hiphish/rainbow-delimiters.nvim"},
+ -- {"gpanders/nvim-parinfer", ft = {"scheme", "lisp", "fennel", "clojure", "lua"}},
+ -- {
+ -- "eraserhd/parinfer-rust",
+ -- build = "RUSTFLAGS='-C target-feature=+crt-static' cargo build --release",
+ -- ft = {"scheme", "lisp", "fennel", "clojure", "lua"},
+ -- },
+ -- Conjure, lisp is magical
+ {
+ "Olical/conjure",
+ ft = {"scheme", "lisp", "fennel", "clojure", "lua"},
+ config = function()
+ vim.g["conjure#client#scheme#stdio#command"] = "gxi"
+ vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "%d*> $?"
+ end
+ }, {"p1xelHer0/gerbil.nvim", ft = "scheme"}, -- Fennel, Luasthp
+ {"jaawerth/fennel.vim", lazy = true, ft = "fennel"},
+ {"rktjmp/hotpot.nvim", lazy = true, ft = "fennel"},
+ {"Olical/nfnl", ft = "fennel"}, -- Rust stuff
+ "pest-parser/pest.vim", {
+ "simrat39/rust-tools.nvim",
+ ft = {"rust"},
+ config = function()
+ local rt = require("rust-tools")
+ rt.setup({
+ server = {
+ on_attach = function(_, bufnr)
+ -- Hover actions
+ vim.keymap.set("n", "<C-space>",
+ rt.hover_actions.hover_actions,
+ {buffer = bufnr})
+ -- Code action groups
+ vim.keymap.set("n", "<Leader>a",
+ rt.code_action_group.code_action_group,
+ {buffer = bufnr})
+ end
+ }
+ })
+ end,
+ dependencies = {"nvim-lua/plenary.nvim"}
+ }, {"mfussenegger/nvim-dap", lazy = true, ft = {"c", "rust"}}, {
+ "saecki/crates.nvim",
+ tag = "v0.4.0",
+ dependencies = {"nvim-lua/plenary.nvim"},
+ config = function() require("crates").setup() end,
+ ft = {"rust"}
+ }, -- RISC-V Assembly syntax highlighting
+ {"kylelaker/riscv.vim", ft = "riscv"}, -- Hare Stuff
+ -- Haredoc
+ {url = "https://git.sr.ht/~torresjrjr/vim-haredoc", ft = {"hare"}},
+ -- Hare.vim
+ {url = "https://git.sr.ht/~sircmpwn/hare.vim"}, -- TCL
+ {"lewis6991/tree-sitter-tcl", build = "make"}, -- LF
+ {"ptzz/lf.vim", cmd = {"Lf"}, dependencies = {"voldikss/vim-floaterm"}},
+ -- Copilot
+ -- use {"github/copilot.vim", lazy = true, cmd = {"Copilot"}}
+ -- Mason
+ {
+ "williamboman/mason.nvim",
+ init = function() vim.cmd([[":MasonUpdate"]]) end,
+ dependencies = {
+ "williamboman/mason-lspconfig.nvim", "mfussenegger/nvim-dap",
+ "jose-elias-alvarez/null-ls.nvim"
+ },
+ config = function() require("mason").setup() end
+ }
+}, nil)