Skip to content

Instantly share code, notes, and snippets.

@agile
Created July 30, 2008 14:58
Show Gist options
  • Save agile/3271 to your computer and use it in GitHub Desktop.
Save agile/3271 to your computer and use it in GitHub Desktop.
function! s:gotoline()
let file = bufname("%")
let names = matchlist( file, '\(.*\):\(\d\+\)')
if len(names) != 0 && filereadable(names[1])
exec ":e " . names[1]
exec ":" . names[2]
if foldlevel(names[2]) > 0
exec ":foldopen!"
endif
endif
endfunction
autocmd! BufNewFile *:* nested call s:gotoline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment