Reputation: 7409
My log always shows errors in this way:
lib/rails/rack/logger.rb:38
Can I copy the above line then open the file with vim and move to line 38?
Upvotes: 1
Views: 689
Reputation: 172520
Have a look at the file:line - Allows you to open file:line and it does the right thing plugin; it sets up autocmds to handle those, so you can pass your path/to/file:lnum
directly to Vim on the command line and :edit
such, too!
Upvotes: 3
Reputation: 185025
You could put this function in your (bash ?) rc file :
vimtoline(){ IFS=: read -r f l <<< "$1"; vim "$f" +"$l"; }
then
vimtoline lib/rails/rack/logger.rb:38
will do the trick.
Thanks to chepner for the enhancement.
Upvotes: 0
Reputation: 311163
You can open a file in vim and jump to a specific line by using the +
syntax:
vi lib/rails/rack/logger.rb +38
Upvotes: 3