Hacker News new | ask | show | jobs
by joshuadavey 5273 days ago
Thanks, Brice! I also recommend implementing it yourself first. After I did just that, I found myself wanting a little bit more smarts with my vim mapping. Since most of my work is in rails, and I use rails.vim, I was able leverage rails.vim's buffer detection for alternate files.

In essence, if I'm in a controller that has a corresponding spec or test, the mapping with run that spec. If there is no corresponding spec, it will run the most recent command again. I find this useful for outside-in development, where a change in a controller might make a cucumber scenario pass.

I would, however, add that the command you mention above would need to include C-m at the end to actually send the terminal a "newline" character, thereby running the command.

In any case, I appreciate your interest in the project, and your helpful example!

1 comments

I would normally leave this as is, but adding the C-m at the end is non-trivial so I wanted to give a more proper example. You're right, it should be:

    !tmux send-keys -t right 'rspec %' C-m
Notice the C-m is not quoted.

Definitely want to give a big +1, but it's really cool/useful to know what's going on under the hood.