tpope / vim-tbone

tbone.vim: tmux basics
http://www.vim.org/scripts/script.php?script_id=4488
397 stars 17 forks source link

split off send_keys function #6

Closed kljohann closed 10 years ago

kljohann commented 11 years ago

Hi, I split off the meat of the tbone#write_command into a separate function that can be used from other plugins to send keys to a tmux pane. I'm using this for interacting with a REPL where only using ':Twrite' does not cut it as I want to send custom strings that do not correspond to lines in the buffer.

wellle commented 10 years ago

I just had the same use case where I would like to quickly create a mapping to execute the following:

map <leader>t :call tbone#send_keys('right', 'make test')

I know that vim-dispatch has a similar goal, but I like how this approach lets me specify the target pane.

@tpope Do you see any reason not to merge this pull request?

tpope commented 10 years ago

I don't think that echoerr business belongs in an API for starters. Use an exception.

But really I've been silent because I'm hesitant in general to support APIs, and I didn't want to create busywork for anyone before I had time to think on it. It's probably fine.

wellle commented 10 years ago

I can understand that you might not want to go in this direction.

If anybody runs into the same issue I can recommend slimux. If only it would support relavite panes like left and right.

@tpope Feel free to remove the previous paragraph if you don't want links to competing plugins here.

tpope commented 10 years ago

Actually I was surprised to receive this in light of every other tmux plugin I looked at being a high ceremony send-keys wrapper. But as you've touched on, high ceremony can be pretty restrictive.

tpope commented 10 years ago

Fix the echoerr issue, move the length echoing out of the function, and I think this is good to go.

wellle commented 10 years ago

Implemented in #7.