" General { let maplocalleader="\" " Fix the color problem in tmux when we set termguicolors let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" set background=dark set t_Co=256 set termguicolors " Make terminal color more gorgeous set nu " Enable line number set mouse=a " Enable mouse set textwidth=80 " set textwidth " Doxygen syntax highlighting for c family au BufNewFile,BufReadPost *.c,*.h setlocal syntax=c.doxygen " } " Vim UI {" colorscheme gruvbox set list set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespaces set colorcolumn=80 " } " Formatting { set nowrap " Do not wrap long lines set autoindent " Indent at the same level of the previous line set shiftwidth=2 " Use indents of 4 spaces set expandtab " Tabs are spaces, not tabs set tabstop=2 " An indentation every four columns set softtabstop=2 " Let backspace delete indent set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) set pastetoggle= " pastetoggle (same indentation on pastes) " } " Key (re)Mapping { " Unmap mappings { silent! nunmap w silent! unmap silent! unmap pp silent! unmap silent! unmap silent! unmap silent! unmap silent! unmap silent! unmap silent! unmap silent! unmap 0 " } " Mapping "fast" keycodes { " See https://vim.fandom.com/wiki/Mapping_fast_keycodes_in_terminal_Vim " Set vim keycodes to terminal keycodes set =[1~ =[4~ = set = = = = set = = = = set = set =[17;2~ " Mapping "fast" keycodes map map map map map! map! map! map! " } " Mapping { " Easier turning off highlighting nmap ; :noh " Change Working Directory to that of the current file cmap cwd lcd %:p:h cmap cd. lcd %:p:h nmap cd :cd %:p:h:pwd " Open scratch nmap q :e ~/buffer " Spell toggle nmap ss :setlocal spell! " Easier moving between misspelled words nmap sn ]s nmap sp [s " Open QuickFix list for the result of Ack nmap cb :botright cope " Open a new tab and copy the result of Ack to a new buffer nmap co ggVGy:tabnew:set syntax=qfpgg " Easier moving between search results nmap :cn nmap :cp " Close QuickFix list nmap cc :cclose " Easier moving between Ycm Errors and Warnings nmap :lnext nmap :lprevious " Close Location list nmap lc :lclose " Easier replacing selections vnoremap r :call VisualSelection('replace','') " Easier swapping lines nnoremap :m .+1== nnoremap :m .-2== inoremap :m .+1==gi inoremap :m .-2==gi vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " Yank selection to system clipboard vmap yk :write !clip.exe imap snipMateTrigger " Code folding options nmap f0 :set foldlevel=0 nmap f1 :set foldlevel=1 nmap f2 :set foldlevel=2 nmap f3 :set foldlevel=3 nmap f4 :set foldlevel=4 nmap f5 :set foldlevel=5 nmap f6 :set foldlevel=6 nmap f7 :set foldlevel=7 nmap f8 :set foldlevel=8 nmap f9 :set foldlevel=9 " Insert newline without entering insert mode nmap o " Map ctrl x ctrl o to ctrl space inoremap inoremap " } " } " Plugins { " Ack { " Easier using Ack nmap a :Ack " } " ALE { let g:ale_enabled = 0 " Disable ale " } " BufExplorer { " Easier browing buffers nmap :ToggleBufExplorer "} " Clang-format { " Set up code style & auto formatting let g:clang_format#code_style = "mozilla" " let g:clang_format#auto_format = 1 " } " CtrlP { " Easier browsing symbols nmap :CtrlPTag "} " DoxygenToolkit { let g:DoxygenToolkit_authorName = "Revc Ra" " Easier generating documents map da :DoxAuthor map df :Dox " Disble auto-pair map db :setlocal paste:DoxBlock:setlocal nopastea map dl :DoxLic " } " EasyAlign { " Define user operator for EasyAlign nmap ga (EasyAlign) xmap ga (EasyAlign) " } " Git-Gutter { " If you don't want vim-gitgutter to set up any mappings at all, use this: let g:gitgutter_map_keys = 0 map ht :GitGutterToggle map hP :GitGutterPreview map hn :GitGutterNextHunk map hp :GitGutterPrevHunk map hs :GitGutterStageHunk map hu :GitGutterUndoHunk " } " NERDTree { " NERT tree show from left let g:NERDTreeWinPos = "left" nmap :NERDTreeToggle " } " Rainbow { "set to 0 if you want to enable it later via :RainbowToggle let g:rainbow_active = 1 " } " Tagbar { nmap t :TagbarToggle " } " Which Key { nnoremap :WhichKey '' nnoremap :WhichKey '\' " } " Verdin { let g:verdin#autocomplete = 0 let g:verdin#cooperativemode = 1 " } " Yank Stack { " Enable cycling through your history of yanks nmap p yankstack_substitute_older_paste nmap P yankstack_substitute_newer_paste " } " YCM { set completeopt-=preview " Don't show preview window let g:ycm_always_populate_location_list = 1 " Enable using lnext & lprev to navigate errors let g:ycm_confirm_extra_conf = 0 " Turn off question " IDE functions provided by Ycm nmap :YcmCompleter RefactorRename map mf :ClangFormat map mm :YcmCompleter FixIt map mt :YcmCompleter GetType map mg :YcmCompleter GoTo " } " }