feat(nvim): removed coc
This commit is contained in:
parent
8851240d87
commit
abbbb93cef
52
completion.lua
Normal file
52
completion.lua
Normal file
@ -0,0 +1,52 @@
|
||||
-- Completion Plugin Setup
|
||||
local cmp = require'cmp'
|
||||
cmp.setup({
|
||||
-- Enable LSP snippets
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Add tab support
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
})
|
||||
},
|
||||
-- Installed sources:
|
||||
sources = {
|
||||
{ name = 'path' }, -- file paths
|
||||
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
|
||||
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
||||
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||
{ name = 'calc'}, -- source for math calculation
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
fields = {'menu', 'abbr', 'kind'},
|
||||
format = function(entry, item)
|
||||
local menu_icon ={
|
||||
nvim_lsp = 'λ',
|
||||
vsnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
21
default.nix
21
default.nix
@ -42,24 +42,19 @@ in
|
||||
rainbow
|
||||
nvim-web-devicons
|
||||
fzf-vim
|
||||
coc-sh
|
||||
coc-nvim
|
||||
coc-json
|
||||
coc-yaml
|
||||
coc-tsserver
|
||||
coc-prettier
|
||||
coc-pyright
|
||||
coc-diagnostic
|
||||
vimtex
|
||||
coc-vimtex
|
||||
coc-html
|
||||
coc-go
|
||||
coc-spell-checker
|
||||
editorconfig-nvim
|
||||
# tmuxline-vim
|
||||
nvim-dap
|
||||
nvim-dap-ui
|
||||
nvim-notify
|
||||
nvim-cmp
|
||||
cmp-nvim-lsp
|
||||
cmp-nvim-lua
|
||||
cmp-buffer
|
||||
cmp-path
|
||||
cmp-spell
|
||||
cmp-conventionalcommits
|
||||
cmp-calc
|
||||
rust-tools-nvim
|
||||
plenary-nvim
|
||||
crates-nvim
|
||||
|
42
init.vim
42
init.vim
@ -5,45 +5,6 @@ set hidden
|
||||
" disable mouse
|
||||
set mouse=
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
|
||||
" Rename
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call ShowDocumentation()<CR>
|
||||
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
nmap <leader>as <Plug>(coc-codeaction-cursor)
|
||||
nmap <leader>cl <Plug>(coc-codelens-action)
|
||||
|
||||
nmap <silent> [G <Plug>(coc-diagnostic-next-error)
|
||||
nmap <silent> ]G <Plug>(coc-diagnostic-prev-error)
|
||||
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-next)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-prev)
|
||||
|
||||
function! ShowDocumentation()
|
||||
if CocAction('hasProvider', 'hover')
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
call feedkeys('K', 'in')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>F <Plug>(coc-format)
|
||||
|
||||
|
||||
" " Copy to clipboard
|
||||
vnoremap <leader>y "+y
|
||||
@ -67,9 +28,6 @@ map <leader>to :tabonly<cr>
|
||||
" Display line numbers
|
||||
set number relativenumber
|
||||
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
map <F3> :mksession! .nvim_session <cr> " Quick write session with F3
|
||||
map <F4> :source .nvim_session <cr> " And load session with F4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user