Skip to content

Instantly share code, notes, and snippets.

@jeresig
Created May 4, 2011 16:46
Show Gist options
  • Star 75 You must be signed in to star a gist
  • Fork 21 You must be signed in to fork a gist
  • Save jeresig/955547 to your computer and use it in GitHub Desktop.
Save jeresig/955547 to your computer and use it in GitHub Desktop.
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
" when we reload, tell vim to restore the cursor to the saved position
augroup JumpCursorOnEdit
au!
autocmd BufReadPost *
\ if expand("<afile>:p:h") !=? $TEMP |
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ let JumpCursorOnEdit_foo = line("'\"") |
\ let b:doopenfold = 1 |
\ if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
\ let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
\ let b:doopenfold = 2 |
\ endif |
\ exe JumpCursorOnEdit_foo |
\ endif |
\ endif
" Need to postpone using "zv" until after reading the modelines.
autocmd BufWinEnter *
\ if exists("b:doopenfold") |
\ exe "normal zv" |
\ if(b:doopenfold > 1) |
\ exe "+".1 |
\ endif |
\ unlet b:doopenfold |
\ endif
augroup END
@exhuma
Copy link

exhuma commented Jul 27, 2011

Hey,

in the article on usesthis.com, you say you use vim (which is how I stumbled across this page). Do you use it often? Or only for a few tasks. I am asking because this vim config looks very minimalistic. Do you store other settings in filetype plugins?

If so, I'm curious to see what's going on in there ;) Other people's vim files can often be very instpirational ;)

nb: I keep my annotated version at https://github.com/exhuma/vimfiles/blob/master/.vimrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment