diff --git a/.exp-coc-config b/.exp-coc-config index 2aecf19..f0454d5 100644 --- a/.exp-coc-config +++ b/.exp-coc-config @@ -21,7 +21,7 @@ set shortmess+=c " Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. -set signcolumn=yes +"set signcolumn=yes " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by 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 6dd382d..7b2420e 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,31 +60,39 @@ Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } endif - " nvim support only theme - " { - "Plug 'projekt0n/github-nvim-theme' - " } - " vim theme " { - Plug 'danilo-augusto/vim-afterglow' Plug 'NLKNguyen/papercolor-theme' " } + " only work with nvim > 0.5 + " For other versions, just loading the plugin may + " cause error if g:vim_type == 'nvim' && g:vim_version > 0.5 Plug 'xiyaowong/nvim-transparent' endif + Plug 'EdenEast/nightfox.nvim' + Plug 'catppuccin/vim', { 'as': 'catppuccin' } 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 +106,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 +130,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 +157,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 @@ -214,7 +204,13 @@ if g:vim_type == 'nvim' && g:vim_version > 0.5 :TransparentEnable elseif g:theme_color == 'dark' - let g:afterglow_inherit_background=1 + let g:PaperColor_Theme_Options = { + \ 'theme': { + \ 'default.dark': { + \ 'transparent_background': 1 + \ } + \ } + \ } execute("colorscheme " . g:dark_theme) elseif g:theme_color == 'light' let g:PaperColor_Theme_Options = { @@ -232,7 +228,13 @@ if g:vim_type == 'nvim' && g:vim_version > 0.5 :TransparentDisable elseif g:theme_color == 'dark' - let g:afterglow_inherit_background=0 + let g:PaperColor_Theme_Options = { + \ 'theme': { + \ 'default.dark': { + \ 'transparent_background': 0 + \ } + \ } + \ } execute("colorscheme " . g:dark_theme) elseif g:theme_color == 'light' let g:PaperColor_Theme_Options = { @@ -276,20 +278,18 @@ " let g:dark_theme = 'github_dark' " let g:light_theme = 'github_light' if isdirectory(expand(plugin_dir . "/nightfox.nvim")) && has('nvim') && g:vim_version >= 0.5 - "let g:dark_theme = 'Nightfox' - let g:dark_theme = 'Nordfox' - let g:light_theme = 'Dayfox' - + "let g:dark_theme = 'nordfox' + let g:light_theme = 'dawnfox' + let g:dark_theme = 'nightfox' + let g:airline_dark_theme = "hybrid" " } " { " vim theme - elseif isdirectory(expand(plugin_dir . "/vim-afterglow")) - if isdirectory(expand(plugin_dir . "/papercolor-theme")) - let g:light_theme = 'PaperColor' - endif - "let g:afterglow_inherit_background=1 - let g:dark_theme = 'afterglow' + elseif isdirectory(expand(plugin_dir . "/papercolor-theme")) + " improve coc color in this theme + let g:light_theme = 'PaperColor' + let g:dark_theme = 'PaperColor' endif " } diff --git a/install.sh b/install.sh index eb79799..9527356 100755 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ success() { msg "\33[32m[✔]\33[0m ${1}${2}" } -function fatal_error() { +fatal_error() { msg "\33[31m[✘]\33[0m ${1}${2}" exit 1 }