summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2022-04-12 12:48:25 +0200
committerMinijackson <minijackson@riseup.net>2022-04-12 12:48:25 +0200
commit0aac4d5de31a5c64f6f10c8e192e83054fac5267 (patch)
treecea2f20af5bc5c59fd98332e1a6ed816d2be7f76
parent621fb6648b063ebadb54d0267bd40e039d186a32 (diff)
downloadnixos-config-reborn-0aac4d5de31a5c64f6f10c8e192e83054fac5267.tar.gz
nixos-config-reborn-0aac4d5de31a5c64f6f10c8e192e83054fac5267.zip
vim: switch deprecated nvim-compe -> nvim-cmp
-rw-r--r--common/vim.nix14
-rw-r--r--dotfiles/vim-dev.lua1
-rw-r--r--dotfiles/vim.lua52
3 files changed, 48 insertions, 19 deletions
diff --git a/common/vim.nix b/common/vim.nix
index 09dd9f5..17d18ac 100644
--- a/common/vim.nix
+++ b/common/vim.nix
@@ -72,9 +72,17 @@ let
72 gitsigns-nvim 72 gitsigns-nvim
73 diffview-nvim 73 diffview-nvim
74 74
75 nvim-compe 75 nvim-cmp
76 compe-latex-symbols 76 cmp-buffer
77 compe-zsh 77 cmp-calc
78 cmp-cmdline
79 cmp-latex-symbols
80 cmp-nvim-lsp
81 cmp-path
82 cmp-spell
83 cmp-tmux
84 cmp-treesitter
85 cmp-vsnip
78 86
79 vim-vsnip 87 vim-vsnip
80 vim-vsnip-integ 88 vim-vsnip-integ
diff --git a/dotfiles/vim-dev.lua b/dotfiles/vim-dev.lua
index 55ac142..ab04bf8 100644
--- a/dotfiles/vim-dev.lua
+++ b/dotfiles/vim-dev.lua
@@ -64,6 +64,7 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
64 'additionalTextEdits', 64 'additionalTextEdits',
65 } 65 }
66} 66}
67capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
67 68
68require("rust-tools").setup { 69require("rust-tools").setup {
69 server = { 70 server = {
diff --git a/dotfiles/vim.lua b/dotfiles/vim.lua
index 9317453..0e89ba6 100644
--- a/dotfiles/vim.lua
+++ b/dotfiles/vim.lua
@@ -166,26 +166,46 @@ require('nvim-treesitter.configs').setup {
166vim.o.foldmethod = 'expr' 166vim.o.foldmethod = 'expr'
167vim.o.foldexpr = 'nvim_treesitter#foldexpr()' 167vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
168 168
169-- nvim-compe 169-- nvim-cmp
170 170
171require("compe").setup { 171local cmp = require("cmp")
172 source = { 172
173 buffer = true, 173cmp.setup {
174 calc = true, 174 snippet = {
175 latex_symbols = true, 175 expand = function(args)
176 nvim_lsp = true, 176 vim.fn["vsnip#anonymous"](args.body)
177 nvim_lua = true, 177 end,
178 nvim_treesitter = true, 178 },
179 omni = false, 179 mapping = {
180 path = true, 180 ['<CR>'] = cmp.mapping.confirm({ select = false }),
181 spell = true,
182 vsnip = true,
183 zsh = true,
184 }, 181 },
182 sources = cmp.config.sources({
183 { name = "nvim_lsp" },
184 { name = "vsnip" },
185 { name = "latex_symbols" },
186 { name = "calc" },
187 }, {
188 { name = "path" },
189 { name = "treesitter" },
190 }, {
191 { name = "tmux" },
192 { name = "spell" },
193 -- Use \k for iskeyword because of UTF-8
194 { name = "buffer", option = { keyword_pattern = [[\k\+]], } },
195 }),
185} 196}
186 197
187map("i", "<CR>", "compe#confirm('<CR>')", { noremap = true, silent = true, expr = true }) 198cmp.setup.cmdline("/", {
188map("i", "<C-e>", "compe#close('<C-e>')", { noremap = true, silent = true, expr = true }) 199 sources = {
200 { name = "buffer", option = { keyword_pattern = [[\k\+]], } },
201 }
202})
203
204cmp.setup.cmdline(":", {
205 sources = cmp.config.sources({
206 { name = "cmdline" },
207 })
208})
189 209
190-- Telescope 210-- Telescope
191 211