Skip to content

Instantly share code, notes, and snippets.

@prufrock
Last active December 31, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prufrock/7931998 to your computer and use it in GitHub Desktop.
Save prufrock/7931998 to your computer and use it in GitHub Desktop.
My vim configuration
execute pathogen#infect()
set background:dark
syntax on
filetype plugin indent on
set nowrap
set shiftwidth=4
set ts=4
set expandtab
set encoding=utf-8
"open a tag definition a new tab
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
"open a tag definition in a vertical split
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
"search up the directory tree to root for a tags file
set tags=./tags;/
"searh up the directory tree to home for a tags file
"set tags=./tags;$HOME
set list listchars=tab:-⇥,trail:␣,extends:⇉,precedes:⇇,nbsp:·
"With the following mapping a user can press F5 to delete all trailing
"whitespace. The variable _s is used to save and restore the last search
"pattern register (so next time the user presses n they will continue their
"last search), and :nohl is used to switch off search highlighting (so
"trailing spaces will not be highlighted while the user types). The e flag is
"used in the substitute command so no error is shown if trailing whitespace is
"not found. Unlike before, the substitution text must be specified in order to
"use the required flag.
:nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment