" ----------------------------------------------------------------------------- " Last Modification Date: 2014.12.23 " ----------------------------------------------------------------------------- " ------------------ Generic ------------------------------------------------- " ---------------------------------------------------------------------------- syntax on colorscheme ir_black_dragon match ErrorMsg /\s\+$/ set ts=4 sts=4 sw=4 expandtab set smarttab set autoindent set number set encoding=utf-8 set cursorline set laststatus=2 set incsearch set listchars=tab:▸\ ,eol:¬ set hidden set ignorecase set modeline " If the root is using this vimrc, change colorscheme for safety. if $USER == "root" colorscheme default highlight LineNr ctermfg=red set backupdir=/tmp endif " ---------------------------------------------------------------------------- " ------------------ Plugins ------------------------------------------------- " ---------------------------------------------------------------------------- " Plugins with Vundle -> https://github.com/gmarik/Vundle.vim set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'gmarik/vundle' Plugin 'scrooloose/nerdtree' Plugin 'majutsushi/tagbar' Plugin 'tpope/vim-fugitive' Plugin 'bling/vim-airline' Plugin 'tmux-plugins/vim-tmux' Plugin 'rdnetto/YCM-Generator' Plugin 'Valloric/YouCompleteMe' Plugin 'jeaye/color_coded' Plugin 'easymotion/vim-easymotion' Plugin 'beloglazov/vim-online-thesaurus' call vundle#end() filetype plugin indent on " ---------------------------------------------------------------------------- " ------------------ My bindings --------------------------------------------- " ---------------------------------------------------------------------------- " using @ is painful nmap \\ @ nmap >> nmap << nmap i>> :vsplit nmap o>> :split nmap s :set spell! nmap pt :set spelllang=pt nmap en :set spelllang=en nmap nmap l :tabnext nmap h :tabprevious nmap g :Gstatus \| :help fugitive-:Gstatus nmap t :TagbarToggle nmap n :NERDTreeToggle nmap l :set list! " should be for mail only imap 1 ="Acked-by: Victor Toso " imap 2 ="Reviewed-by: Victor Toso " " Trick to get shortcut for 'last active tab in vim. let g:lasttab = 1 nmap bt :exe "tabn ".g:lasttab au TabLeave * let g:lasttab = tabpagenr() " ---------------------------------------------------------------------------- " ------------------ EasyMotion ---------------------------------------------- " ---------------------------------------------------------------------------- nmap f (easymotion-overwin-f) map j (easymotion-j) map k (easymotion-k) " ---------------------------------------------------------------------------- " ------------------ Online Thesaurus ---------------------------------------- " ---------------------------------------------------------------------------- let g:online_thesaurus_map_keys = 0 nnoremap w :OnlineThesaurusCurrentWord " ---------------------------------------------------------------------------- " ------------------ CSCOPE -------------------------------------------------- " ---------------------------------------------------------------------------- if has("cscope") set cscopeprg=/bin/cscope set cscopetag set cscopetagorder=0 " cscope db before tags set nocscopeverbose " *dont* show msg when any other cscope db added " add any database in current directory if filereadable("cscope.out") cs add cscope.out elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif " 's' symbol: find all references to the token under cursor " 'g' global: find global definition(s) of the token under cursor " 'c' calls: find all calls to the function name under cursor " 't' text: find all instances of the text under cursor " 'e' egrep: egrep search for the word under cursor " 'f' file: open the filename under cursor " 'i' includes: find files that include the filename under cursor " 'd' called: find functions that function under cursor calls nmap s :cs find s =expand("") nmap g :cs find g =expand("") nmap c :cs find c =expand("") nmap t :cs find t =expand("") nmap e :cs find e =expand("") nmap f :cs find f =expand("") nmap i :cs find i ^=expand("")$ nmap d :cs find d =expand("") endif " ---------------------------------------------------------------------------- " ------------------ Vimdiff ------------------------------------------------- " ---------------------------------------------------------------------------- if &diff " next change nmap >> ]c " previous change nmap << [c " get changes from other buffer nmap get do " put changes into other buffer nmap put dp " quit all buffers nmap q :qall! " toggle Read-Only nmap r :set noro! endif " ---------------------------------------------------------------------------- " ------------------ Vala ---------------------------------------------------- " ---------------------------------------------------------------------------- " from: https://wiki.gnome.org/Projects/Vala/Vim let vala_ignore_valadoc = 1 " Disable valadoc syntax highlight let vala_comment_strings = 1 " Enable comment strings let vala_space_errors = 1 " Highlight space errors let vala_no_trail_space_error = 1 " Disable trailing space errors let vala_no_tab_space_error = 1 " Disable space-tab-space errors let vala_minlines = 120 " Minimum lines used for comment syncing (default 50) " ---------------------------------------------------------------------------- " ------------------ Vim Functions ------------------------------------------- " ---------------------------------------------------------------------------- " from: http://vimcasts.org/episodes/tabs-and-spaces/ " Set tabstop, softtabstop and shiftwidth to the same value command! -nargs=* Stab call Stab() function! Stab() let l:tabstop = 1 * input('set tabstop = softtabstop = shiftwidth = ') if l:tabstop > 0 let &l:sts = l:tabstop let &l:ts = l:tabstop let &l:sw = l:tabstop endif call SummarizeTabs() endfunction function! SummarizeTabs() try echohl ModeMsg echon 'tabstop='.&l:ts echon ' shiftwidth='.&l:sw echon ' softtabstop='.&l:sts if &l:et echon ' expandtab' else echon ' noexpandtab' endif finally echohl None endtry endfunction