summaryrefslogtreecommitdiff
path: root/plugin/fzf.vim
diff options
context:
space:
mode:
authormsr1k <msr0210+github@gmail.com>2019-12-15 18:25:58 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2019-12-15 18:25:58 +0900
commita9906c7c2910b87cc97b9bb8668acfb457152e08 (patch)
treeab9e7613d68251cde1c1628f7e6844ef9e3800b1 /plugin/fzf.vim
parent9fefe08b3fe9b1005e13aecc93e8276dbf4b1de8 (diff)
downloadfzf-a9906c7c2910b87cc97b9bb8668acfb457152e08.tar.gz
Add MSYS2 support as a vim plugin (#1677)
* 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
Diffstat (limited to 'plugin/fzf.vim')
-rw-r--r--plugin/fzf.vim13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index fb12d9b6..6e45d1a5 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -54,6 +54,7 @@ if s:is_win
return map([
\ '@echo off',
\ 'setlocal enabledelayedexpansion']
+ \ + (has('gui_running') ? ['set TERM= > nul'] : [])
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
\ + ['endlocal'],
\ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
@@ -79,7 +80,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' : 'sh')
if shell =~# 'cmd.exe$'
return s:shellesc_cmd(a:arg)
endif
@@ -338,19 +339,21 @@ function! fzf#wrap(...)
endfunction
function! s:use_sh()
- let [shell, shellslash] = [&shell, &shellslash]
+ let [shell, shellslash, shellcmdflag, shellxquote] = [&shell, &shellslash, &shellcmdflag, &shellxquote]
if s:is_win
set shell=cmd.exe
set noshellslash
+ let &shellcmdflag = has('nvim') ? '/s /c' : '/c'
+ let &shellxquote = has('nvim') ? '"' : '('
else
set shell=sh
endif
- return [shell, shellslash]
+ return [shell, shellslash, shellcmdflag, shellxquote]
endfunction
function! fzf#run(...) abort
try
- let [shell, shellslash] = s:use_sh()
+ let [shell, shellslash, shellcmdflag, shellxquote] = s:use_sh()
let dict = exists('a:1') ? s:upgrade(a:1) : {}
let temps = { 'result': s:fzf_tempname() }
@@ -420,7 +423,7 @@ try
call s:callback(dict, lines)
return lines
finally
- let [&shell, &shellslash] = [shell, shellslash]
+ let [&shell, &shellslash, &shellcmdflag, &shellxquote] = [shell, shellslash, shellcmdflag, shellxquote]
endtry
endfunction