" Cheat sheats " http://nvie.com/posts/how-i-boosted-my-vim/ " http://stevelosh.com/blog/2010/09/coming-home-to-vim/#why-i-switched-to-textmate " http://rmitc.org/2013/04/modern-vim-plugin-management-pathogen-vs-vundle/ " Setup timeouts. Eliminate delay on ESC set timeoutlen=1000 ttimeoutlen=0 " Setup Vundle " Relaunch vim, run :BundleInstall to install the “bundles” you " listed in .vimrc. When you want to update them, :BundleUpdate. To remove " a plugin, just delete its line in your .vimrc file then relaunch vim and " run:BundleClean to remove its folder inside ~/.vim/bundle/ " Vundle follows Pathogen’s approach: putting plugins in their separate " directories. However, it also takes care of the git stuff for us too! Note that " by default it uses git clone, not git add submodule to add plugins. If you’re " using Windows, there’s Vundle for Windows too, though I’ve never tried it. set nocompatible set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " let Vundle manage Vundle. Required! Bundle 'gmarik/vundle' " My Bundles here: original repos on github Bundle 'majutsushi/tagbar' Bundle 'kchmck/vim-coffee-script.git' Bundle 'pangloss/vim-javascript' Bundle 'mattn/gist-vim.git' Bundle 'wincent/Command-T' Bundle 'tpope/vim-fugitive' Bundle 'Lokaltog/powerline' Bundle 'andviro/flake8-vim' Bundle 'SirVer/ultisnips' " "https://github.com/ervandew/supertab " Github repos of the user 'vim-scripts' can omit the username part Bundle 'c.vim' " TODO "https://github.com/vim-scripts/FuzzyFinder " Color bundles Bundle 'altercation/vim-colors-solarized' Bundle 'tomasr/molokai.git' Bundle 'squil/vim_colors.git' syntax on filetype plugin indent on set encoding=utf-8 " Fuck it, I need the mouse " set mouse=a " Set nice colors: " Also check out Vivify, webbased colorscheme editor for vim " http://bytefluent.com/vivify/ " Set molokai colorscheme " https://github.com/tomasr/molokai " If you prefer the scheme to match the original monokai background color, put " this in your .vimrc file: let g:molokai_original = 1 " There is also an alternative sheme under development for color terminals " which attempts to bring the 256 color version as close as possible to the " the default (dark) GUI version. To access, add this to your .vimrc: let " g:rehash256 = 1 " Note: when using the console version, add this command after enabling the " colorscheme in your .vimrc: set background=dark let g:rehash256 = 1 colorscheme molokai set background=dark " Powerline documentation https://powerline.readthedocs.org/en/latest/ set rtp+=/home/ivo/.vim/bundle/powerline/powerline/bindings/vim/ " Pathogen stuf "call pathogen#infect() "call pathogen#helptags() "generate helptags for everything in 'runtimepath' set wrap set textwidth=79 set formatoptions=qrn1 set colorcolumn=85 set hidden set tabstop=8 set shiftwidth=8 set smarttab set laststatus=2 " Always show the statusline set noshowmode " Hide the default mode text(-- INSERT -- below the statusline) set ignorecase set smartcase set incsearch "highlight matching braces set showmatch set autoindent "Auto indent set smartindent "Smart indent set wildmenu set wildmode=list:longest set ttyfast set relativenumber set cursorline set nobackup set noswapfile "Gui stuff set guifont=Inconsolata\ 12 "This line will make Vim set out tab characters, trailing whitespace and "invisible spaces visually, and additionally use the # sign at the end of "lines to mark lines that extend off-screen. For more info, see :h listchars. " Set all this only for python autocmd filetype python set list autocmd filetype python set listchars=tab:▸\ ,trail:.,extends:#,nbsp:. autocmd filetype python set expandtab autocmd filetype python set softtabstop=4 autocmd filetype python set shiftwidth=4 autocmd filetype python set smarttab " Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif "By default, Cscope script adds cscope.out from Vim's current directory and "from $CSCOPE_DB. However, if you start Vim from say ~/proj/src/a/b/c/, while "cscope.out is at ~/proj/src/, that cscope.out won't be loaded automatically. "For ctags, there is a nice trick: with the command :set tags=tags;/ Vim will "look for tags file everywhere starting from the current directory up to the "root. This tip provides the same "autoloading" functionality for Cscope. Just "add the following to your vimrc: "http://vim.wikia.com/wiki/Autoloading_Cscope_Database function! LoadCscope() let db = findfile("cscope.out", ".;") if (!empty(db)) let path = strpart(db, 0, match(db, "/cscope.out$")) set nocscopeverbose " suppress 'duplicate connection' error exe "cs add " . db . " " . path set cscopeverbose endif endfunction au BufEnter /* call LoadCscope() " Cscope mappings " 's' symbol: find all references to the token under cursor nmap s :cs find s =expand("") " 'g' global: find global definition(s) of the token under cursor nmap g :cs find g =expand("") " 'c' calls: find all calls to the function name under cursor nmap c :cs find c =expand("") " 't' text: find all instances of the text under cursor nmap t :cs find t =expand("") " 'e' egrep: egrep search for the word under cursor nmap e :cs find e =expand("") " 'f' file: open the filename under cursor nmap f :cs find f =expand("") " 'i' includes: find files that include the filename under cursor nmap i :cs find i ^=expand("")$ " 'd' called: find functions that function under cursor calls nmap d :cs find d =expand("") " F2 key will pastetoggle so we can normally copy/paste with mouse nnoremap :set invpaste paste? set pastetoggle= set showmode " F8 key will toggle the Tagbar window. nmap :TagbarToggle