nix/prog/nvim: move coc config to lua
This commit is contained in:
parent
69cec5f1cc
commit
5762db06cc
5 changed files with 55 additions and 50 deletions
|
@ -1,46 +0,0 @@
|
|||
" Smaller updatetime for CursorHold & CursorHoldI
|
||||
set updatetime=300
|
||||
|
||||
" don't give |ins-completion-menu| messages.
|
||||
set shortmess+=c
|
||||
|
||||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
" Some server have issues with backup files, see coc#649
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Better display for messages
|
||||
set cmdheight=2
|
||||
|
||||
" Use <c-space> for trigger completion.
|
||||
inoremap <silent><expr> <c-space> 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.
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[c` and `]c` for navigate diagnostics
|
||||
nmap <silent> [c <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]c <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
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)
|
||||
|
||||
" Remap for do code action of current line
|
||||
nmap <localleader>a <Plug>(coc-codeaction)
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <localleader>n <Plug>(coc-rename)
|
||||
|
||||
" Mappings for CocList
|
||||
nnoremap <localleader>cl :CocList<CR>
|
||||
nnoremap <localleader>cd :CocList diagnostics<CR>
|
||||
nnoremap <localleader>cc :CocList commands<CR>
|
||||
nnoremap <localleader>co :CocList outline<CR>
|
||||
nnoremap <localleader>cs :CocList symbols<CR>
|
||||
|
|
@ -1 +1,2 @@
|
|||
lua require('basic')
|
||||
lua require 'basic'
|
||||
lua require 'coc'
|
||||
|
|
|
@ -41,10 +41,9 @@ let
|
|||
|
||||
baseConfig = builtins.readFile ./config.vim;
|
||||
pluginsConfig = builtins.readFile ./plugins.vim;
|
||||
cocConfig = builtins.readFile ./coc.vim;
|
||||
cocSettings = builtins.toJSON (import ./coc_settings.nix);
|
||||
|
||||
vimConfig = baseConfig + pluginsConfig + cocConfig;
|
||||
vimConfig = baseConfig + pluginsConfig;
|
||||
in
|
||||
{
|
||||
options.progs.nvim = {
|
||||
|
|
|
@ -137,7 +137,7 @@ vim.api.nvim_create_autocmd(bufReadFile, {
|
|||
})
|
||||
|
||||
local folding_augroup = vim.api.nvim_create_augroup('folding', {})
|
||||
vim.api.nvim_create_augroup(bufReadFile, {
|
||||
vim.api.nvim_create_autocmd(bufReadFile, {
|
||||
group = folding_augroup,
|
||||
pattern = {
|
||||
'*.js',
|
||||
|
|
51
nix/progs/nvim/lua/coc.lua
Normal file
51
nix/progs/nvim/lua/coc.lua
Normal file
|
@ -0,0 +1,51 @@
|
|||
-- 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>')
|
Loading…
Reference in a new issue