diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-16 22:44:22 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-01-16 22:44:22 +0900 |
commit | a6d6cdd1654f5e8c7d700bb491d9506ad60bec32 (patch) | |
tree | 1be637ec4e17b6f7c3ea998d313cec09532982f2 | |
parent | dc8da605f9b250c9b74dcbc4d907ff17e5341424 (diff) |
[vim] Use system-default border style
* 'rounded' on non-Windows platforms
* 'sharp' on Windows
-rw-r--r-- | README-VIM.md | 2 | ||||
-rw-r--r-- | doc/fzf.txt | 2 | ||||
-rw-r--r-- | plugin/fzf.vim | 13 |
3 files changed, 10 insertions, 7 deletions
diff --git a/README-VIM.md b/README-VIM.md index 8d89de57..e8d678e8 100644 --- a/README-VIM.md +++ b/README-VIM.md @@ -312,7 +312,7 @@ following options are allowed: - `yoffset` [float default 0.5 range [0 ~ 1]] - `xoffset` [float default 0.5 range [0 ~ 1]] - `relative` [boolean default v:false] - - `border` [string default `rounded`]: Border style + - `border` [string default `rounded` (`sharp` on Windows)]: Border style - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]` `fzf#wrap` diff --git a/doc/fzf.txt b/doc/fzf.txt index 94857232..f4ca6788 100644 --- a/doc/fzf.txt +++ b/doc/fzf.txt @@ -325,7 +325,7 @@ following options are allowed: - `yoffset` [float default 0.5 range [0 ~ 1]] - `xoffset` [float default 0.5 range [0 ~ 1]] - `relative` [boolean default v:false] - - `border` [string default `rounded`]: Border style + - `border` [string default `rounded` (`sharp` on Windows)]: Border style - `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]` diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 7d4d8fee..7a754515 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -511,7 +511,10 @@ try let height = s:calc_size(&lines, dict.down, dict) let optstr .= ' --height='.height endif - let optstr .= s:border_opt(get(dict, 'window', 0)) + " Respect --border option given in 'options' + if stridx(optstr, '--border') < 0 && stridx(optstr, '--no-border') < 0 + let optstr .= s:border_opt(get(dict, 'window', 0)) + endif let prev_default_command = $FZF_DEFAULT_COMMAND if len(source_command) let $FZF_DEFAULT_COMMAND = source_command @@ -755,9 +758,9 @@ function! s:border_opt(window) endif " Border style - let style = tolower(get(a:window, 'border', 'rounded')) - if !has_key(a:window, 'border') && !get(a:window, 'rounded', 1) - let style = 'sharp' + let style = tolower(get(a:window, 'border', '')) + if !has_key(a:window, 'border') && has_key(a:window, 'rounded') + let style = a:window.rounded ? 'rounded' : 'sharp' endif if style == 'none' || style == 'no' return '' @@ -765,7 +768,7 @@ function! s:border_opt(window) " For --border styles, we need fzf 0.24.0 or above call fzf#exec('0.24.0') - let opt = ' --border=' . style + let opt = ' --border ' . style if has_key(a:window, 'highlight') let color = s:get_color('fg', a:window.highlight) if len(color) |