Live Chat!

open multiple files in tabs, vim 7 can do that.

          0 votos

August 16th, 2006 mysurface Posted in Text Manipulation, alias, vi, vim | Hits: 6456 |

Remember last time when I open multiple files using vim, it will be loaded and store at the back buffer, in order to bring it to front, you need to first save your current file with :w then :bn for next :bp for previous. But seems vim 7 support tabs, I would like to open multiple files in tab for each file.

vim -p file1 file2 file3

But we might forget to specified -p and open files in the old manner, which my key maps to utilized tab become useless. I realize that if open one file with -p doesn’t have much different without -p, therefore, I play a trick. I set an alias in .bashrc ( .bashrc at home directory).

Insert this into .bashrc:

alias vi="vim -p"

alias allows me to change the way of calling vim, when I type vi, bash shell will replace vi command with vim -p. Therefore, now i can open multiple files in tabs like

vi file1 file2 file3

Important: after changing the .bashrc, terminal have to be restart to see the effects.

3 Responses to “open multiple files in tabs, vim 7 can do that.”

  1. Excuse me, but how do I move from one file to another? Can you please mention that too

  2. To move to next tab use

    :tabn

    to previous tab

    :tabp
  3. It’s better to use gt and gT to move forward and backwards in the tabs, respectfully. That way you don’t have to enter command mode.

Leave a Reply