-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Port fzf#shellescape to fix escaping issues in Windows #676
Conversation
call writefile(['@echo off', cmd], batchfile) | ||
let cmd = batchfile | ||
endif | ||
execute 'silent %!' cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like s:bang
now but %#!
are not escaped.
|
@junegunn Do I have to update the python and ruby jobs? |
No, we don't want to spend more of our time on those legacy installers. So this fixes #606, right? It's not clear to me though how using a batchfile instead of a command string suppresses "Enter key" prompt. Can you explain? Thanks. |
This PR targets #635, #668, #539 ( For 606, appending |
Thanks for the clarification. I completely lost track of those issues, largely because I'm not a Windows user. Can you update the commit message with I just reviewed the code, although it's unfortunate that we have to introduce extra code branches here and there for Windows, the change looks good to me. Is there anything else you want to address? |
I'll rebase when I think it's ready.
I prefer vim-plug to use |
@junegunn Unlike fzf's Vim plugin, if has('win32')
function s:shellesc(arg)
return s:shellesc_cmd(a:arg)
endfunction
else
function s:shellesc(arg)
return shellescape(a:arg)
endfunction
endif |
e3a8d6b
to
b663921
Compare
Close junegunn#635 Close junegunn#668 Close junegunn#539 Use a temporary batchfile for :!, system(), and jobs and run it in cmd.exe. This bypasses Vim/Neovim issues in Windows and reduces the need to set more options. Also, s:shellesc_cmd works in a batchfile only. Set shellredir for system() in Windows $SHELL sets the default value of 'shell' (see :h 'shell'). This affects shellredir but cmd.exe requires '>%s 2>&1'.
b663921
to
5800a1e
Compare
As long as it's on a separate commit, I'm fine with either :) By the way, we are going to apply
No, you properly handled escaping issues on Windows, so I guess that crude solution is no longer needed. |
Reviewed the code and it looks good to me. Thanks, again. I see that you rebased your commits, ready for merge? |
Yes. I'll open a separate PR for #606 after the merge.
Yes for Windows unless you want to handle msysgit or cygwin as well. |
Thanks, I really appreciate your contribution. |
@junegunn Do you know why some I traced it to eb47183 from the blame. I don't use tags or branches so I didn't notice this while working on this PR. |
Initial work to fix all escaping issues for Vim and Neovim in Windows.
tempname
is necessary to bypass Vim's regular shellescaping in boths:system
ands:bang
like in Vim plugin of fzf because regular Vim seems to assume that the shell options are unchanged in Windows even if all butshell
are unset. It's possible to not require batchfiles but it means double-escaping (ie.fzf#shellescape(fzf#shellescape(cmd))
) for Vim and single-escaping for Neovim with the same values for shell options.