├── .gitignore ├── README.md ├── coc-settings.json ├── ginit.vim ├── init.vim └── settings ├── airline.vim ├── coc.vim ├── floaterm.vim ├── fzf.vim ├── git.vim ├── nerdcommenter.vim ├── nerdtree.vim ├── vimspector.vim └── vista.vim /.gitignore: -------------------------------------------------------------------------------- 1 | plugged/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vim Config by Vu Nguyen Coder 2 | 3 | [Note] 4 | - Can run on both Window and Linux 5 | - Run command :PlugInstall after pulling this resource 6 | 7 | [Requirement] 8 | - NodeJS 9 | - Python 10 | - Git 11 | - vim-plug 12 | - bat 13 | -------------------------------------------------------------------------------- /coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "coc.source.file.shortcut": "File", 3 | "coc.source.around.shortcut": "?", 4 | //"suggest.disableKind": true, 5 | "suggest.completionItemKindLabels": { 6 | "keyword": "\uf1de", 7 | "variable": "\ue79b", 8 | "value": "\uf89f", 9 | "operator": "\u03a8", 10 | "constructor": "\uf0ad", 11 | "function": "\u0192", 12 | "reference": "\ufa46", 13 | "constant": "\uf8fe", 14 | "method": "\uf09a", 15 | "struct": "\ufb44", 16 | "class": "\uf0e8", 17 | "interface": "\uf417", 18 | "text": "\ue612", 19 | "enum": "\uf435", 20 | "enumMember": "\uf02b", 21 | "module": "\uf40d", 22 | "color": "\ue22b", 23 | "property": "\ue624", 24 | "field": "\uf9be", 25 | "unit": "\uf475", 26 | "event": "\ufacd", 27 | "file": "\uf723", 28 | "folder": "\uf114", 29 | "snippet": "\ue60b", 30 | "typeParameter": "\uf728", 31 | "default": "\uf29c" 32 | }, 33 | "jedi": { 34 | "enable": true, 35 | "startupMessage": true, 36 | "executable.command": "jedi-language-server", 37 | 38 | }, 39 | "languageserver": { 40 | // C++ 41 | "ccls": { 42 | "command": "ccls", 43 | "filetypes": ["c", "cpp", "cuda", "objc", "objcpp"], 44 | "rootPatterns": [".ccls", "compile_commands.json"], 45 | "initializationOptions": { 46 | "cache": { 47 | "directory": ".ccls-cache", 48 | "format": "binary" 49 | }, 50 | "client": { 51 | "snippetSupport": true 52 | }, 53 | "index": { 54 | "onChange": true 55 | }, 56 | "highlight": { 57 | "lsRanges": true 58 | } 59 | } 60 | }, 61 | "cmake": { 62 | "command": "cmake-language-server", 63 | "filetypes": ["cmake"], 64 | "rootPatterns": [ 65 | "build/" 66 | ], 67 | "initializationOptions": { 68 | "buildDirectory": "build" 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /ginit.vim: -------------------------------------------------------------------------------- 1 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 2 | " => Settings for neovim-qt 3 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 4 | " Disable qt popup 5 | GuiPopupmenu 0 6 | 7 | " Enable line 8 | GuiLinespace 1 9 | 10 | " Disable qt tab line 11 | GuiTabline 0 12 | 13 | " Set format of tab name 14 | set guitablabel=\[%N\]\ %t\ %M 15 | 16 | " Set font 17 | set guifont=DejaVuSansM\ Nerd\ Font\ Mono 18 | 19 | " Set key map to paste 20 | inoremap + 21 | -------------------------------------------------------------------------------- /init.vim: -------------------------------------------------------------------------------- 1 | " _ ____ __ _ _________ ___ _______ __ _________ ___ _______ 2 | " | | / / / / / / |/ / ___/ / / \ \/ / __/ |/ / / ___/ __ \/ _ \/ __/ _ \ 3 | " | |/ / /_/ / / / (_ / /_/ / \ / _// / / /__/ /_/ / // / _// , _/ 4 | " |___/\____/ /_/|_/\___/\____/ /_/___/_/|_/ \___/\____/____/___/_/|_| 5 | " Vim customized by Vu Nguyen Coder 6 | " (See my detailed tutorial here: https://youtu.be/Tp8i1EHsQ1Q ) 7 | " 8 | " http://youtube.com/VuNguyenCoder 9 | " http://facebook.com/VuNguyenCoder 10 | 11 | lua print('Neovim started...') 12 | 13 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 14 | " => General settings 15 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 16 | set mouse=a " Enable mouse 17 | set expandtab " Tab setting 18 | set tabstop=4 " Tab setting 19 | set shiftwidth=4 " Tab setting 20 | set listchars=tab:\¦\ " Tab charactor 21 | set list 22 | set foldmethod=syntax 23 | set foldnestmax=1 24 | set foldlevelstart=3 " 25 | set number " Show line number 26 | set ignorecase " Enable case-sensitive 27 | 28 | " Disable backup 29 | set nobackup 30 | set nowb 31 | set noswapfile 32 | 33 | " Optimize 34 | set synmaxcol=3000 "Prevent breaking syntax hightlight when string too long. Max = 3000" 35 | set lazyredraw 36 | au! BufNewFile,BufRead *.json set foldmethod=indent " Change foldmethod for specific filetype 37 | 38 | syntax on 39 | 40 | " Enable copying from vim to clipboard 41 | if has('win32') 42 | set clipboard=unnamed 43 | else 44 | set clipboard=unnamedplus 45 | endif 46 | 47 | " Auto reload content changed outside 48 | au CursorHold,CursorHoldI * checktime 49 | au FocusGained,BufEnter * :checktime 50 | autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * 51 | \ if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' 52 | \ | checktime 53 | \ | endif 54 | autocmd FileChangedShellPost * 55 | \ echohl WarningMsg 56 | \ | echo "File changed on disk. Buffer reloaded." 57 | \ | echohl None 58 | 59 | 60 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 61 | " => Key mappings 62 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 63 | " Resize pane 64 | nmap :vertical resize +1 65 | nmap :vertical resize -1 66 | nmap :resize +1 67 | nmap :resize -1 68 | 69 | " Search a hightlighted text 70 | vnoremap // y/\V=escape(@",'/\') 71 | nmap /\ :noh 72 | 73 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 74 | " => Plugin list 75 | " (used with Vim-plug - https://github.com/junegunn/vim-plug) 76 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 77 | call plug#begin(stdpath('config').'/plugged') 78 | " Theme 79 | Plug 'joshdick/onedark.vim', " Dark theme 80 | Plug 'akinsho/bufferline.nvim', { 'tag': '*' } 81 | 82 | " File browser 83 | Plug 'preservim/nerdTree' " File browser 84 | Plug 'Xuyuanp/nerdtree-git-plugin' " Git status 85 | Plug 'ryanoasis/vim-devicons' " Icon 86 | Plug 'unkiwii/vim-nerdtree-sync' " Sync current file 87 | Plug 'jcharum/vim-nerdtree-syntax-highlight', 88 | \ {'branch': 'escape-keys'} 89 | 90 | " File search 91 | Plug 'junegunn/fzf', 92 | \ { 'do': { -> fzf#install() } } " Fuzzy finder 93 | Plug 'junegunn/fzf.vim' 94 | 95 | " Status bar 96 | Plug 'vim-airline/vim-airline' 97 | Plug 'vim-airline/vim-airline-themes' 98 | 99 | " Terminal 100 | Plug 'voldikss/vim-floaterm' " Float terminal 101 | 102 | " Code intellisense 103 | Plug 'neoclide/coc.nvim', 104 | \ {'branch': 'release'} " Language server protocol (LSP) 105 | Plug 'jiangmiao/auto-pairs' " Parenthesis auto 106 | Plug 'mattn/emmet-vim' 107 | Plug 'preservim/nerdcommenter' " Comment code 108 | " Plug 'liuchengxu/vista.vim' " Function tag bar 109 | Plug 'alvan/vim-closetag' " Auto close HTML/XML tag 110 | \ { 111 | \ 'do': 'yarn install ' 112 | \ .'--frozen-lockfile ' 113 | \ .'&& yarn build', 114 | \ 'branch': 'main' 115 | \ } 116 | 117 | " Code syntax highlight 118 | " Plug 'yuezk/vim-js' " Javascript 119 | " Plug 'MaxMEllon/vim-jsx-pretty' " JSX/React 120 | " Plug 'jackguo380/vim-lsp-cxx-highlight' " C/C++ 121 | " Plug 'uiiaoo/java-syntax.vim' " Java 122 | Plug 'sheerun/vim-polyglot' 123 | 124 | " Debugging 125 | Plug 'puremourning/vimspector' " Vimspector 126 | 127 | " Source code version control 128 | Plug 'tpope/vim-fugitive' " Git infomation 129 | Plug 'tpope/vim-rhubarb' 130 | Plug 'airblade/vim-gitgutter' " Git show changes 131 | Plug 'samoshkin/vim-mergetool' " Git merge 132 | 133 | " Fold 134 | Plug 'tmhedberg/SimpylFold' 135 | call plug#end() 136 | 137 | 138 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 139 | " => Plugin Setting 140 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 141 | " Set theme 142 | colorscheme onedark 143 | 144 | set termguicolors 145 | autocmd VimEnter * call s:setup_lualine() 146 | function! s:setup_lualine() abort 147 | lua< "hy:%s/h//gc 173 | 174 | " Close buffer without exitting vim 175 | nnoremap bd :bp \| sp \| bn \| bd 176 | 177 | " Other setting 178 | for setting_file in split(glob(stdpath('config').'/settings/*.vim')) 179 | execute 'source' setting_file 180 | endfor 181 | 182 | -------------------------------------------------------------------------------- /settings/airline.vim: -------------------------------------------------------------------------------- 1 | let g:airline_powerline_fonts = 1 " Enable font for status bar 2 | let g:airline_theme='onedark' " Theme OneDark 3 | 4 | let g:airline#extensions#tabline#enabled = 1 " Enable Tab bar 5 | let g:airline#extensions#tabline#left_sep = ' ' " Enable Tab seperator 6 | let g:airline#extensions#tabline#left_alt_sep = '|' " Enable Tab seperator 7 | let g:airline#extensions#tabline#formatter = 'default' 8 | let g:airline#extensions#tabline#fnamemod = ':t' " Set Tab name as file name 9 | 10 | let g:airline#extensions#whitespace#enabled = 0 " Remove warning whitespace" 11 | 12 | let g:airline_section_error='' 13 | -------------------------------------------------------------------------------- /settings/coc.vim: -------------------------------------------------------------------------------- 1 | " Extensions need to be installed at first startup 2 | let g:coc_global_extensions = [ 3 | \'coc-css', 4 | \'coc-html', 5 | \'coc-json', 6 | \'coc-jedi', 7 | \'coc-vimlsp', 8 | \] 9 | 10 | " May need for Vim (not Neovim) since coc.nvim calculates byte offset by count 11 | " utf-8 byte sequence 12 | set encoding=utf-8 13 | " Some servers have issues with backup files, see #649 14 | set nobackup 15 | set nowritebackup 16 | 17 | " Having longer updatetime (default is 4000 ms = 4s) leads to noticeable 18 | " delays and poor user experience 19 | set updatetime=300 20 | 21 | " Always show the signcolumn, otherwise it would shift the text each time 22 | " diagnostics appear/become resolved 23 | set signcolumn=yes 24 | 25 | " Use tab for trigger completion with characters ahead and navigate 26 | " NOTE: There's always complete item selected by default, you may want to enable 27 | " no select by `"suggest.noselect": true` in your configuration file 28 | " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by 29 | " other plugin before putting this into your config 30 | inoremap 31 | \ coc#pum#visible() ? coc#pum#next(1) : 32 | \ CheckBackspace() ? "\" : 33 | \ coc#refresh() 34 | inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" 35 | 36 | " Make to accept selected completion item or notify coc.nvim to format 37 | " u breaks current undo, please make your own choice 38 | inoremap coc#pum#visible() ? coc#pum#confirm() 39 | \: "\u\\=coc#on_enter()\" 40 | 41 | function! CheckBackspace() abort 42 | let col = col('.') - 1 43 | return !col || getline('.')[col - 1] =~# '\s' 44 | endfunction 45 | 46 | " Use to trigger completion 47 | if has('nvim') 48 | inoremap coc#refresh() 49 | else 50 | inoremap coc#refresh() 51 | endif 52 | 53 | " Use `[g` and `]g` to navigate diagnostics 54 | " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list 55 | nmap [g (coc-diagnostic-prev) 56 | nmap ]g (coc-diagnostic-next) 57 | 58 | " GoTo code navigation 59 | nmap gd (coc-definition) 60 | nmap gy (coc-type-definition) 61 | nmap gi (coc-implementation) 62 | nmap gr (coc-references) 63 | 64 | " Use K to show documentation in preview window 65 | nnoremap K :call ShowDocumentation() 66 | 67 | function! ShowDocumentation() 68 | if CocAction('hasProvider', 'hover') 69 | call CocActionAsync('doHover') 70 | else 71 | call feedkeys('K', 'in') 72 | endif 73 | endfunction 74 | 75 | " Highlight the symbol and its references when holding the cursor 76 | autocmd CursorHold * silent call CocActionAsync('highlight') 77 | 78 | " Symbol renaming 79 | nmap rn (coc-rename) 80 | 81 | " Formatting selected code 82 | xmap f (coc-format-selected) 83 | nmap f (coc-format-selected) 84 | 85 | augroup mygroup 86 | autocmd! 87 | " Setup formatexpr specified filetype(s) 88 | autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') 89 | " Update signature help on jump placeholder 90 | autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') 91 | augroup end 92 | 93 | " Applying code actions to the selected code block 94 | " Example: `aap` for current paragraph 95 | xmap a (coc-codeaction-selected) 96 | nmap a (coc-codeaction-selected) 97 | 98 | " Remap keys for applying code actions at the cursor position 99 | nmap ac (coc-codeaction-cursor) 100 | " Remap keys for apply code actions affect whole buffer 101 | nmap as (coc-codeaction-source) 102 | " Apply the most preferred quickfix action to fix diagnostic on the current line 103 | nmap qf (coc-fix-current) 104 | 105 | " Remap keys for applying refactor code actions 106 | nmap re (coc-codeaction-refactor) 107 | xmap r (coc-codeaction-refactor-selected) 108 | nmap r (coc-codeaction-refactor-selected) 109 | 110 | " Run the Code Lens action on the current line 111 | nmap cl (coc-codelens-action) 112 | 113 | " Map function and class text objects 114 | " NOTE: Requires 'textDocument.documentSymbol' support from the language server 115 | xmap if (coc-funcobj-i) 116 | omap if (coc-funcobj-i) 117 | xmap af (coc-funcobj-a) 118 | omap af (coc-funcobj-a) 119 | xmap ic (coc-classobj-i) 120 | omap ic (coc-classobj-i) 121 | xmap ac (coc-classobj-a) 122 | omap ac (coc-classobj-a) 123 | 124 | " Remap and to scroll float windows/popups 125 | if has('nvim-0.4.0') || has('patch-8.2.0750') 126 | nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" 127 | nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" 128 | inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" 129 | inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" 130 | vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" 131 | vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" 132 | endif 133 | 134 | " Use CTRL-S for selections ranges 135 | " Requires 'textDocument/selectionRange' support of language server 136 | nmap (coc-range-select) 137 | xmap (coc-range-select) 138 | 139 | " Add `:Format` command to format current buffer 140 | command! -nargs=0 Format :call CocActionAsync('format') 141 | 142 | " Add `:Fold` command to fold current buffer 143 | command! -nargs=? Fold :call CocAction('fold', ) 144 | 145 | " Add `:OR` command for organize imports of the current buffer 146 | command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') 147 | 148 | " Add (Neo)Vim's native statusline support 149 | " NOTE: Please see `:h coc-status` for integrations with external plugins that 150 | " provide custom statusline: lightline.vim, vim-airline 151 | set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} 152 | 153 | " Mappings for CoCList 154 | " Show all diagnostics 155 | nnoremap a :CocList diagnostics 156 | " Manage extensions 157 | nnoremap e :CocList extensions 158 | " Show commands 159 | nnoremap c :CocList commands 160 | " Find symbol of current document 161 | nnoremap o :CocList outline 162 | " Search workspace symbols 163 | nnoremap s :CocList -I symbols 164 | " Do default action for next item 165 | nnoremap j :CocNext 166 | " Do default action for previous item 167 | nnoremap k :CocPrev 168 | " Resume latest coc list 169 | nnoremap p :CocListResume 170 | -------------------------------------------------------------------------------- /settings/floaterm.vim: -------------------------------------------------------------------------------- 1 | let g:floaterm_position = 'topright' 2 | let g:floaterm_width = 0.6 3 | let g:floaterm_height = 0.8 4 | let g:floaterm_title = 'Terminal $1/$2' 5 | let g:floaterm_wintype = 'float' 6 | let g:floaterm_rootmarkers = ['.pro'] 7 | if has('win32') 8 | let g:floaterm_shell = 'powershell -nologo' 9 | endif 10 | 11 | " Set color 12 | hi Floaterm guibg=Grey15 13 | hi FloatermBorder guifg=Orange guibg=DarkGreen 14 | "hi FloatermNC guibg=darkred 15 | 16 | autocmd User FloatermOpen " triggered after opening a new/existed floater 17 | 18 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 19 | " => Hotkey to manage terminals 20 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 21 | " Open a new terminal 22 | nnoremap to :FloatermNew 23 | tnoremap to :FloatermNew 24 | 25 | " Kill current terminal 26 | nnoremap tk :FloatermKill:FloatermPrev 27 | tnoremap tk :FloatermKill:FloatermPrev 28 | 29 | " Navigation next and previous terminal 30 | nnoremap tn :FloatermNext 31 | tnoremap tn :FloatermNext 32 | nnoremap tp :FloatermPrev 33 | tnoremap tp :FloatermPrev 34 | 35 | " Toggle terminal 36 | nnoremap tt :FloatermToggle 37 | tnoremap tt :FloatermToggle 38 | 39 | " Focus terminal 40 | nnoremap tf 41 | tnoremap tf 42 | 43 | 44 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 45 | " => Hotkey to run other console apps 46 | """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 47 | " Git 48 | nnoremap gl :FloatermNew! --position=bottomright --height=0.95 --width=0.7 --title='GitLog' git lg 49 | -------------------------------------------------------------------------------- /settings/fzf.vim: -------------------------------------------------------------------------------- 1 | " This is the default extra key bindings 2 | let g:fzf_action = { 3 | \ 'ctrl-t': 'tab split', 4 | \ 'ctrl-x': 'split', 5 | \ 'ctrl-v': 'vsplit' } 6 | 7 | let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.5, 'highlight': 'Comment' } } 8 | let g:fzf_preview_window = ['right:50%', 'ctrl-/'] 9 | let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' 10 | 11 | hi! fzf_fg ctermfg=14 12 | hi! fzf_fgp ctermfg=3 13 | hi! fzf_hl ctermfg=5 14 | hi! fzf_hlp ctermfg=5 15 | hi! fzf_info ctermfg=6 16 | hi! fzf_prompt ctermfg=6 17 | hi! fzf_spinner ctermfg=6 18 | hi! fzf_pointer ctermfg=3 19 | let g:fzf_colors = { 20 | \ 'fg': ['fg', 'fzf_fg'], 21 | \ 'hl': ['fg', 'fzf_hl'], 22 | \ 'fg+': ['fg', 'fzf_fgp'], 23 | \ 'hl+': ['fg', 'fzf_hlp'], 24 | \ 'info': ['fg', 'fzf_info'], 25 | \ 'prompt': ['fg', 'fzf_prompt'], 26 | \ 'pointer': ['fg', 'fzf_pointer'], 27 | \ 'spinner': ['fg', 'fzf_spinner'] } 28 | 29 | " :Files 30 | "command! -bang -nargs=? -complete=dir Files 31 | " \ call fzf#vim#files(, {'options': ['--layout=reverse', '--info=inline', '--preview', 'bat --color=always --theme=TwoDark --style=header,numbers,snip --line-range :300 {}']}, 0) 32 | command! -bang -nargs=? -complete=dir Files 33 | \ call fzf#vim#files(, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), 0) 34 | map :Files 35 | 36 | " :Rg 37 | command! -bang -nargs=* Rg 38 | \ call fzf#vim#grep( 39 | \ 'rg --column --line-number --color=always --smart-case -- '.shellescape(), 1, {'options': ['--exact', '--layout=reverse']}, 0) 40 | map :Rg 41 | 42 | " Ignore some file 43 | let $FZF_DEFAULT_COMMAND='find . \( -name __pycache__ -o -name .git -name .vagrant \) -prune -o -print' 44 | -------------------------------------------------------------------------------- /settings/git.vim: -------------------------------------------------------------------------------- 1 | "Git merge 2 | let g:mergetool_layout = 'mr' 3 | let g:mergetool_prefer_revision = 'local' 4 | nmap mt (MergetoolToggle) 5 | 6 | "Git gutter 7 | let g:gitgutter_sign_added = '✚' 8 | let g:gitgutter_sign_modified = '✹' 9 | let g:gitgutter_sign_removed = '✖' 10 | "let g:gitgutter_sign_removed_first_line = '^' 11 | "let g:gitgutter_sign_modified_removed = '<' 12 | 13 | let g:gitgutter_preview_win_floating = 1 14 | -------------------------------------------------------------------------------- /settings/nerdcommenter.vim: -------------------------------------------------------------------------------- 1 | " Create default mappings 2 | let g:NERDCreateDefaultMappings = 1 3 | 4 | " Add spaces after comment delimiters by default 5 | let g:NERDSpaceDelims = 1 6 | 7 | " Use compact syntax for prettified multi-line comments 8 | let g:NERDCompactSexyComs = 1 9 | 10 | " Align line-wise comment delimiters flush left instead of following code indentation 11 | let g:NERDDefaultAlign = 'left' 12 | 13 | " Set a language to use its alternate delimiters by default 14 | let g:NERDAltDelims_java = 1 15 | 16 | " Add your own custom formats or override the defaults 17 | let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } 18 | 19 | " Allow commenting and inverting empty lines (useful when commenting a region) 20 | let g:NERDCommentEmptyLines = 1 21 | 22 | " Enable trimming of trailing whitespace when uncommenting 23 | let g:NERDTrimTrailingWhitespace = 1 24 | 25 | " Enable NERDCommenterToggle to check all selected lines is commented or not 26 | let g:NERDToggleCheckAllLines = 1 27 | -------------------------------------------------------------------------------- /settings/nerdtree.vim: -------------------------------------------------------------------------------- 1 | " F5 to toggle 2 | map :NERDTreeToggle 3 | 4 | " Open the existing NERDTree on each new tab. 5 | "autocmd BufWinEnter * silent NERDTreeMirror 6 | 7 | " Exit Vim if NERDTree is the only window left. 8 | autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif 9 | 10 | " Change arrow to expand/collapse tree 11 | let g:NERDTreeDirArrowExpandable = '▸' 12 | let g:NERDTreeDirArrowCollapsible = '▾' 13 | 14 | "let NERDTreeMapOpenInTab='' 15 | 16 | " Git status icon 17 | let g:NERDTreeGitStatusIndicatorMapCustom = { 18 | \ 'Modified' :'✹', 19 | \ 'Staged' :'✚', 20 | \ 'Untracked' :'✭', 21 | \ 'Renamed' :'➜', 22 | \ 'Unmerged' :'═', 23 | \ 'Deleted' :'✖', 24 | \ 'Dirty' :'✗', 25 | \ 'Ignored' :'☒', 26 | \ 'Clean' :'✔︎', 27 | \ 'Unknown' :'?', 28 | \ } 29 | 30 | " Hightlight current file 31 | let g:nerdtree_sync_cursorline = 1 32 | 33 | " If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. 34 | autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | 35 | \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif 36 | 37 | " Start NERDTree when Vim starts with a directory argument. 38 | " autocmd StdinReadPre * let s:std_in=1 39 | " autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') | 40 | " \ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif 41 | 42 | " auto open a nerdtree buffer on open. 43 | " autocmd vimenter * if !argc() | NERDTree | endif 44 | 45 | " autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif 46 | 47 | " Open file, then sync directory that contains that file 48 | if has('win32') 49 | autocmd BufEnter * lcd %:p:h 50 | endif 51 | 52 | " Ignore some type of files: 53 | let NERDTreeIgnore=['__pycache__', 'site-packages'] 54 | -------------------------------------------------------------------------------- /settings/vimspector.vim: -------------------------------------------------------------------------------- 1 | nnoremap dl :call vimspector#Launch() 2 | nnoremap ds :call vimspector#Reset() 3 | nnoremap dc :call vimspector#Continue() 4 | 5 | nnoremap dt :call vimspector#ToggleBreakpoint() 6 | nnoremap dT :call vimspector#ClearBreakpoints() 7 | 8 | nmap dr VimspectorRestart 9 | nmap de VimspectorStepOut 10 | nmap di VimspectorStepInto 11 | nmap do VimspectorStepOver 12 | -------------------------------------------------------------------------------- /settings/vista.vim: -------------------------------------------------------------------------------- 1 | " " Show the nearest function name in status bar 2 | " function! NearestMethodOrFunction() abort 3 | " return get(b:, 'vista_nearest_method_or_function', '') 4 | " endfunction 5 | " set statusline+=%{NearestMethodOrFunction()} 6 | " 7 | " " By default vista.vim never run if you don't call it explicitly. 8 | " " 9 | " " If you want to show the nearest function in your statusline automatically, 10 | " " you can add the following line to your vimrc 11 | " autocmd VimEnter * call vista#RunForNearestMethodOrFunction() 12 | " 13 | " " How each level is indented and what to prepend. 14 | " " This could make the display more compact or more spacious. 15 | " " e.g., more compact: ["▸ ", ""] 16 | " " Note: this option only works for the kind renderer, not the tree renderer. 17 | " let g:vista_icon_indent = ["╰─▸ ", "├─▸ "] 18 | " 19 | " " To enable fzf's preview window set g:vista_fzf_preview. 20 | " " The elements of g:vista_fzf_preview will be passed as arguments to fzf#vim#with_preview() 21 | " " For example: 22 | " let g:vista_fzf_preview = ['right:50%'] 23 | " 24 | " " Ensure you have installed some decent font to show these pretty symbols, then you can enable icon for the kind. 25 | " let g:vista#renderer#enable_icon = 1 26 | " 27 | " " The default icons can't be suitable for all the filetypes, you can extend it as you wish. 28 | " let g:vista#renderer#icons = { 29 | " \ "function": "\uf794", 30 | " \ "variable": "\uf71b", 31 | " \ } 32 | --------------------------------------------------------------------------------