Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim : Open multiples files on different lines

Tags:

vim

I was wondering if there's a way to open multiples files with Vim, but each file on a specific line number. I explain :

I often use the syntax : vim my/way/too/far/file +120 in order to edit this file at line 120 because gcc told me too :)

Now what i'm looking for is a way to do this for multiples files at the same time!

Of course, vim file1 +xx file2 +xx ... won't work (the + option only affect first file ... don't ask me why)

So if anyone know a way to fix this? I didn't found it in the manpage...

By the way, sometimes, file1 maybe the same file as file2 ...

like image 728
claf Avatar asked Jan 27 '10 16:01

claf


People also ask

How do I open multiple files in Vim?

Ctrl-W w to switch between open windows, and Ctrl-W h (or j or k or l ) to navigate through open windows. Ctrl-W c to close the current window, and Ctrl-W o to close all windows except the current one. Starting vim with a -o or -O flag opens each file in its own split.

How do I open multiple files in Vim vertically?

Suppose you have opened a file on Vim editor and you want to split it vertically. To achieve this: Enter command mode by pressing the ESC button. Press the keyboard combination Ctrl + w , followed by the letter 'v' .


1 Answers

Here's a way : vim +6 file1 +"sp +3 file2". Change sp to tabnew if you prefer tabs.

But it would be really useful only if someone could make a script with it...

like image 176
Pikrass Avatar answered Oct 13 '22 23:10

Pikrass