Closed smondet closed 3 years ago
I used this:
call VimuxSendKeys("'" . escape(a:text, "'") . "'")
Shouldn't this be patched?
This make it impossible to send a line containing single quotes to shell, for example:
echo 'a'
I got an error:
Error detected while processing function VimSendText..VimSendKeys Line 2: E484: can't open file /tmp/vo4zhg75/2
I have rewritten the function in python, and it now works flawlessly:
function! VimuxSendText(text)
python << endpy
import subprocess
import vim
mytext = vim.eval("a:text")
mytarget = vim.eval("g:VimuxRunnerIndex")
print mytext
subprocess.call(["tmux", "send-keys", "-t", mytarget, mytext])
endpy
endfunction
Now try sending a semicolon as the last character. Escaping is nasty.
This should be addressed by 46377b8. Feel free to comment if this doesn't cover all the possible escaping issues, but I think it will.
I was having trouble with
VimuxSendText
when the text contained'$'
characters.The function only escapes
'"'
, c.f https://github.com/benmills/vimux/blob/master/plugin/vimux.vim#L45I was luckier with
i.e. call
system
with single quotes and only escape those.Maybe it can be usefull for others (?).
Cheers