52 lines
1.8 KiB
Lua
52 lines
1.8 KiB
Lua
|
-- Smaller updatetime for CursorHold & CursorHoldI
|
||
|
vim.opt.updatetime = 300
|
||
|
|
||
|
-- don't give |ins-completion-menu| messages.
|
||
|
vim.opt.shortmess:append('c')
|
||
|
|
||
|
-- always show signcolumns
|
||
|
vim.opt.signcolumn = 'yes'
|
||
|
|
||
|
-- Some server have issues with backup files, see coc#649
|
||
|
vim.opt.backup = false
|
||
|
vim.opt.writebackup = false
|
||
|
|
||
|
-- Better display for messages
|
||
|
vim.opt.cmdheight = 2
|
||
|
|
||
|
-- Use <c-space> for trigger completion.
|
||
|
vim.keymap.set('i', '<C-space>', vim.fn['coc#refresh'], {
|
||
|
silent = true,
|
||
|
expr = true
|
||
|
})
|
||
|
|
||
|
-- Use <cr> for confirm completion, `<C-g>u` means break undo chain at current
|
||
|
-- position. Coc only does snippet and additional edit on confirm.
|
||
|
local function confirm_coc_completion()
|
||
|
return vim.fn.pumvisible() == 1 and "<C-y>" or "<C-g>u<CR>"
|
||
|
end
|
||
|
vim.keymap.set('i', '<CR>', confirm_coc_completion, { expr = true })
|
||
|
|
||
|
local sr_opts = { silent = true, remap = true }
|
||
|
-- Use `[c` and `]c` for navigate diagnostics
|
||
|
vim.keymap.set('n', '[c', '<Plug>(coc-diagnostic-prev)', sr_opts)
|
||
|
vim.keymap.set('n', ']c', '<Plug>(coc-diagnostic-next)', sr_opts)
|
||
|
|
||
|
-- Remap keys for gotos
|
||
|
vim.keymap.set('n', 'gd', '<Plug>(coc-definition)', sr_opts)
|
||
|
vim.keymap.set('n', 'gy', '<Plug>(coc-type-definition)', sr_opts)
|
||
|
vim.keymap.set('n', 'gi', '<Plug>(coc-implementation)', sr_opts)
|
||
|
vim.keymap.set('n', 'gr', '<Plug>(coc-references)', sr_opts)
|
||
|
|
||
|
-- Remap for do code action of current line
|
||
|
vim.keymap.set('n', '<localleader>a', '<Plug>(coc-codeaction)')
|
||
|
-- Remap for rename current word
|
||
|
vim.keymap.set('n', '<localleader>n', '<Plug>(coc-rename)')
|
||
|
|
||
|
-- Mapping for CocList
|
||
|
vim.keymap.set('n', '<localleader>cl', ':CocList<CR>')
|
||
|
vim.keymap.set('n', '<localleader>cd', ':CocList diagnostics<CR>')
|
||
|
vim.keymap.set('n', '<localleader>cc', ':CocList commands<CR>')
|
||
|
vim.keymap.set('n', '<localleader>co', ':CocList outline<CR>')
|
||
|
vim.keymap.set('n', '<localleader>cs', ':CocList symbols<CR>')
|