summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2020-09-06 22:12:51 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2020-09-06 22:15:44 +0900
commit0db65c22d369026a0a9af079bfa7e8110e850ec9 (patch)
treed339fe4de9d6ad773ece169be47a94ee9fc19a00
parentd7851356062d23250ad0fbee660a249c37460b40 (diff)
[vim] Allow specifying popup width and height in absolute integer value
Fix https://github.com/junegunn/fzf.vim/issues/1116
-rw-r--r--README-VIM.md8
-rw-r--r--doc/fzf.txt4
-rw-r--r--plugin/fzf.vim4
3 files changed, 8 insertions, 8 deletions
diff --git a/README-VIM.md b/README-VIM.md
index 89b6cd08..af514da0 100644
--- a/README-VIM.md
+++ b/README-VIM.md
@@ -290,8 +290,8 @@ When `window` entry is a dictionary, fzf will start in a popup window. The
following options are allowed:
- Required:
- - `width` [float range [0 ~ 1]]
- - `height` [float range [0 ~ 1]]
+ - `width` [float range [0 ~ 1]] or [integer range [8 ~ ]]
+ - `height` [float range [0 ~ 1]] or [integer range [4 ~ ]]
- Optional:
- `yoffset` [float default 0.5 range [0 ~ 1]]
- `xoffset` [float default 0.5 range [0 ~ 1]]
@@ -386,8 +386,8 @@ The latest versions of Vim and Neovim include builtin terminal emulator
```vim
" Required:
-" - width [float range [0 ~ 1]]
-" - height [float range [0 ~ 1]]
+" - width [float range [0 ~ 1]] or [integer range [8 ~ ]]
+" - height [float range [0 ~ 1]] or [integer range [4 ~ ]]
"
" Optional:
" - xoffset [float default 0.5 range [0 ~ 1]]
diff --git a/doc/fzf.txt b/doc/fzf.txt
index a6deda63..e88f7564 100644
--- a/doc/fzf.txt
+++ b/doc/fzf.txt
@@ -305,8 +305,8 @@ When `window` entry is a dictionary, fzf will start in a popup window. The
following options are allowed:
- Required:
- - `width` [float range [0 ~ 1]]
- - `height` [float range [0 ~ 1]]
+ - `width` [float range [0 ~ 1]] or [integer range [8 ~ ]]
+ - `height` [float range [0 ~ 1]] or [integer range [4 ~ ]]
- Optional:
- `yoffset` [float default 0.5 range [0 ~ 1]]
- `xoffset` [float default 0.5 range [0 ~ 1]]
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index b26a5455..2594bc41 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -864,9 +864,9 @@ function! s:popup(opts) abort
let ambidouble = &ambiwidth == 'double' ? 2 : 1
" Size and position
- let width = min([max([0, float2nr(&columns * a:opts.width)]), &columns])
+ let width = min([max([8, a:opts.width > 1 ? a:opts.width : float2nr(&columns * a:opts.width)]), &columns])
let width += width % ambidouble
- let height = min([max([0, float2nr(&lines * a:opts.height)]), &lines - has('nvim')])
+ let height = min([max([4, a:opts.height > 1 ? a:opts.height : float2nr(&lines * a:opts.height)]), &lines - has('nvim')])
let row = float2nr(get(a:opts, 'yoffset', 0.5) * (&lines - height))
let col = float2nr(get(a:opts, 'xoffset', 0.5) * (&columns - width))