" Use Vim settings, rather than Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " Set vim to store all the swap files in the same location set directory=~/.vim/swap,. " Set 256 colors set t_Co=256 " allow backspacing over everything in insert mode " set backspace=indent,eol,start " In many terminal emulators the mouse works just fine, thus enable it. if has('mouse') set mouse=a endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on " set hlsearch endif " Suffixes for vim to ignore (binary files): set suffixes=.com,.class,.dll,.exe,.o,.so,.d,.sym,.map,.lss,.hex,.elf,.eep,~ " Start pathogen plugin for autoload of plugins from ~/.vim/bundle call pathogen#infect() call pathogen#helptags() syntax on filetype plugin indent on " Stuff for Airline set laststatus=2 let g:airline_powerline_fonts = 1 let g:airline_theme = 'powerlineish' let g:airline_enable_branch = 1 let g:airline_enable_syntastic = 1 " Stuff for NERDTree autocmd vimenter * if !argc() | NERDTree | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " Remap F2 to NERDtree nnoremap :NERDTree " Keep NERDTree on the left at all times let g:NERDTreeWinPos = "left" let g:NERDTreeSplitVertical = 1 " Add vim suffixes to NERDTree ignore list let NERDTreeIgnore = [] for suffix in split(&suffixes, ',') let NERDTreeIgnore += [ escape(suffix, '.~') . '$' ] endfor " Required for taglist filetype on let g:Tlist_Use_Horiz_Window = 0 " Ctags tags file location set tags=./tags;/ " Keybind for updating ctags db for taglist and code complete nnoremap :!ctags -R --c++-kinds=+p --c-kinds=+p --fields=+iaS --extra=+q . " Set tab settings set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent smartindent " Mark 80 characters set cc=80 " Set line numbers set number " Set background to dark set bg=dark " Disable line wrapping set nowrap " Key bindings for changing tabs with ctrl+left/right and move them with alt+left/right nnoremap :tabprevious nnoremap :tabnext nnoremap :execute 'silent! tabmove ' . (tabpagenr()-2) nnoremap :execute 'silent! tabmove ' . tabpagenr() " Key binding ctrl-l to remove search highlighting nnoremap :noh " Use relative line numbers, toggle with function! NumberToggle() if(&relativenumber == 1) set norelativenumber set number else set nonumber set relativenumber endif endfunc nnoremap :call NumberToggle() " Don't use relative line numbers when vim doesn't have focus :au FocusLost * :set number :au FocusGained * :set relativenumber " Don't use relative line numbers in insert mode autocmd InsertEnter * :set number autocmd InsertLeave * :set relativenumber