Add default coc.nvim extensions & update autocomplete function
This commit is contained in:
parent
4f2b3e9bed
commit
449018c146
1 changed files with 23 additions and 10 deletions
|
|
@ -97,24 +97,37 @@ highlight CursorLine cterm=NONE
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
set statusline=\ %F\ %m%r%w\ %=\ %{hostname()}\ \ \ %{strlen(&ft)?&ft:'none'}\ %{(&bomb?\",BOM\":\"\")}\ %{&ff}\ \ %l/%L\ \ %c\ %P
|
set statusline=\ %F\ %m%r%w\ %=\ %{hostname()}\ \ \ %{strlen(&ft)?&ft:'none'}\ %{(&bomb?\",BOM\":\"\")}\ %{&ff}\ \ %l/%L\ \ %c\ %P
|
||||||
|
|
||||||
" tab autocompletion
|
" use <tab> for trigger completion and navigate to the next complete item
|
||||||
function! Tab_Or_Complete()
|
function! s:check_back_space() abort
|
||||||
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
|
let col = col('.') - 1
|
||||||
return "\<C-N>"
|
return !col || getline('.')[col - 1] =~ '\s'
|
||||||
else
|
|
||||||
return "\<Tab>"
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" tab completion
|
||||||
|
inoremap <silent><expr> <Tab>
|
||||||
|
\ pumvisible() ? "\<C-n>" :
|
||||||
|
\ <SID>check_back_space() ? "\<Tab>" :
|
||||||
|
\ coc#refresh()
|
||||||
|
|
||||||
" open nerdtree browser
|
" open nerdtree browser
|
||||||
map <silent> <C-E> :NERDTreeToggle <CR>
|
map <silent> <C-E> :NERDTreeToggle <CR>
|
||||||
|
|
||||||
" tab for completion
|
|
||||||
inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
|
|
||||||
|
|
||||||
" set default coc environment path
|
" set default coc environment path
|
||||||
let g:python3_host_prog = '~/.local/lib/coc/.venv/bin/python'
|
let g:python3_host_prog = '~/.local/lib/coc/.venv/bin/python'
|
||||||
|
|
||||||
|
" default coc extensions
|
||||||
|
" see https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions#install-extensions
|
||||||
|
" installed if not detected to ~/.config/coc/extensions
|
||||||
|
let g:coc_global_extensions = [\
|
||||||
|
'coc-pyright',\
|
||||||
|
'coc-html',\
|
||||||
|
'coc-htmldjango',\
|
||||||
|
'coc-css',\
|
||||||
|
'coc-tsserver',\
|
||||||
|
'coc-git',\
|
||||||
|
'coc-json'\
|
||||||
|
]
|
||||||
|
|
||||||
if filereadable(expand('~/.config/nvim/override.vim'))
|
if filereadable(expand('~/.config/nvim/override.vim'))
|
||||||
source ~/.config/nvim/override.vim
|
source ~/.config/nvim/override.vim
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue