Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open (edit) multiple files from within with the command mode

Tags:

vim

edit

How can you open multiple files when you're already browsing one?

If I do:

:e myFile

then myFile open in another buffer, but obviously:

:e myFile1 myFile2

open a new file named "myFile1 myFile2"...

It's easily possible to open from outside, be it in tabs or buffer, but from inside, still did not find...

like image 214
benichka Avatar asked Sep 20 '14 09:09

benichka


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

Open multiple files and easily switch between them To switch from one tab to other, you can use the :bn and :bp commands while the editor is in the command mode. That's it.


1 Answers

:e and its relatives only accept one argument. See :help :args:

:argadd myFile1 myFile2

or:

:next myFile1 myFile2

You can use wildcards too:

:argadd *.rb
like image 109
romainl Avatar answered Oct 19 '22 19:10

romainl