The high level of Vim Fu here at work is simply astounding. While it will be a while before I even come close to the level of other people here, perhaps one of the most useful tricks I've found is this little line in my .vimrc: map ,r :! eval "./%" <cr>. (I don't know if that's the best syntax). Now, when I'm in command mode, ",r" will automatically run the program that I am editing (my test program, usually). My next hack will be to map a command to grind, my test program to run all tests.
Other things they do: when in a test, typing ",t" will run the test, ",gi" will go to the implementation (the module you're testing) and ",gt" will go back to the test for that module. It's marvelous how fast that speeds up testing.
Care to share a few implementations? I'd be particularly interested in running the test file and filtering out all successes. (If that means writing to Test::Harness::Straps, so be it.)
Re:Vim Mappings
Ovid on 2003-08-28T21:00:25
They use custom test modules they wrote a while ago, so much of their implementation is based upon knowledge of their test modules and how they're structured. I haven't thought of a more generic way of doing it.
Unless I misunderstand you, perhaps a naive implementation in your
That will make the "not ok" show up and the error data is written to STDERR, so that also would not be filtered..vimrc would be map ,t !eval "./%" | grep "^not"? Re:Vim Mappings
Matts on 2003-08-29T08:09:12
Run the same usingtv -q
from Test::Verbose.
I'd be very interested in seeing some more of these useful vim mappings. I've been digging vim ever since I started playing with Red Hat back in Jan 2002, (and have gone so far as to install a Mac OS Classic version of vim on my PPC 7600 running OS 8.6)
I've gotten a lot of vim knowledge thanks to MetaCosm's IRC-style tutorial (which seems to be down at the moment but you can find it cached on google), and the #vim channel on irc.freenode.net, but fresh input from people that know some serious vim-fu would be greatly appreciated.
my favorite so far was a simple
eval
. I have two mappings for doing something with the current file:
map ü :!perl -w %
map ö :!perl -wc %
Re:Even simpler
rafael on 2003-08-29T12:26:44
:!./%
is even more simple. That's what I use;-) although
:new|r!./#
is also useful. (Quote the pipe with \ in maps.)
My favorite vim map is amazingly simple:
vmap * y:let@/=@"<CR>n
Select a word or part of a word in visual mode, enter '*', and voilà, you're searching for this word.Re:Even simpler
runrig on 2003-09-03T21:04:04
Windows doesn't seem to like that, but specifying 'perl %' as the command does work. Either way, I really need to learn some vim; I'm still using it like it's plain vi.:!./%