Skip to content

Instantly share code, notes, and snippets.

@nrocy
Created July 22, 2011 02:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrocy/1098758 to your computer and use it in GitHub Desktop.
Save nrocy/1098758 to your computer and use it in GitHub Desktop.
useful vim settings
Plugins
Definitely take a look at pathogen, it's pretty straightforward to setup. Once installed you can
keep each plugin in its own dir (and use git submodules to keep 'em up to date/auto-install etc)
https://github.com/tpope/vim-pathogen
.vimrc
Few things you may want to look into, ':h options' to look at what 'set'tings do. Most of the below I use a *lot* :)
# history items to keep
set history=NNNN
# for single lines that wrap multiple screen lines, move up/down screen lines, not buffer lines
nnoremap j gj
nnoremap k gk
# highlight searches by default, toggle search highlighting on/off easily with leader n
set hlsearch
nmap <silent> <leader>n :set invhls<CR>:set hls?<CR>
# nice status line (customize!)
set stl=%f\ %m\ %r\ Line:\ %l/%L[%p%%]\ Col:\ %c\ Buf:\ #%n\ [%b][0x%B]
# move between splits with C-h, etc, rather than C-W h, really quick when you get used to it
map <C-H> <C-W>h
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
# leader v to reselect the text you just pasted, REALLY handy to paste, reselect, indent
nmap <Leader>v `[V`]
# centre current line in the buffer
nmap <space> zz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment