3 ms·
I recommend anyone wishing to use something like this first try to implement it yourself first. It's remarkable how easy it is to script tmux and vim. If you ha
by bricestacey 15y ago
I recommend anyone wishing to use something like this first try to implement it yourself first. It's remarkable how easy it is to script tmux and vim. If you have a split screen it's as simple as a vim mapping that executes !tmux send-keys -t right 'rspec %'
Not dissing the project - I would recommend then using a more battle-tested project (like maybe this one) if you find yourself needing something more generic and complicated.
- joshuadavey 15y agoThanks, 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!
- bricestacey 15y agoI 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.