I "grew up" on vim, which is to say my second professional programming job 15 years ago required me to spend vast quantities of time in a terminal to a Solaris machine on which I used vi exclusively to get work done. In those two years I got relatively proficient at navigation, search and replacing, using registers, and tweaking .vimrc with custom settings and macros. I did NOT get into folding, window management, syntax highlighting, or plugins. Things have changed a lot in vim-land.
Watching a friend operate vim last week triggered weirdly intense pangs of jealousy and masochistic visions of how I too could suffer through horrible learning curves and bouts of frustration in order to eke out those extra few moments of productivity per day. How I too could spend hours meddling with plugins and hacks, custom scripts and a terminal to get features which every modern IDE user now takes for granted. I romantically pictured my hands rooted on the homekeys, flying through mountains of text like a boss, and the legions of adoring co-workers who would wonder at my elite skills. Totally will happen.
So for what feels like the Nth time, I re-approached my old friend vim. It was shocking how much of my muscle memory had been retained, but it was also shocking how much I miss features like "find usages", "refactor...[anything]" and quick project based shortcuts for getting around files. One of the plugins my friend was using was
NERDTree, which provides a pretty nifty tree project/folder navigator as a window in vim. Almost but not quite a project view.
And when it comes to plugins, all the cool kids these days are using the social git-goodness of
github combined with a neat plugin called
Pathogen to create "dotVim" repositories which make the whole process of managing, sharing, and installing your
perfect vim environment far far simpler. Branch a dotVim repo, symlink it into your user folder and you're off. You'll find a ton of documentation out there on how to make it work so I won't repeat it here. I based my latest attempt at vim heaven on
Kody Krieger's dotVim, which is a slimmed down version of Janus which uses Pathogen. I particularly liked that installation of this is bootstrapped so you can run a single command in the console to get started: (which of course I had to inspect before running because I'm paranoid like that)
curl https://raw.github.com/codykrieger/dotvim/master/bootstrap.sh -o - | shAnyway, after dealing with some issues as a result of missing plugins (slim, which looks to be fixed since I installed) I was off and running. I ended up deleting the ruby specific plugins and adding a few color schemes but have otherwise only changed the .vimrc (macros, and tabs not spaces damnit! unless it's python, then spaces are ok)
NERDTree is great, but I find myself still relying on good ole :e for most things
Ctrl-P is fantastic but I find it doesn't always work, I'm guessing I need to feed more information about my context to it so that it searches the right paths. When it does work though it's basically :e on steroids.
Fugitive is amazing, and the ability to quickly pull up a diff on what you're working on is lovely. I still hit the command line more often than I probably need to.
There are a bunch of others in here that are probably making life nicer without me even knowing...still much to learn.
I quite like the git repo approach and the fact that I was able to tweak everything on my laptop and then just clone to my desktop at home was pretty fantastic. I will say though that I find the sub-modules a bit of a nuisance. I don't really need to be on the bleeding edge of vim plugins and I'd rather have full control so I removed all of the submodule aspects to the above dotVim and will just pull updates when I hit bugs or need new features. The end result of my efforts are
on bitbucket.
To commit myself more to learning the editor I've also started using it for writing simple text documents as well like the government forms I'm in the process of filling out. It's fun to make a terrible job an opportunity to refine your tool skills. Vim out of the box is not great at handling paragraphs of text however and so a few tweaks are required. I have the following in my .vimrc which allows me to quickly enter "prose" mode (fixing line up line down in wrap mode being the biggest element for me)
" setup the current vim instance for writing prose stylecommand! Prose call SetupForProse()function SetupForProse() "break lines visually, and don't group hardbreaks on previous word set formatoptions=1 set linebreak set wrap set nolist
"set breakat=\ |@-+;:,./?^|
"change default cursor keys to work on visual not actual lines nnoremap j gj nnoremap k gk vnoremap j gj vnoremap k gk
"border on the left hand side set foldcolumn=7
endfunctionOn with the self torture!