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

VimuxSendText() escaping #87

Closed
smondet opened this issue Oct 17, 2013 · 5 comments
Closed

VimuxSendText() escaping #87

smondet opened this issue Oct 17, 2013 · 5 comments

Comments

@smondet
Copy link

smondet commented Oct 17, 2013

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#L45

I was luckier with

call VimuxSendKeys("'" . escape(@k, "'") . "'")

i.e. call system with single quotes and only escape those.

Maybe it can be usefull for others (?).

Cheers

@kindlychung
Copy link

I used this:

call VimuxSendKeys("'" . escape(a:text, "'") . "'")

Shouldn't this be patched?

@kindlychung
Copy link

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

@kindlychung
Copy link

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

@wilywampa
Copy link

Now try sending a semicolon as the last character. Escaping is nasty.

@alerque
Copy link
Member

alerque commented Feb 14, 2021

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.

@alerque alerque closed this as completed Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants