Reply to message «how to go to a file,lineno», sent 08:19:12 05 September 2011, Monday by sinbad:
> i have a file name and line number, how can i go to that
> file,line in vimscript. the following isn't working.
>
> exe ":silent! e".fname
> exe ":silent! ".lineno
> exe ":redraw"
Of course, it is not. You forgot to escape filename and forgot to add a space
after :e:
execute 'silent edit '.fnameescape(fname)
execute 'silent '.lineno
redraw
Don't use `:silent!', it is a bad practise to junk possible error messages. And
you need neither :execute before :redraw, nor `:' before commands in :execute.
You can also use
execute 'silent edit' fnameescape(fname) '+'.lineno
Original message:
> hi,
>
> i have a file name and line number, how can i go to that
> file,line in vimscript. the following isn't working.
>
> exe ":silent! e".fname
> exe ":silent! ".lineno
> exe ":redraw"
>
> thanks
signature.asc
Description: This is a digitally signed message part.
