Sunday, December 16, 2007

Tab Menu in VIM

There is a nice plugin for tab management in VIM. If you add that script to plugins directory in VIM, then a new menu would come for Tabs. That menu would list all the files that are there in different tabs. If you click on any file name, it would take you to the tab of that file. This will work similar to tabs in crimson editor, or editplus. VIM 7.0 already has all the features that are required for beginners. With this feature, one can easily manage many tabs. You can get the script from

http://www.vim.org/scripts/script.php?script_id=2096

Few Tips on opening files in VIM:

If you want to open a file in the existing VIM in a different tab, use
gvim --remote-tab-silent < fileName >

If you want to have a right click option which always opens the file in a new tab in existing VIM (Opens a new VIM if there is no existing session), then do the following.
Open Registry Editor (regedit)
In My Computer -> HKEY_CLASSES_ROOT -> *
Add a new key "shell". In that add another new key "gvim", and in that
create a key "command". Change the default value of "command" to
C:\software\Vim\vim70\gvim.exe --remote-tab-silent "%1"

(Remove " in shell, gvim, and command. For gvim.exe, use the path of your installation)

With this, you will get a right click menu item gvim, and if you click on that, it will open the file in a new tab in the existing VIM.

With VIM 7.0, editing multiple files became as easy as any other editor. So, start using VIM.

By the way, this is my first ever contribution to open source. I never expected that, my first contribution would be in the most matured product. If you like it, or want to give feedback, please send me a mail. My mail id is this blog name at gmail.com.

3 comments:

  1. typically nobody touches registry for vim...
    all they do is update the vimrc file...
    i can forward u mine if u r interested

    ReplyDelete
  2. The change in the registry entry is for adding a context menu item to open in VIM in a new tab in existing window. It is nothing to do with VIM or any other application. You can open any other application in the same way by changing the command. I mentioned this because, it is very convenient to have.

    ReplyDelete
  3. A nice contribution, Satish. Your code told me that I have not kept myself up-to-date with vi syntax.

    Expect more utilities and projects from you.

    -rupesh.

    ReplyDelete