Friday, November 24, 2006

gvim - opening files in tabs. How to search through windows?

With gvim 7.x you can open files in tabs.

However on the command line it follows the old behavior of editing one file at a time.
gvim file44.php

Instead you have to use the -p command line option.
gvim -p file44.php

Then you have all of your files opened up in separate tabs.

The new tabs in gvim 7.x make using pypanel less necessary for me. pypanel is a little python app for X11 that works really nicely with WindowMaker (the minimal window manager). It gives you a task bar, which can be programmed in python. I used to use pypanel with gvim for when I have more than a few files opened in one work space. Now with tabs, I am able to have a lot more files opened at once.

Gvim tabs, the pypanel task bar, and windowmakers workspaces make my desktop a lot more scalable, and less annoying :)

Does anyone know of a tool to search through window names, and then focus the selected window? Now that I might have 100-200 files open at once a search function would sometimes be handy.

Another fun gvim trick for my Work In Progress (WIP) todo/log files is to insert the results of a command into your file. :r!date
Thu Nov 30 10:29:00 EST 2006

Now I don't have to leave the keyboard to insert the date.

Melbourne Website DeveloperThis post written by a Melbourne website developer. I am available for your web development projects. My skills include: python, php, mysql, e commerce, javascript, CMS, css, flash, actionscript, python, games, postgresql, xml.


Duncan McGreggor said...

I find that tabs get quite cumbersome. My all-time favorite vim plugin is VTreeExplorer.

It's so much easier (for my mind) managing something that follows the tree structure of python packages than a linear list of files...

Tartley said...

> Does anyone know of a tool to search through window names, and then focus the selected window?

The vim script you want is called FuzzyFinder. Bind it to a key, press that key, and you can type in a (partial) filename. FuzzyFinder displays a drop-down menu of matching files from searching below your current directory. The drop down updates with every key you type. Best match is at the top, automatically highlighted for when you press Enter to select it. Could not be better.

Better still, it has alternate modes:
a) fuzzy find for filenames
b) fuzzy find for open buffers
c) fuzzy find on tags such as function and class names (as generated by ctags)