nix/prog/nvim: fix coc-nvim config

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-26 16:55:21 +03:00
parent 0fc652d311
commit 4a965d655d
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
3 changed files with 18 additions and 4 deletions

View file

@ -1,4 +1,13 @@
{
# General
coc.source = {
around.enable = true;
buffer.enable = true;
file.enable = false;
};
# LSP
languageserver = {
nix = {
command = "rnix-lsp";

View file

@ -72,8 +72,6 @@ vim.opt.formatoptions = 'jtcrq'
vim.opt.clipboard = 'unnamedplus'
-- Highlight line cursor is currently on.
vim.opt.cursorline = true
-- Select the first item of popup menu automatically without inserting it.
vim.opt.completeopt:append('noinsert')
-- Invisible characters representation when :set list
vim.opt.listchars = {
tab = '',

View file

@ -1,6 +1,8 @@
-- Smaller updatetime for CursorHold & CursorHoldI
vim.opt.updatetime = 300
-- Coc don't use completeopt
vim.opt.completeopt = {}
-- don't give |ins-completion-menu| messages.
vim.opt.shortmess:append('c')
@ -23,9 +25,14 @@ vim.keymap.set('i', '<C-space>', vim.fn['coc#refresh'], {
-- 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>"
if vim.call'coc#pum#visible' == 1 then
vim.call'coc#pum#confirm'
return ""
else
return "<CR>"
end
vim.keymap.set('i', '<CR>', confirm_coc_completion, { expr = true })
end
vim.keymap.set('i', '<CR>', confirm_coc_completion, { expr = true, silent = true })
local sr_opts = { silent = true, remap = true }
-- Use `[c` and `]c` for navigate diagnostics