Browse Source

vim: ++coc.nvim settings

Maxim Likhachev 4 years ago
parent
commit
aca317c187
  1. 54
      etc/soft/nvim/coc-settings.json
  2. 88
      etc/soft/nvim/vimrc

54
etc/soft/nvim/coc-settings.json

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
{
"diagnostic.errorSign": "✖",
"suggest.autoTrigger": "none",
"coc.preferences.formatOnSaveFiletypes": [],
"codeLens.enable": true,
"coc.preferences.formatOnSaveFiletypes": ["haskell"],
"coc.preferences.snippets.enable": true,
"languageserver": {
"golang": {
"command": "/Users/m.likhachev/go/bin/gopls",
"rootPatterns": ["go.mod", ".vim/", ".git/"],
"filetypes": ["go"],
"initializationOptions": {
"usePlaceholders": true
}
},
"bash": {
"command": "bash-language-server",
"args": ["start"],
"filetypes": ["sh"],
"ignoredRootPaths": ["~"]
},
"haskell": {
"command": "haskell-language-server-wrapper",
"args": ["--lsp", "--debug"],
"rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
"filetypes": ["haskell", "lhaskell"],
"settings": {
"languageServerHaskell": {
"hlintOn": true,
"maxNumberOfProblems": 10,
"completionSnippetsOn": true,
"formattingProvider": "none"
}
}
},
"python": {
"command": "pylsp",
"filetypes": ["python"],
"ignoredRootPaths": ["~"]
},
"terraform": {
"command": "terraform-ls",
"args": ["serve"],
//"command": "terraform-lsp",
"filetypes": [
"terraform",
"tf"
],
"initializationOptions": {},
"settings": {}
}
}
}

88
etc/soft/nvim/vimrc

@ -331,9 +331,9 @@ nmap <silent> ,/ :nohlsearch<CR> @@ -331,9 +331,9 @@ nmap <silent> ,/ :nohlsearch<CR>
" Перемещение курсора в режиме вставки
" imap <C-h> <left>
imap <C-j> <down>
imap <C-k> <up>
imap <C-l> <right>
" imap <C-j> <down>
" imap <C-k> <up>
" imap <C-l> <right>
" Показ строк, содержащих слово под курсором
nmap <Leader>g [I:let nr=input("> ")<Bar>exe "normal " . nr . "[\t"<CR>
@ -626,7 +626,7 @@ let g:airline_whitespace_symbol = '∅' @@ -626,7 +626,7 @@ let g:airline_whitespace_symbol = '∅'
let g:airline_section_c = '%t%m%r%h%w'
let g:airline_section_z = '%L:%03l,%03v %p%%'
let g:airline_extensions = ['neomake', 'whitespace']
let g:airline_extensions = ['neomake', 'whitespace', 'coc']
" enable/disable fugitive/lawrencium integration
let g:airline_enable_branch=1
@ -655,6 +655,12 @@ let g:airline_theme='cool' @@ -655,6 +655,12 @@ let g:airline_theme='cool'
" enable/disable usage of patched powerline font symbols
let g:airline_powerline_fonts=0
let g:airline#extensions#coc#enabled = 1
let airline#extensions#coc#error_symbol = 'E:'
let airline#extensions#coc#warning_symbol = 'W:'
let airline#extensions#coc#stl_format_err = '%E{[%e(#%fe)]}'
let airline#extensions#coc#stl_format_warn = '%W{[%w(#%fw)]}'
" define the set of text to display for each mode.
let g:airline_mode_map = { 'i': '+', 'n': ' ', 'v': '⇄', 'V': '⇄', '': '⇅', 'R': '✂', 'c': '#', 's': 'SELECT', '^S': 'S-BLOCK', 'S': 'S-LINE' }
@ -761,8 +767,8 @@ let g:timestamp_rep = '%a %d %b %Y %H:%M:%S' @@ -761,8 +767,8 @@ let g:timestamp_rep = '%a %d %b %Y %H:%M:%S'
"Pummode"{{{
" Выбор вариантов дополнения курсорными клавишами
call pummode#map('i', '', 0, 'j', '<C-n>')
call pummode#map('i', '', 0, 'k', '<C-p>')
call pummode#map('i', '', 1, "<C-j>", '<TAB>')
call pummode#map('i', '', 1, "<C-k>", '<C-p>')
call pummode#map('i', '', 0, '<CR>', '<C-y>')
"}}}
@ -799,6 +805,7 @@ let g:used_javascript_libs = 'jquery' @@ -799,6 +805,7 @@ let g:used_javascript_libs = 'jquery'
" When writing a buffer (no delay).
call neomake#configure#automake('w')
" let g:neomake_open_list = 2
let g:neomake_haskell_enabled_makers = ["hlint"]
" }}}
" nnn.vim {{{
@ -885,8 +892,8 @@ let g:CheatSheetDefaultMode=0 @@ -885,8 +892,8 @@ let g:CheatSheetDefaultMode=0
let g:CheatSheetFrameworks = {}
imap <script> <silent> <C-O>
\ <ESC>:call cheat#cheat("", getcurpos()[1], getcurpos()[1], 0, 0, '!')<CR>
" imap <script> <silent> <C-O>
" \ <ESC>:call cheat#cheat("", getcurpos()[1], getcurpos()[1], 0, 0, '!')<CR>
" }}}
@ -957,6 +964,71 @@ let g:committia_min_window_width = 80 @@ -957,6 +964,71 @@ let g:committia_min_window_width = 80
" }}}
" Coc {{{
let g:coc_node_path='~/.nvm/versions/node/v12.12.0/bin/node'
let g:coc_suggest_disable = 1
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Introduce function text object
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" 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)
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-X>\<C-O>"
inoremap <silent><expr> <C-l>
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <C-l> for trigger snippet expand.
" imap <C-l> <Plug>(coc-snippets-expand)
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)
" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'
" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'
" }}}
" HaskellConcealPlus {{{
" [ ] 'q' option to disable concealing of scientific constants (e.g. π)

Loading…
Cancel
Save