diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-17 00:57:53 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-17 01:03:16 +0900 |
commit | b46e40e86b9580ec43a6ce62d49c59d7748c3176 (patch) | |
tree | 5e6258ff7810da9d78c84116270fc298adc43d59 /plugin | |
parent | a6d6cdd1654f5e8c7d700bb491d9506ad60bec32 (diff) |
[vim] Automatically set RUNEWIDTH_EASTASIAN=1 when &ambiwidth == double
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/fzf.vim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 7a754515..06c3a7f6 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -830,6 +830,17 @@ if exists(':tnoremap') tnoremap <silent> <Plug>(fzf-normal) <C-\><C-n> endif +let s:warned = 0 +function! s:handle_ambidouble(dict) + if &ambiwidth == 'double' + let a:dict.env = { 'RUNEWIDTH_EASTASIAN': '1' } + elseif !s:warned && $RUNEWIDTH_EASTASIAN == '1' && &ambiwidth !=# 'double' + call s:warn("$RUNEWIDTH_EASTASIAN is '1' but &ambiwidth is not 'double'") + 2sleep + let s:warned = 1 + endif +endfunction + function! s:execute_term(dict, command, temps) abort let winrest = winrestcmd() let pbuf = bufnr('') @@ -899,6 +910,7 @@ function! s:execute_term(dict, command, temps) abort endif let command .= s:term_marker if has('nvim') + call s:handle_ambidouble(fzf) call termopen(command, fzf) else let term_opts = {'exit_cb': function(fzf.on_exit)} @@ -910,6 +922,7 @@ function! s:execute_term(dict, command, temps) abort else let term_opts.curwin = 1 endif + call s:handle_ambidouble(term_opts) let fzf.buf = term_start([&shell, &shellcmdflag, command], term_opts) if is_popup && exists('#TerminalWinOpen') doautocmd <nomodeline> TerminalWinOpen |