remove nvim and cleanup file
This commit is contained in:
parent
09991e10f2
commit
b2f42d9023
1 changed files with 42 additions and 72 deletions
114
nvim/init.vim
114
nvim/init.vim
|
@ -1,5 +1,7 @@
|
||||||
call plug#begin('~/.config/nvim/bundle')
|
call plug#begin('~/.config/nvim/bundle')
|
||||||
" USEFUL
|
" USEFUL
|
||||||
|
" Editor config
|
||||||
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
|
|
||||||
" comment plugin
|
" comment plugin
|
||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
|
@ -45,12 +47,6 @@ Plug 'norcalli/nvim-colorizer.lua'
|
||||||
" powerline
|
" powerline
|
||||||
Plug 'vim-airline/vim-airline'
|
Plug 'vim-airline/vim-airline'
|
||||||
|
|
||||||
" Coc Nvim
|
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
||||||
|
|
||||||
" nvim-remote
|
|
||||||
Plug 'mhinz/neovim-remote'
|
|
||||||
|
|
||||||
" language packs
|
" language packs
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
|
|
||||||
|
@ -102,8 +98,26 @@ set incsearch
|
||||||
set hlsearch
|
set hlsearch
|
||||||
set smartcase
|
set smartcase
|
||||||
|
|
||||||
|
" REMAPS
|
||||||
|
|
||||||
" search for visual selection
|
" search for visual selection
|
||||||
vnoremap // y/<C-R>"<CR>
|
vnoremap // y/<C-R>"<CR>
|
||||||
|
nnoremap H ^
|
||||||
|
|
||||||
|
" ex command
|
||||||
|
cnoremap <C-p> <Up>
|
||||||
|
cnoremap <C-n> <Down>
|
||||||
|
|
||||||
|
" auto expand brackets
|
||||||
|
inoremap (; (<CR>)<C-c>O
|
||||||
|
inoremap (, (<CR>),<C-c>O
|
||||||
|
inoremap {; {<CR>}<C-c>O
|
||||||
|
inoremap {, {<CR>},<C-c>O
|
||||||
|
inoremap [; [<CR>]<C-c>O
|
||||||
|
inoremap [, [<CR>],<C-c>O
|
||||||
|
|
||||||
|
" toggle hybrid mode
|
||||||
|
nnoremap <leader>h :set rnu!<CR>
|
||||||
|
|
||||||
" Disable Backup and Swap files
|
" Disable Backup and Swap files
|
||||||
set noswapfile
|
set noswapfile
|
||||||
|
@ -114,9 +128,6 @@ set nowritebackup
|
||||||
set splitbelow
|
set splitbelow
|
||||||
set splitright
|
set splitright
|
||||||
|
|
||||||
" tabs
|
|
||||||
nnoremap <leader>t :tabnew<CR>
|
|
||||||
|
|
||||||
" Enable folding
|
" Enable folding
|
||||||
set foldmethod=indent
|
set foldmethod=indent
|
||||||
set foldlevel=99
|
set foldlevel=99
|
||||||
|
@ -124,28 +135,13 @@ set foldlevel=99
|
||||||
" auto reload .vimrc on write
|
" auto reload .vimrc on write
|
||||||
autocmd BufWritePost init.vim source %
|
autocmd BufWritePost init.vim source %
|
||||||
|
|
||||||
" ex command
|
|
||||||
cnoremap <C-p> <Up>
|
|
||||||
cnoremap <C-n> <Down>
|
|
||||||
|
|
||||||
nnoremap H ^
|
|
||||||
|
|
||||||
" toggle hybrid number mode
|
" toggle hybrid number mode
|
||||||
nnoremap <leader>h :set rnu!<CR>
|
|
||||||
:augroup numbertoggle
|
:augroup numbertoggle
|
||||||
: autocmd!
|
: autocmd!
|
||||||
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
|
||||||
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
|
||||||
:augroup END
|
:augroup END
|
||||||
|
|
||||||
" auto expand brackets
|
|
||||||
inoremap (; (<CR>)<C-c>O
|
|
||||||
inoremap (, (<CR>),<C-c>O
|
|
||||||
inoremap {; {<CR>}<C-c>O
|
|
||||||
inoremap {, {<CR>},<C-c>O
|
|
||||||
inoremap [; [<CR>]<C-c>O
|
|
||||||
inoremap [, [<CR>],<C-c>O
|
|
||||||
|
|
||||||
" Delete buffer while keeping window layout (don't close buffer's windows).
|
" Delete buffer while keeping window layout (don't close buffer's windows).
|
||||||
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
|
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
|
||||||
if v:version < 700 || exists('loaded_bclose') || &cp
|
if v:version < 700 || exists('loaded_bclose') || &cp
|
||||||
|
@ -156,9 +152,6 @@ if !exists('bclose_multiple')
|
||||||
let bclose_multiple = 1
|
let bclose_multiple = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" make all tabs to spaces
|
|
||||||
nnoremap <silent> <leader>i :set expandtab<CR>:retab<CR>
|
|
||||||
|
|
||||||
" Display an error message.
|
" Display an error message.
|
||||||
function! s:Warn(msg)
|
function! s:Warn(msg)
|
||||||
echohl ErrorMsg
|
echohl ErrorMsg
|
||||||
|
@ -228,6 +221,7 @@ nnoremap <silent> <Leader>bd :Bclose<CR>
|
||||||
let g:polyglot_disabled = ["latex"]
|
let g:polyglot_disabled = ["latex"]
|
||||||
" nerd tree setup
|
" nerd tree setup
|
||||||
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
|
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
|
||||||
|
|
||||||
map <leader>e :NERDTreeToggle<CR>
|
map <leader>e :NERDTreeToggle<CR>
|
||||||
|
|
||||||
" AIRLINE SETUP
|
" AIRLINE SETUP
|
||||||
|
@ -286,51 +280,27 @@ endfunction
|
||||||
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
autocmd! User GoyoEnter nested call <SID>goyo_enter()
|
||||||
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|
autocmd! User GoyoLeave nested call <SID>goyo_leave()
|
||||||
|
|
||||||
" Coc vim setup
|
let g:goyo_linenr = 0
|
||||||
set hidden
|
|
||||||
set updatetime=300
|
|
||||||
set shortmess+=c
|
|
||||||
" Use <c-space> to trigger completion.
|
|
||||||
inoremap <silent><expr> <c-space> coc#refresh()
|
|
||||||
" navigate diagnostics
|
|
||||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
|
||||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
|
||||||
" goto remaps
|
|
||||||
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 K to show documentation in preview window
|
|
||||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
|
||||||
|
|
||||||
function! s:show_documentation()
|
" Autocompletion
|
||||||
if (index(['vim','help'], &filetype) >= 0)
|
if executable('pyls')
|
||||||
execute 'h '.expand('<cword>')
|
au User lsp_setup call lsp#register_server({
|
||||||
else
|
\ 'name': 'pyls',
|
||||||
call CocAction('doHover')
|
\ 'cmd': {server_info->['pyls']},
|
||||||
endif
|
\ 'whitelist': ['python'],
|
||||||
|
\ })
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! s:on_lsp_buffer_enabled() abort
|
||||||
|
setlocal omnifunc=lsp#complete
|
||||||
|
setlocal signcolumn=yes
|
||||||
|
nmap <buffer> gd <plug>(lsp-definition)
|
||||||
|
nmap <buffer> <f2> <plug>(lsp-rename)
|
||||||
|
" refer to doc to add more commands
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Remap for rename current word
|
augroup lsp_install
|
||||||
nmap <leader>rn <Plug>(coc-rename)
|
au!
|
||||||
|
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
|
||||||
" Use `:Form` to format current buffer
|
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
|
||||||
command! -nargs=0 Form :call CocAction('format')
|
augroup END
|
||||||
|
|
||||||
" Using CocList
|
|
||||||
" Show all diagnostics
|
|
||||||
nnoremap <silent> <leader>a :<C-u>CocList diagnostics<cr>
|
|
||||||
" Manage extensions
|
|
||||||
nnoremap <silent> <leader>x :<C-u>CocList extensions<cr>
|
|
||||||
" Show commands
|
|
||||||
nnoremap <silent> <leader>c :<C-u>CocList commands<cr>
|
|
||||||
" Find symbol of current document
|
|
||||||
nnoremap <silent> <leader>o :<C-u>CocList outline<cr>
|
|
||||||
" Search workspace symbls
|
|
||||||
nnoremap <silent> <leader>s :<C-u>CocList -I symbols<cr>
|
|
||||||
" Do default action fo next item.
|
|
||||||
nnoremap <silent> <leader>j :<C-u>CocNext<CR>
|
|
||||||
" Do default action for previous item.
|
|
||||||
nnoremap <silent> <leader>k :<C-u>CocPrev<CR>
|
|
||||||
" Resume latest coc list
|
|
||||||
nnoremap <silent> <leader>p :<C-u>CocListResume<CR>
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue