I find Vim easiest for browsing source and as I explore TiddlyWiki, I decided to use some fairly recent Vim features - vertical splitting and the explorer window. Combined, these give you the feeling you’re an 1988 edition of Eclipse. Just like a modern IDE, but navigation is ten times faster.
Here’s the macro - which assumes you just opened vim or have a single empty buffer:
map ]xx :Explore<cr>2jp<c-w>H20<c-w><
To switch files, navigate to the new file’s name in the explorer window, and hit “p” (the built-in command for “open this file in the previous location).
The macro:
- Populates the current buffer with an explorer window
- Jumps down two lines (to reach the second filename - the first name is often .svn)
- Opens the file (“p”)
- Places the explorer window on the left side (which also forces a re-orientation towards vertically split windows)
- Resizes the explorer window to be 20 columns wide
While in the source window, you can still use commands like “:e filename” to open a new file (with tab completion) and ctrl-o/ctrl-i to jump back and forth.
The other helper is exuberant ctags, which I installed via Fink. I just run “ctags *.js” and then I can hyperlink from the file under my cursor using ctrl-], or visit any function using “:tag function-name”. (One remaining frustration is I can’t get it to hyperlink to OO methods established using the “abc.prototype.xyz = function() {…}” idiom, despite including the pattern in ~/.ctags.)