Hi,
I should probably add this to vim.org as a Plugin or something at some stage.
Drop all this stuff in your .vimrc and then 'gf' will jump to the file + line
number, and 'gsf' will split the window then jump to the file + line number.
==============================================================
function! GotoFileWithLineNum()
" filename under the cursor
let file_name = expand('<cfile>')
if !strlen(file_name)
echo 'NO FILE UNDER CURSOR'
return
endif
" look for a line number separated by a :
if search('\%#\f*:\zs[0-9]\+')
" change the 'iskeyword' option temporarily to pick up just numbers
let temp = &iskeyword
set iskeyword=48-57
let line_number = expand('<cword>')
exe 'set iskeyword=' . temp
endif
" edit the file
exe 'e '.file_name
" if there is a line number, go to it
if exists('line_number')
exe line_number
endif
endfunction
map gf :call GotoFileWithLineNum()<CR>
map gsf :sp<CR>:call GotoFileWithLineNum()<CR>
==============================================
regards,
Peter
Send instant messages to your online friends http://au.messenger.yahoo.com