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