"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " My Personal Vim Configuration " Wil Moore III " " I keep this configuration documented here: " https://gist.github.com/3901161 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""" "" base """""""""""""""""""""""""""""" " no annoying sound on errors set noerrorbells set novisualbell set t_vb= set tm=500 """""""""""""""""""""""""""""" "" files, backups and undo """""""""""""""""""""""""""""" " Turn backup off, since most stuff is in source control set nobackup set nowb set noswapfile """""""""""""""""""""""""""""" "" mouse """""""""""""""""""""""""""""" set mouse=a set ttym=xterm2 """""""""""""""""""""""""""""" "" keyboard """""""""""""""""""""""""""""" " -- copy selected to system clipboard (see: http://vim.wikia.com/wiki/Quick_yank_and_paste) vmap "*y " -- visually select all and copy to system clipboard map ggvG$"*y " ,cp copies path to clipboard nmap cp :let @" = expand("%:p") """""""""""""""""""""""""""""" "" formatting """""""""""""""""""""""""""""" " do not wrap set nowrap set textwidth=0 set wrapmargin=0 """""""""""""""""""""""""""""" "" colors and Fonts """""""""""""""""""""""""""""" " Enable syntax highlighting syntax enable colorscheme solarized let g:solarized_termcolors=256 let g:solarized_termtrans=1 set t_Co=256 set background=dark " Set extra options when running in GUI mode if has("gui_running") set guioptions-=T set guioptions+=e set t_Co=256 set guitablabel=%M\ %t endif " Set utf8 as standard encoding and en_US as the standard language set encoding=utf8 " Use Unix as the standard file type set ffs=unix,dos,mac """""""""""""""""""""""""""""" "" testing """""""""""""""""""""""""""""" " t runs tests (make test) map t :make test """""""""""""""""""""""""""""" "" editing """""""""""""""""""""""""""""" " pp toggles paste mode map pp :setlocal paste! " ss toggles spell checking map ss :setlocal spell! " hh turns off search highlight map hh :noh """""""""""""""""""""""""""""" "" splits / windows """""""""""""""""""""""""""""" " instead of ctrl-w then one of {j,k,h,l}, just ctrl-{j,k,h,l}: " http://robots.thoughtbot.com/post/48275867281/vim-splits-move-faster-and-more-naturally nnoremap nnoremap nnoremap nnoremap """""""""""""""""""""""""""""" "" tabs """""""""""""""""""""""""""""" " Maximum number of tabs to display set tabpagemax=50 " Useful mappings for managing tabs (Vim 7 specific mappings) if version >= 700 nnoremap :tabnext nnoremap :tabprevious nnoremap :tabnew nnoremap :tabclose nnoremap :tabmove endif " opens a new tab edit the file whose name is under or after the cursor :map gt :tabedit " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory map te :tabedit =expand("%:p:h")/ " Switch CWD to the directory of the open buffer map cd :cd %:p:h:pwd " Specify the behavior when switching between buffers try set switchbuf=useopen,usetab,newtab set stal=2 catch endtry " Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif " Remember info about open buffers on close set viminfo^=% """""""""""""""""""""""""""""" "" fugitive.vim """""""""""""""""""""""""""""" " Github domains configuration let g:fugitive_github_domains = ['http://github.webapps.rr.com'] """""""""""""""""""""""""""""" "" open all the things """""""""""""""""""""""""""""" " open url under cursor map gu :!open """""""""""""""""""""""""""""" "" git """""""""""""""""""""""""""""" " [goto] Git Conflict nmap gitc /^<<<<<<< HEAD$ """""""""""""""""""""""""""""" "" NERDTreeFind """""""""""""""""""""""""""""" " f invokes NERDTreeFind nmap f :NERDTreeFind """""""""""""""""""""""""""""" "" search (ack) """""""""""""""""""""""""""""" " ensure grep commands still work even if `ack` is not installed if executable("ack") " use ack instead of grep set grepprg=ack\ -H\ --nogroup\ --nocolor\ --column set grepformat=%f:%l:%c:%m endif