From 99f7c26cb2efb2e0546ac512fb1f9669fd5c9bc8 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sun, 24 Jul 2022 02:36:39 -0400 Subject: [PATCH] improve plugin config --- .vimrc | 13 +++----- .vimrc.bundles | 90 +++++++++++++++++++++----------------------------- 2 files changed, 42 insertions(+), 61 deletions(-) diff --git a/.vimrc b/.vimrc index a4eaba0..8cb2fb1 100644 --- a/.vimrc +++ b/.vimrc @@ -225,7 +225,8 @@ " Functions { - " Initialize directories { + " Initialize directories for undo, swap, viewdir + " to ~/.vim/.vim* function! InitializeDirectories() let parent = $HOME let prefix = 'vim' @@ -238,11 +239,6 @@ let dir_list['undo'] = 'undodir' endif - " To specify a different directory in which to place the vimbackup, - " vimviews, vimundo, and vimswap files/directories, add the following to - " your .vimrc.before.local file: - " let g:spf13_consolidated_directory = - " eg: let g:spf13_consolidated_directory = $HOME . '/.vim/' let g:spf13_consolidated_directory = $HOME . '/.vim/.' if exists('g:spf13_consolidated_directory') let common_dir = g:spf13_consolidated_directory . prefix @@ -267,9 +263,8 @@ endfor endfunction call InitializeDirectories() - " } - " Shell command { + " Shell command function! s:RunShellCommand(cmdline) botright new @@ -289,7 +284,7 @@ command! -complete=file -nargs=+ Shell call s:RunShellCommand() " e.g. Grep current file for : Shell grep -Hn % - " } + " Fix file type error for typescript autocmd BufNewFile,BufRead *.ts set filetype=typescript diff --git a/.vimrc.bundles b/.vimrc.bundles index ca37283..e3de258 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -13,59 +13,44 @@ let config_dir = '~/.dotfiles/' let plugin_dir = '~/.vim/plugged/' let g:vim_dir = '~/.vim/' + call plug#begin(plugin_dir) Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'rust-lang/rust.vim' - " syntax highlighting(and more) for typescript - " { - Plug 'leafgarland/typescript-vim' - " } + Plug 'leafgarland/typescript-vim' + " { Plug 'alvan/vim-closetag' let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js' " } - "{ - "Plug 'altercation/vim-colors-solarized' - "} - Plug 'scrooloose/nerdtree' - " for markdown{ Plug 'godlygeek/tabular' - Plug 'preservim/vim-markdown' + " for markdown{ + Plug 'preservim/vim-markdown' "} " for window resize{ Plug 'simeji/winresizer' - let g:winresizer_start_key = '' - let g:winresizer_vert_resize = 2 + let g:winresizer_start_key = '' + let g:winresizer_vert_resize = 2 let g:winresizer_horiz_resize = 2 " } Plug 'tpope/vim-surround' Plug 'rhysd/conflict-marker.vim' + " { - Plug 'jiangmiao/auto-pairs' - "let g:AutoPairsFlyMode = 1 - + Plug 'jiangmiao/auto-pairs' + "let g:AutoPairsFlyMode = 1 " } - " { Plug 'mg979/vim-visual-multi' - " } - "if has('nvim') && str2float(g:nvim_version) >= 0.5 - " Plug 'nvim-lualine/lualine.nvim' - "else + Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' - "endif - - " For nvim-bufferline - " { - "Plug 'kyazdani42/nvim-web-devicons' - "Plug 'akinsho/nvim-bufferline.lua' - " } + Plug 'bling/vim-bufferline' Plug 'easymotion/vim-easymotion' Plug 'nathanaelkane/vim-indent-guides' @@ -75,11 +60,6 @@ Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } endif - " nvim support only theme - " { - "Plug 'projekt0n/github-nvim-theme' - " } - " vim theme " { Plug 'NLKNguyen/papercolor-theme' @@ -93,13 +73,22 @@ call plug#end() -" Helper functions -" { - -" } - " Plugin Preferences " { + " godlygeek/tabular { + if isdirectory(expand(plugin_dir . "/tabular")) + nmap t= :Tabularize /= + vmap t= :Tabularize /= + + nmap t\| :Tab /\| + vmap t\| :Tab /\| + + nmap t: :Tab /:\zs + vmap t: :Tab /:\zs + endif + + " } + " xiyaowong/nvim-transparent { " } @@ -113,17 +102,17 @@ "let NERDTreeShowBookmarks=1 "let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$'] - let NERDTreeChDirMode=0 - let NERDTreeQuitOnOpen=1 - let NERDTreeMouseMode=2 - let NERDTreeShowHidden=1 - let NERDTreeKeepTreeInNewTab=1 + let NERDTreeChDirMode = 0 + let NERDTreeQuitOnOpen = 1 + let NERDTreeMouseMode = 2 + let NERDTreeShowHidden = 1 + let NERDTreeKeepTreeInNewTab = 1 endif " } " indent_guides { if isdirectory(expand(plugin_dir . "/vim-indent-guides/")) - let g:indent_guides_start_level = 2 - let g:indent_guides_guide_size = 1 + let g:indent_guides_start_level = 2 + let g:indent_guides_guide_size = 1 let g:indent_guides_enable_on_vim_startup = 0 map i :IndentGuidesToggle @@ -137,10 +126,10 @@ " vim-airline { " Set configuration options for the statusline plugin vim-airline. " Use the powerline theme and optionally enable powerline symbols. - let g:airline_section_b = '' - let g:airline_section_z = '' - let g:airline_section_y = '' - let g:airline_section_x = '' + let g:airline_section_b = '' + let g:airline_section_z = '' + let g:airline_section_y = '' + let g:airline_section_x = '' let g:airline_section_warning = '' "let g:airline#extensions#tabline#left_sep = '' "let g:airline#extensions#tabline#left_alt_sep = '|' @@ -164,11 +153,8 @@ " coc-tsserver: javascript " coc-pyright: python " coc-clangd: c/c++, may need to install clangd seperatly - let g:coc_global_extensions = ['coc-pyright', 'coc-rls'] + let g:coc_global_extensions = ['coc-pyright', 'coc-rls', 'coc-clangd', 'coc-tsserver', 'coc-html', 'coc-cmake', 'coc-sql', 'coc-json'] - " space-d jump to definition if coc is installed - "nnoremap d :call CocAction('jumpDefinition', v: false) - "nnoremap r :call CocAction('jumpReferences', v: false) if filereadable(expand(config_dir . "/.exp-coc-config")) exec "source " . config_dir . "/.exp-coc-config" endif