A lot of times I like to run Vim in a single window with many buffers. A nice way to stay focused is to go full-screen and then run the vtreexplorer plugin on the root of my source tree. A simple entry in my vimrc, and I can toggle it on as needed:
map <F12>
:VSTreeExplore <CR>
VSTreeExplorer is available at: http://vim.sourceforge.net/scripts/script.php?script_id=184
Here's the obligatory screenshot.
3 comments:
As you are probably aware, without VTreeExplore I would probably quit using computers altogether. Anyway, something I've found useful when I'm moving between a lot of files in the VTreeExplore window, if they happen to be CamelCased (as java pretty much always is) I can get to filenames using the / search by searching for a pattern in the at a CamelCase case change. For example, I want to open ServiceBinding.java which is in a directory with about 10 other java class of the form Service*.java. Rather than search for /Serv or /Service, which is what I would normally do, I'll search for /ceBi as this combination is unlikely to occur in most other filenames. Vim, I find, is centered around the user entering an absolute minimum of information to indicate an unambiguous command, and this little tip is right along those lines.
I frequently keep 2 or more buffers open to the right of my tree explorer window. Pretty regularly, I click to open a file from VTreeExplorer and find that I haven't written my most current changes to the active buffer. VTreeExplorer smartly opens a new window for the file you are trying to open, however the default behavior of VTreeExplorer is to split ITS window, not the window of the un-written buffer. Since I prefer to keep my VTree window at a static height and position, this annoys me.
So I opened up the vtreeexplore.vim plugin file in /usr/share/vim/vim71/plugins and found that the code for this behavior lives in the "Activate()" method. In my version (1.24) this method starts on line 518 and all I had to do was comment out one command to fix it. On line 554, right before the exec("new" . f) command which opens the file in the new window, there is the command "wndcmd p" which sends focus back to the VTree window. I just commented this line out, and now VTree splits my working buffer when it opens a new file!
that should have been "wincmd p" not "wndcmd p" pardon the error. line numbers are right anyway :P
Post a Comment