Monday, February 7, 2011

Re: jumping to a given file and line from a log file




2011/2/7 AK <andrei.avk@gmail.com>
On 02/07/2011 04:12 PM, Jose Caballero wrote:
Hi,

my apologies if this question is too silly, or already asked.
In that case, you can just point me to the documentation or example, and
I will keep investigating myself.

I use vim version 6.3.82 on RedHat.

Let's say I have a log file with this format

<date&time> | <filename>:<line> | <message>

For example

...
07 Feb 16:17:38| module1.py : 344    | message1
07 Feb 16:17:39| utils.py : 229    | message2
07 Feb 16:17:40| module2.py : 5002   | message
...


If I have cursor on one of those lines, I would like to know if there is
a way (some script or magic key combination) to open the file it is
mentioned, with the cursor directly to that line number.
i.e. if I have the cursor on the second line, I would like to open file
"utils.py" and jump directly to line 229

Is it possible?

Thanks a lot in advance.
Jose


--
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

There's 'gf' command, see :help gf
It won't go to line number, though. There's a plugin that does that,
I think it may be this one:
 http://www.vim.org/scripts/script.php?script_id=293

HTH, -ak


Hi ak,

thanks a lot. That gf command, which I didn't know, is very useful.
Now I knew gf exists I could dig a little more myself, and I have found this

http://vim.1045645.n5.nabble.com/Goto-file-under-cursor-with-line-number-td1150643.html

which I think is exactly what I was looking for.


Jose


 

--
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

No comments: