Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send more keys with VimuxSendKeys #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,25 @@ function! VimuxRunCommand(command, ...)
endfunction

function! VimuxSendText(text)
call VimuxSendKeys('"'.escape(a:text, '"').'"')
" Escape double quotes "
"call VimuxSendKeys('"'.escape(a:text, '"').'"')
" Don't escape, just send it along.
call VimuxSendKeys(a:text)
endfunction

function! VimuxSendKeys(keys)
if exists("g:VimuxRunnerIndex")
call system("tmux send-keys -t ".g:VimuxRunnerIndex." ".a:keys)
" This is limited to ~30 lines or so, and I want to send more!
" call system("tmux send-keys -t ".g:VimuxRunnerIndex." ".a:keys)
" HACK: Write to a temporary file.
redir! > /tmp/VimuxSendKeys
echo a:keys
redir END
" Load from the temporary file.
" Unfortunately, You have to press Enter to get back to editing.
call system("tmux load-buffer /tmp/VimuxSendKeys; tmux paste-buffer -t ".g:VimuxRunnerIndex)
" This causes vim to hang. :(
" call system("tmux load-buffer -; tmux paste-buffer -t ".g:VimuxRunnerIndex, a:keys)
else
echo "No vimux runner pane/window. Create one with VimuxOpenRunner"
endif
Expand Down