[Ilugc] Editing multiple files together

  • From: girishvenkatachalam@xxxxxxxxx (Girish Venkatachalam)
  • Date: Sat, 23 Jun 2012 18:08:41 +0530

Editing is a job programmers do, article writers do and today of
course in place of typewriter everybody
 uses computers.

Doing that with libreoffice or some typesetting tool, some WYSIWYG
editor is not much fun.

I do my html, e-mail, coding, config file editing all with vim.

A year or so ago, vim added the tab feature found in browsers.

You can edit multiple files in multiple tabs.

Of course vi had support for editing multiple files but only one will
be in the window.

You can split windows and all that.

But for some reason tabs are better.

$ vim -p foo.txt bar.txt

will open two tabs.

And you switch between them using "gt".

It is cool since you can run commands for all tabs at once in colon mode:

:tabdo <command>

Also I use vimdiff to merge files.

$ vimdiff orig.txt changed.txt

You can type some quick commands, dP or something to paste from one to another.

Try these things. This is more of a simple cheatsheet or a brainless howto.

-Girish

-- 
Gayatri Hitech
http://gayatri-hitech.com

Other related posts: