mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-22 19:09:00 +00:00
[vim] Automatically set RUNEWIDTH_EASTASIAN=1 when &ambiwidth == double
This commit is contained in:
parent
a6d6cdd165
commit
b46e40e86b
@ -92,6 +92,7 @@ CHANGELOG
|
|||||||
for `--border-label`)
|
for `--border-label`)
|
||||||
- Better support for (Windows) terminals where each box-drawing character
|
- Better support for (Windows) terminals where each box-drawing character
|
||||||
takes 2 columns. Set `RUNEWIDTH_EASTASIAN` environment variable to `1`.
|
takes 2 columns. Set `RUNEWIDTH_EASTASIAN` environment variable to `1`.
|
||||||
|
- On Vim, the variable will be automatically set if `&ambiwidth` is `double`
|
||||||
- Behavior changes
|
- Behavior changes
|
||||||
- fzf will always execute the preview command if the command template
|
- fzf will always execute the preview command if the command template
|
||||||
contains `{q}` even when it's empty. If you prefer the old behavior,
|
contains `{q}` even when it's empty. If you prefer the old behavior,
|
||||||
|
@ -830,6 +830,17 @@ if exists(':tnoremap')
|
|||||||
tnoremap <silent> <Plug>(fzf-normal) <C-\><C-n>
|
tnoremap <silent> <Plug>(fzf-normal) <C-\><C-n>
|
||||||
endif
|
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
|
function! s:execute_term(dict, command, temps) abort
|
||||||
let winrest = winrestcmd()
|
let winrest = winrestcmd()
|
||||||
let pbuf = bufnr('')
|
let pbuf = bufnr('')
|
||||||
@ -899,6 +910,7 @@ function! s:execute_term(dict, command, temps) abort
|
|||||||
endif
|
endif
|
||||||
let command .= s:term_marker
|
let command .= s:term_marker
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
|
call s:handle_ambidouble(fzf)
|
||||||
call termopen(command, fzf)
|
call termopen(command, fzf)
|
||||||
else
|
else
|
||||||
let term_opts = {'exit_cb': function(fzf.on_exit)}
|
let term_opts = {'exit_cb': function(fzf.on_exit)}
|
||||||
@ -910,6 +922,7 @@ function! s:execute_term(dict, command, temps) abort
|
|||||||
else
|
else
|
||||||
let term_opts.curwin = 1
|
let term_opts.curwin = 1
|
||||||
endif
|
endif
|
||||||
|
call s:handle_ambidouble(term_opts)
|
||||||
let fzf.buf = term_start([&shell, &shellcmdflag, command], term_opts)
|
let fzf.buf = term_start([&shell, &shellcmdflag, command], term_opts)
|
||||||
if is_popup && exists('#TerminalWinOpen')
|
if is_popup && exists('#TerminalWinOpen')
|
||||||
doautocmd <nomodeline> TerminalWinOpen
|
doautocmd <nomodeline> TerminalWinOpen
|
||||||
|
Loading…
Reference in New Issue
Block a user