Created
December 25, 2013 06:18
-
-
Save trappist/8120624 to your computer and use it in GitHub Desktop.
Open the file with the cursor on lineno given /path/to/file:linono on the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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