WSL Ubuntu 在 Neovim 上安装Coc.nvim
,补全Fortran
安装Coc.nvim
Plug 'neoclide/coc.nvim',{'branch': 'release'}
一些配置
let g:coc_global_extensions=['coc-vimlsp','coc-json','coc-snippets','coc-tabnine','coc-python']
inoremap <expr> <CR> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <silent><expr> <TAB>
\ pumvisible() ? coc#_select_confirm() :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
nmap <silent> gd <Plug>(coc-definition)
nmap <leader>n <Plug>(coc-rename)
nmap <leader>m :CocCommand document.renameCurrentWord<CR>
nmap <leader>c <Plug>(coc-cursors-word)
Fortran 补全
Fortran 补全需要依赖于lsp,首先安装lsp
pip3 install fortran-language-server
安装完成后,配置coc
{
"coc.preferences.extensionUpdateCheck": "never",
"suggest.noselect": true,
"suggest.enablePreselect": false,
"snippets.snipmate.enable": true,
"languageserver": {
"fortran": {
"command": "~/.local/bin/fortls",
"args": ["--lowercase_intrinsics"],
"filetypes": ["fortran"],
"rootPatterns": ["~/.local/lib/python3.8/site-packages/fortls"]
}
}
}
配置完成后可以进行补全