Skip to content

Commit

Permalink
[vim] Add cmp
Browse files Browse the repository at this point in the history
Oupsi
  • Loading branch information
MarcelRobitaille committed Jun 27, 2022
1 parent 4394436 commit 6413975
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion vim/after/plugin/cmp.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
if exists('g:loaded_cmp') && g:loaded_cmp
lua <<EOF

local cmp = require'cmp'
local lspkind = require'lspkind'

cmp.setup({
preselect = cmp.PreselectMode.None,
Expand All @@ -12,6 +14,8 @@ lua <<EOF
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
Expand All @@ -26,7 +30,10 @@ lua <<EOF
{ name = 'path' },
}, {
{ name = 'buffer' },
})
}),
formatting = {
format = lspkind.cmp_format(),
}
})

-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
Expand All @@ -45,3 +52,4 @@ lua <<EOF
})
})
EOF
endif
4 changes: 2 additions & 2 deletions vim/plugin/mappings/navigation.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cmap <C-p> <Up>
cmap <C-n> <Down>
" Quickfix navigation
nnoremap <C-n> :cnext<CR>
nnoremap <C-p> :cprev<CR>
" nnoremap <C-n> :cnext<CR>
" nnoremap <C-p> :cprev<CR>

" `:e`, but relative to current file
map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
Expand Down

0 comments on commit 6413975

Please sign in to comment.