On 18/05/11 5:38 PM, crabsody wrote:
Hi Christian!

No this is probably not what I want. But quickfix is a great feature I
didn't know about. Thank you very much. I will check it out when I
have the time to recompile vim with quickfix option.
Now hat I want is to be able instead of issuing :e +3 main.c to
issue :myfunction main.c:3 Is there any solution to this? Maybe I
should do a script which will substitue main.c:3 with +3 main.c. Is
this easy to do? I don't know how...

Here's a simple solution for .vimrc that might work:

command! -nargs=1 -bang Edit call FileAndLine("e","<bang>",<f-args>)
command! -nargs=1 -bang Split call FileAndLine("sp","<bang>",<f-args>)
function! FileAndLine(cmd,bang,arg)
   let file=matchstr(a:arg,'.\{-}\ze:')
   let line=matchstr(a:arg,':\zs\d\+')
   exec a:cmd.a:bang." +".line." ".fnameescape(file)
endfunction

Then :Edit abc.vim:12 will turn into :e +12 abc.vim and :Split the same,
but into :sp not :e. Passes on a ! too.

Not tested much, and may have nasty edge cases, but should be a good
start.

Ben.



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to