-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add MSYS2 support as a vim plugin #1677
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
Changes from 2 commits
43213de
c95d52f
502432f
ca770ec
abde451
637d59f
a1bbd6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ if s:is_win | |
| " Use utf-8 for fzf.vim commands | ||
| " Return array of shell commands for cmd.exe | ||
| function! s:wrap_cmds(cmds) | ||
| return map(['@echo off', 'for /f "tokens=4" %%a in (''chcp'') do set origchcp=%%a', 'chcp 65001 > nul'] + | ||
| return map(['@echo off', 'set TERM= > nul', 'for /f "tokens=4" %%a in (''chcp'') do set origchcp=%%a', 'chcp 65001 > nul'] + | ||
| \ (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) + | ||
| \ ['chcp %origchcp% > nul'], 'v:val."\r"') | ||
| endfunction | ||
|
|
@@ -75,7 +75,7 @@ function! s:shellesc_cmd(arg) | |
| endfunction | ||
|
|
||
| function! fzf#shellescape(arg, ...) | ||
| let shell = get(a:000, 0, &shell) | ||
| let shell = get(a:000, 0, s:is_win ? 'cmd.exe' : &shell) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is for external program such as junegunn/fzf.vim's vim script which seemingly calls this function before
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're doing this, go all the way and don't check
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry but I can't get what exactly means to add In my opinion, since
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idea is to not set the shell in Perhaps, it's too much to do it all in this PR. fzf supported cmd.exe on Windows so doing it halfway (ie. hardcode the default fallback shell to cmd.exe for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I partially introduced your suggestion at ca770ec for now. |
||
| if shell =~# 'cmd.exe$' | ||
| return s:shellesc_cmd(a:arg) | ||
| endif | ||
|
|
@@ -334,19 +334,20 @@ function! fzf#wrap(...) | |
| endfunction | ||
|
|
||
| function! s:use_sh() | ||
| let [shell, shellslash] = [&shell, &shellslash] | ||
| let [shell, shellslash, shellcmdflag] = [&shell, &shellslash, &shellcmdflag] | ||
| if s:is_win | ||
| set shell=cmd.exe | ||
| set shellcmdflag=/c | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not setting shell options here will take a lot of work so consider Neovim's default shell options here and call it a day. let &shellcmdflag = has('nvim') ? '/s /c' : '/c'
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your advice. |
||
| set noshellslash | ||
| else | ||
| set shell=sh | ||
| endif | ||
| return [shell, shellslash] | ||
| return [shell, shellslash, shellcmdflag] | ||
| endfunction | ||
|
|
||
| function! fzf#run(...) abort | ||
| try | ||
| let [shell, shellslash] = s:use_sh() | ||
| let [shell, shellslash, shellcmdflag] = s:use_sh() | ||
|
|
||
| let dict = exists('a:1') ? s:upgrade(a:1) : {} | ||
| let temps = { 'result': s:fzf_tempname() } | ||
|
|
@@ -416,7 +417,7 @@ try | |
| call s:callback(dict, lines) | ||
| return lines | ||
| finally | ||
| let [&shell, &shellslash] = [shell, shellslash] | ||
| let [&shell, &shellslash, &shellcmdflag] = [shell, shellslash, shellcmdflag] | ||
| endtry | ||
| endfunction | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.