This commit is contained in:
Nachuan Tang
2022-07-24 03:21:46 -04:00
4 changed files with 71 additions and 76 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time " Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved. " diagnostics appear/become resolved.
set signcolumn=yes "set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate. " Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by " NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
+4 -9
View File
@@ -225,7 +225,8 @@
" Functions { " Functions {
" Initialize directories { " Initialize directories for undo, swap, viewdir
" to ~/.vim/.vim*
function! InitializeDirectories() function! InitializeDirectories()
let parent = $HOME let parent = $HOME
let prefix = 'vim' let prefix = 'vim'
@@ -238,11 +239,6 @@
let dir_list['undo'] = 'undodir' let dir_list['undo'] = 'undodir'
endif 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 = <full path to desired directory>
" eg: let g:spf13_consolidated_directory = $HOME . '/.vim/'
let g:spf13_consolidated_directory = $HOME . '/.vim/.' let g:spf13_consolidated_directory = $HOME . '/.vim/.'
if exists('g:spf13_consolidated_directory') if exists('g:spf13_consolidated_directory')
let common_dir = g:spf13_consolidated_directory . prefix let common_dir = g:spf13_consolidated_directory . prefix
@@ -267,9 +263,8 @@
endfor endfor
endfunction endfunction
call InitializeDirectories() call InitializeDirectories()
" }
" Shell command { " Shell command
function! s:RunShellCommand(cmdline) function! s:RunShellCommand(cmdline)
botright new botright new
@@ -289,7 +284,7 @@
command! -complete=file -nargs=+ Shell call s:RunShellCommand(<q-args>) command! -complete=file -nargs=+ Shell call s:RunShellCommand(<q-args>)
" e.g. Grep current file for <search_term>: Shell grep -Hn <search_term> % " e.g. Grep current file for <search_term>: Shell grep -Hn <search_term> %
" }
" Fix file type error for typescript " Fix file type error for typescript
autocmd BufNewFile,BufRead *.ts set filetype=typescript autocmd BufNewFile,BufRead *.ts set filetype=typescript
+64 -64
View File
@@ -13,59 +13,44 @@
let config_dir = '~/.dotfiles/' let config_dir = '~/.dotfiles/'
let plugin_dir = '~/.vim/plugged/' let plugin_dir = '~/.vim/plugged/'
let g:vim_dir = '~/.vim/' let g:vim_dir = '~/.vim/'
call plug#begin(plugin_dir) call plug#begin(plugin_dir)
Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'rust-lang/rust.vim' Plug 'rust-lang/rust.vim'
" syntax highlighting(and more) for typescript Plug 'leafgarland/typescript-vim'
" {
Plug 'leafgarland/typescript-vim'
" }
" { " {
Plug 'alvan/vim-closetag' Plug 'alvan/vim-closetag'
let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js' let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
" } " }
"{
"Plug 'altercation/vim-colors-solarized'
"}
Plug 'scrooloose/nerdtree' Plug 'scrooloose/nerdtree'
" for markdown{
Plug 'godlygeek/tabular' Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown' " for markdown{
Plug 'preservim/vim-markdown'
"} "}
" for window resize{ " for window resize{
Plug 'simeji/winresizer' Plug 'simeji/winresizer'
let g:winresizer_start_key = '<leader-r>' let g:winresizer_start_key = '<leader-r>'
let g:winresizer_vert_resize = 2 let g:winresizer_vert_resize = 2
let g:winresizer_horiz_resize = 2 let g:winresizer_horiz_resize = 2
" } " }
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'rhysd/conflict-marker.vim' Plug 'rhysd/conflict-marker.vim'
" {
Plug 'jiangmiao/auto-pairs'
"let g:AutoPairsFlyMode = 1
" }
" { " {
Plug 'mg979/vim-visual-multi' Plug 'jiangmiao/auto-pairs'
"let g:AutoPairsFlyMode = 1
" } " }
"if has('nvim') && str2float(g:nvim_version) >= 0.5 Plug 'mg979/vim-visual-multi'
" Plug 'nvim-lualine/lualine.nvim'
"else
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' 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 'bling/vim-bufferline'
Plug 'easymotion/vim-easymotion' Plug 'easymotion/vim-easymotion'
Plug 'nathanaelkane/vim-indent-guides' Plug 'nathanaelkane/vim-indent-guides'
@@ -75,31 +60,39 @@
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
endif endif
" nvim support only theme
" {
"Plug 'projekt0n/github-nvim-theme'
" }
" vim theme " vim theme
" { " {
Plug 'danilo-augusto/vim-afterglow'
Plug 'NLKNguyen/papercolor-theme' 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 if g:vim_type == 'nvim' && g:vim_version > 0.5
Plug 'xiyaowong/nvim-transparent' Plug 'xiyaowong/nvim-transparent'
endif endif
Plug 'EdenEast/nightfox.nvim' Plug 'EdenEast/nightfox.nvim'
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
call plug#end() call plug#end()
" Helper functions
" {
" }
" Plugin Preferences " Plugin Preferences
" { " {
" godlygeek/tabular {
if isdirectory(expand(plugin_dir . "/tabular"))
nmap <leader>t= :Tabularize /=<CR>
vmap <leader>t= :Tabularize /=<CR>
nmap <leader>t\| :Tab /\|<CR>
vmap <leader>t\| :Tab /\|<CR>
nmap <leader>t: :Tab /:\zs<CR>
vmap <leader>t: :Tab /:\zs<CR>
endif
" }
" xiyaowong/nvim-transparent { " xiyaowong/nvim-transparent {
" } " }
@@ -113,17 +106,17 @@
"let NERDTreeShowBookmarks=1 "let NERDTreeShowBookmarks=1
"let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$'] "let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
let NERDTreeChDirMode=0 let NERDTreeChDirMode = 0
let NERDTreeQuitOnOpen=1 let NERDTreeQuitOnOpen = 1
let NERDTreeMouseMode=2 let NERDTreeMouseMode = 2
let NERDTreeShowHidden=1 let NERDTreeShowHidden = 1
let NERDTreeKeepTreeInNewTab=1 let NERDTreeKeepTreeInNewTab = 1
endif endif
" } " }
" indent_guides { " indent_guides {
if isdirectory(expand(plugin_dir . "/vim-indent-guides/")) if isdirectory(expand(plugin_dir . "/vim-indent-guides/"))
let g:indent_guides_start_level = 2 let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1 let g:indent_guides_guide_size = 1
let g:indent_guides_enable_on_vim_startup = 0 let g:indent_guides_enable_on_vim_startup = 0
map <leader>i :IndentGuidesToggle<CR> map <leader>i :IndentGuidesToggle<CR>
@@ -137,10 +130,10 @@
" vim-airline { " vim-airline {
" Set configuration options for the statusline plugin vim-airline. " Set configuration options for the statusline plugin vim-airline.
" Use the powerline theme and optionally enable powerline symbols. " Use the powerline theme and optionally enable powerline symbols.
let g:airline_section_b = '' let g:airline_section_b = ''
let g:airline_section_z = '' let g:airline_section_z = ''
let g:airline_section_y = '' let g:airline_section_y = ''
let g:airline_section_x = '' let g:airline_section_x = ''
let g:airline_section_warning = '' let g:airline_section_warning = ''
"let g:airline#extensions#tabline#left_sep = '' "let g:airline#extensions#tabline#left_sep = ''
"let g:airline#extensions#tabline#left_alt_sep = '|' "let g:airline#extensions#tabline#left_alt_sep = '|'
@@ -164,11 +157,8 @@
" coc-tsserver: javascript " coc-tsserver: javascript
" coc-pyright: python " coc-pyright: python
" coc-clangd: c/c++, may need to install clangd seperatly " 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 <silent><nowait> <space>d :call CocAction('jumpDefinition', v: false)<CR>
"nnoremap <silent><nowait> <space>r :call CocAction('jumpReferences', v: false)<CR>
if filereadable(expand(config_dir . "/.exp-coc-config")) if filereadable(expand(config_dir . "/.exp-coc-config"))
exec "source " . config_dir . "/.exp-coc-config" exec "source " . config_dir . "/.exp-coc-config"
endif endif
@@ -214,7 +204,13 @@
if g:vim_type == 'nvim' && g:vim_version > 0.5 if g:vim_type == 'nvim' && g:vim_version > 0.5
:TransparentEnable :TransparentEnable
elseif g:theme_color == 'dark' 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) execute("colorscheme " . g:dark_theme)
elseif g:theme_color == 'light' elseif g:theme_color == 'light'
let g:PaperColor_Theme_Options = { let g:PaperColor_Theme_Options = {
@@ -232,7 +228,13 @@
if g:vim_type == 'nvim' && g:vim_version > 0.5 if g:vim_type == 'nvim' && g:vim_version > 0.5
:TransparentDisable :TransparentDisable
elseif g:theme_color == 'dark' 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) execute("colorscheme " . g:dark_theme)
elseif g:theme_color == 'light' elseif g:theme_color == 'light'
let g:PaperColor_Theme_Options = { let g:PaperColor_Theme_Options = {
@@ -276,20 +278,18 @@
" let g:dark_theme = 'github_dark' " let g:dark_theme = 'github_dark'
" let g:light_theme = 'github_light' " let g:light_theme = 'github_light'
if isdirectory(expand(plugin_dir . "/nightfox.nvim")) && has('nvim') && g:vim_version >= 0.5 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:dark_theme = 'Nordfox' let g:light_theme = 'dawnfox'
let g:light_theme = 'Dayfox' let g:dark_theme = 'nightfox'
let g:airline_dark_theme = "hybrid"
" } " }
" { " {
" vim theme " vim theme
elseif isdirectory(expand(plugin_dir . "/vim-afterglow")) elseif isdirectory(expand(plugin_dir . "/papercolor-theme"))
if isdirectory(expand(plugin_dir . "/papercolor-theme")) " improve coc color in this theme
let g:light_theme = 'PaperColor' let g:light_theme = 'PaperColor'
endif let g:dark_theme = 'PaperColor'
"let g:afterglow_inherit_background=1
let g:dark_theme = 'afterglow'
endif endif
" } " }
+1 -1
View File
@@ -18,7 +18,7 @@ success() {
msg "\33[32m[✔]\33[0m ${1}${2}" msg "\33[32m[✔]\33[0m ${1}${2}"
} }
function fatal_error() { fatal_error() {
msg "\33[31m[✘]\33[0m ${1}${2}" msg "\33[31m[✘]\33[0m ${1}${2}"
exit 1 exit 1
} }