0

I know about vins command line operator but I need a version that works on multiple files .

For instance I have a stack trace file and would like it to open all of the files to the line in a different buffer

2
  • Maybe a silly question, but why not use a debugger for that?
    – user13742
    Apr 3, 2014 at 17:58
  • 1
    There's a number of solutions on so
    – Matt
    Apr 3, 2014 at 17:59

4 Answers 4

2

With the file:line - Allows you to open file:line and it does the right thing plugin, you can use

$ vim foo.c:123 bar.c:456
2

To go to line 3 on file1.txt and line 4 on file2.txt I do this:

vim -c ":e file1.txt|:3|:e file2.txt|:4"
1

This will open the specified files and to to the specified line (to wit: line 123) in all specified files:

vim -p +'tabdo 123' /path/to/somefile /path/to/some/otherfile
1
# search for searchable string in all the files
vim -c ':vimgrep /searchable/ `find . -type f \| grep -v .git \| grep -v .log`'

" if those bellow are set in ~/.vimrc you cycle back and forth with F5 and F6
" :vimgrep /$to-srch/ `find . -type f -name '*.pm' -o -name '*.pl'`
" F5 should find the next occurrence after vimgrep
map <F5> :cp!<CR>

" F6 should find the previous occurrence after vimgrep
map <F6> :cn!<CR>

From a .vimrc with more settings and explanations

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .