1 " Simplified version of http://www.vim.org/scripts/script.php?script_id=2184
2 " that does not replace current window
4 if exists('*<SID>gotoline') | finish | endif
7 let file = bufname("%")
8 if filereadable(file) | return | endif
9 let names = matchlist(file, '\(.\{-1,}\):\%(\(\d\+\)\%(:\(\d*\):\?\)\?\)\?$')
10 if empty(names) | return | endif
11 let file_name = names[1]
12 let line_num = names[2] == "" ? "0" : names[2]
13 let col_num = names[3] == "" ? "0" : names[3]
14 if !filereadable(file_name) | return | endif
16 exec "keepalt edit +" . line_num . " " . file_name
17 exec "normal! " . col_num . "|"
21 autocmd! BufNewFile *:* nested call s:gotoline()
22 autocmd! BufRead *:* nested call s:gotoline()