7a3e9447b16a1427098a9ef0dbe1e4c7ff3f8bc9
David Blume Added file-line and visual-...

David Blume authored 8 years ago

1) " Avoid installing twice or when in unsupported Vim version.
dblume Revert "Minor update to fil...

dblume authored 2 years ago

2) if exists('g:loaded_file_line') || (v:version < 700)
David Blume Added file-line and visual-...

David Blume authored 8 years ago

3) 	finish
4) endif
5) let g:loaded_file_line = 1
6) 
7) function! s:gotoline()
8) 	let file = bufname("%")
9) 
10) 	" :e command calls BufRead even though the file is a new one.
11) 	" As a workarround Jonas Pfenniger<jonas@pfenniger.name> added an
12) 	" AutoCmd BufRead, this will test if this file actually exists before
13) 	" searching for a file and line to goto.
14) 	if (filereadable(file))
15) 		return
16) 	endif
17) 
dblume Revert "Minor update to fil...

dblume authored 2 years ago

18) 	" Accept file:line:column: or file:line:column and file:line also
19) 	let names =  matchlist( file, '\(.\{-1,}\):\%(\(\d\+\)\%(:\(\d*\):\?\)\?\)\?$')
David Blume Added file-line and visual-...

David Blume authored 8 years ago

20) 
dblume Revert "Minor update to fil...

dblume authored 2 years ago

21) 	if empty(names)
22) 		return
23) 	endif
24) 
dblume Better filename expansion f...

dblume authored 1 year ago

25) 	" Don't commit this change. Just testing vimrc Diff command.
26) 
dblume Revert "Minor update to fil...

dblume authored 2 years ago

27) 	let file_name = names[1]
28) 	let line_num  = names[2] == ''? '0' : names[2]
29) 	let  col_num  = names[3] == ''? '0' : names[3]
30) 
31) 	if filereadable(file_name)
32) 		let l:bufn = bufnr("%")
33) 
dblume Add two fixes to file-line....

dblume authored 2 years ago

34) 		exec "keepalt edit " . fnameescape(file_name)
dblume Revert "Minor update to fil...

dblume authored 2 years ago

35) 		exec ":" . line_num
36) 		exec "normal! " . col_num . '|'
37) 		if foldlevel(line_num) > 0
38) 			exec "normal! zv"
39) 		endif
40) 
41) 		exec "normal! zz"
dblume Add two fixes to file-line....

dblume authored 2 years ago

42) 		exec ":bwipeout " l:bufn
dblume Revert "Minor update to fil...

dblume authored 2 years ago

43) 	endif
44) 
45) endfunction
dblume Minor update to file-line.v...

dblume authored 2 years ago

46)