Skip to content
Myr

Add MSYS2 support as a vim plugin (#1677)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Add MSYS2 support as a vim plugin Add &shellcmdflag and TERM environment variable treatment. - Make &shellcmdflag `/C` when &shell turns into `cmd.exe` - Delete %TERM% environment variable before fzf execution * Change shellescape default value depending on s:is_win flag * Make TERM environment empty only when gui is running * Stop checking &shell in fzf#shellescape function This funcion's behavior is controlled by only if it is Windows or not. So there is no need to check &shell. * Take neovim into consideration when to set shellcmdflag * Add &shellxquote control

authored by msr1k · committed by Junegunn Choi · parent 9fefe08 · Browse files · 1 file+8 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−5 removed

  • other:+8 added−5 removed

1 file+8 added−5 removed

modified:plugin/fzf.vim+8 added-5 removed
52 unmodified lines
53 function! s:wrap_cmds(cmds)54 return map([55 \ '@echo off',56 \ 'setlocal enabledelayedexpansion']57 \ + (has('gui_running') ? ['set TERM= > nul'] : [])58 \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])59 \ + ['endlocal'],60 \ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))61 endfunction
17 unmodified lines
79 return '^"'.substitute(escaped, '\(\\\+\)$', '\1\1', '').'^"'80endfunction8182function! fzf#shellescape(arg, ...)82 let shell = get(a:000, 0, &shell)83 let shell = get(a:000, 0, s:is_win ? 'cmd.exe' : 'sh')84 if shell =~# 'cmd.exe$'85 return s:shellesc_cmd(a:arg)86 endif87 return s:fzf_call('shellescape', a:arg)
250 unmodified lines
338 return opts339endfunction340341function! s:use_sh()341 let [shell, shellslash] = [&shell, &shellslash]342 let [shell, shellslash, shellcmdflag, shellxquote] = [&shell, &shellslash, &shellcmdflag, &shellxquote]343 if s:is_win344 set shell=cmd.exe345 set noshellslash346 let &shellcmdflag = has('nvim') ? '/s /c' : '/c'347 let &shellxquote = has('nvim') ? '"' : '('348 else349 set shell=sh350 endif348 return [shell, shellslash]351 return [shell, shellslash, shellcmdflag, shellxquote]352endfunction353354function! fzf#run(...) abort355try353 let [shell, shellslash] = s:use_sh()356 let [shell, shellslash, shellcmdflag, shellxquote] = s:use_sh()357358 let dict = exists('a:1') ? s:upgrade(a:1) : {}359 let temps = { 'result': s:fzf_tempname() }360 let optstr = s:evaluate_opts(get(dict, 'options', ''))
61 unmodified lines
422 \ : s:execute(dict, command, use_height, temps)423 call s:callback(dict, lines)424 return lines425finally423 let [&shell, &shellslash] = [shell, shellslash]426 let [&shell, &shellslash, &shellcmdflag, &shellxquote] = [shell, shellslash, shellcmdflag, shellxquote]427endtry428endfunction429430function! s:present(dict, ...)
394 unmodified lines