christoomey / vim-tmux-runner

Vim and tmux, sittin' in a tree...
MIT License
291 stars 37 forks source link

Expanding % to the current filename #88

Closed sebsel closed 5 years ago

sebsel commented 5 years ago

I would love to be able to expand % as the current filename, just like in the :! commands. As a usecase: Elixir's mix test command takes an optional filename, to only run the tests in that specified file. Would be nice to reference it just like mix test % or mix test %:12 (for the line number).

But, I already answered my own question: you can use Ctrl-R in command mode (and insert mode) to paste from any registry. <c-r>" pastes from the normal registry, but <c-r>% prints the current filename, which is exacly what I want. (and you could also do <c-r>:=line(".") for the line number but that one is more typing than just looking it up yourself)

Feel free to close if you think this is enough of a solution. Just wanted to have it documented :) Thanks for the plugin!

christoomey commented 5 years ago

@sebsel thanks for the question, and a viable solution. My inclination is to close this as I'm not sure it's worth the complexity add to support this directly in the plugin (frankly I'm not even quite sure how to do it), and I think that there are a handful of ways for a user to wrap the plugin, or use <C-r> or similar as you stated.

Sincerely though, thanks for the question and for providing the answer. This is useful documentation, even if only via searching in the issues! I'm going to close this now based on the above thinking, but please feel free to comment or re-open if you think I missed anything.