Vim Tips Wiki
Advertisement

I use tabs for each file and often want to view a file in a new tab without editing it. So I now have a line in my .vimrc:

ab tabv tabnew\|set nomodifiable\|view

and then :tabv [file] just opens my file in a new tab read-only and nomodifiable.

Comments

How about this minor improvement, so that it only triggers in command-line mode, does not set the global nomodifiable option, and additionally uses fewer commands:

cabbrev tabv tab sview +setlocal\\ nomodifiable

I think this would be a good thing to merge into Quick tips for using tab pages.

--Fritzophrenic 18:27, February 23, 2010 (UTC)

Advertisement