diff --git a/.gitignore b/.gitignore index 93043dc..07cddbe 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ config/ranger/history config/ranger/tagged config/ranger/plugins config/Thunar/accels.scm +config/nvim/autoload +config/nvim/plugged +config/nvim/.* diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..3a56a22 --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,3 @@ +{ + "npm.binPath": "yarn" +} diff --git a/config/nvim/coc-settings.json b/config/nvim/coc-settings.json new file mode 100644 index 0000000..a28de70 --- /dev/null +++ b/config/nvim/coc-settings.json @@ -0,0 +1,4 @@ +{ + "npm.binPath": "yarn", + "python.linting.flake8Enabled": true +} diff --git a/config/nvim/init.vim b/config/nvim/init.vim new file mode 100644 index 0000000..5315707 --- /dev/null +++ b/config/nvim/init.vim @@ -0,0 +1,105 @@ +" basic settings +set ts=4 +set sw=4 +set cc=120 +set expandtab +set nu +set hidden +set list +set autoindent +set confirm +set noundofile +set nobackup +set hlsearch +set noswapfile +set ignorecase +filetype plugin indent on +syntax on +cnoremap +cnoremap +cnoremap +cnoremap +cnoremap +cnoremap +cnoremap + +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap +inoremap + +noremap +noremap +noremap +noremap + +vnoremap p "_dP +nnoremap q :qall + + +" trailing spaces +highlight ExtraWhitespace ctermbg=red guibg=red +au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red +au Syntax * match ExtraWhitespace /\s\+$/ +nnoremap es :%s/\s\+$//g + +" auto install vim-plug +let vim_plug_path = expand("~/.config/nvim/autoload/plug.vim") +let vim_plug_just_installed = 0 +if !filereadable(vim_plug_path) + echo "Installing vim-plug..." + :exe "!curl -fLo " . vim_plug_path . " --create-dirs https://gitee.com/klesh/vim-plug/raw/master/plug.vim" + let vim_plug_just_installed = 1 + echo "vim-plug installed" +endif + +call plug#begin() +Plug 'editorconfig/editorconfig-vim' +Plug 'tpope/vim-surround' +"Plug 'jiangmiao/auto-pairs' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'} +Plug 'iamcco/coc-vimlsp', {'do': 'yarn install --frozen-lockfile'} +Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'} +Plug 'weirongxu/coc-explorer', {'do': 'yarn install --frozen-lockfile'} +Plug 'liuchengxu/eleline.vim' +Plug 'tpope/vim-fugitive' " git 功能 +Plug 'scrooloose/nerdcommenter' +Plug 'ctrlpvim/ctrlp.vim' +Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } +call plug#end() + + +" ==== coc configuration ==== +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +xmap fs (coc-format-selected) +nmap fs (coc-format-selected) +nmap fb (coc-format) +nmap sd :call CocAction('doHover') +nmap rn (coc-rename) +nmap ne (coc-diagnostic-next-error) +nmap pe (coc-diagnostic-prev-error) +nmap fe :CocCommand explorer --toggle +nmap if :CocInfo +nmap cl :CocList +nmap ol (coc-openlink) +nnoremap sg :Grepper -tool git +nnoremap sc :Grepper -tool grep + + +" ==== fugitive configuration ==== +nnoremap gs :Gstatus +nnoremap gc :Gcommit +nnoremap gp :Gpush +nnoremap gg :Gpull +nnoremap gd :Gdiff + +" ==== ctrlp configuration ==== +let g:ctrlp_user_command = ['.git', 'git ls-files -co --exclude-standard'] diff --git a/vimrc b/vimrc index 6c5f093..484607a 100644 --- a/vimrc +++ b/vimrc @@ -50,11 +50,14 @@ Plug 'jiangmiao/auto-pairs' " ide like Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'mgedmin/coverage-highlight.vim' -"Plug 'klesh/vim-fakeclip' +Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'} +Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'} +Plug 'weirongxu/coc-explorer', {'do': 'yarn install --frozen-lockfile'} Plug 'scrooloose/nerdcommenter' Plug 'tpope/vim-fugitive' " git 功能 -Plug 'scrooloose/nerdtree' +"Plug 'scrooloose/nerdtree' +"Plug 'mgedmin/coverage-highlight.vim' +"Plug 'klesh/vim-fakeclip' " color themes Plug 'morhetz/gruvbox' @@ -66,7 +69,7 @@ Plug 'lunaru/vim-less' Plug 'posva/vim-vue' Plug 'othree/html5.vim' Plug 'dag/vim-fish' -Plug 'vim-python/python-syntax' +"Plug 'vim-python/python-syntax' Plug 'plasticboy/vim-markdown' "Plug 'digitaltoad/vim-pug' @@ -80,15 +83,21 @@ nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) +xmap fs (coc-format-selected) +nmap fs (coc-format-selected) +nmap fb (coc-format) +nmap rn (coc-rename) +nmap ne (coc-diagnostic-next-error) +nmap pe (coc-diagnostic-prev-error) +nmap fe :CocCommand explorer --toggle +nmap if :CocInfo +nmap cl :CocList +nmap ol (coc-openlink) + " Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight') -" Remap for rename current word -nmap rn (coc-rename) -" Remap for format selected region -xmap f (coc-format-selected) -nmap f (coc-format-selected) " Use K to show documentation in preview window function! s:show_documentation()