|
|
@ -184,6 +184,7 @@ The following table summarizes the available options.
|
|
|
|
| `dir` | string | Working directory |
|
|
|
|
| `dir` | string | Working directory |
|
|
|
|
| `up`/`down`/`left`/`right` | number/string | (Layout) Window position and size (e.g. `20`, `50%`) |
|
|
|
|
| `up`/`down`/`left`/`right` | number/string | (Layout) Window position and size (e.g. `20`, `50%`) |
|
|
|
|
| `window` (Vim 8 / Neovim) | string | (Layout) Command to open fzf window (e.g. `vertical aboveleft 30new`) |
|
|
|
|
| `window` (Vim 8 / Neovim) | string | (Layout) Command to open fzf window (e.g. `vertical aboveleft 30new`) |
|
|
|
|
|
|
|
|
| `window` (Vim 8 / Neovim) | dict | (Layout) Popup window settings (e.g. `{'width': 0.9, 'height': 0.6}`) |
|
|
|
|
|
|
|
|
|
|
|
|
`options` entry can be either a string or a list. For simple cases, string
|
|
|
|
`options` entry can be either a string or a list. For simple cases, string
|
|
|
|
should suffice, but prefer to use list type to avoid escaping issues.
|
|
|
|
should suffice, but prefer to use list type to avoid escaping issues.
|
|
|
@ -193,6 +194,16 @@ call fzf#run({'options': '--reverse --prompt "C:\\Program Files\\"'})
|
|
|
|
call fzf#run({'options': ['--reverse', '--prompt', 'C:\Program Files\']})
|
|
|
|
call fzf#run({'options': ['--reverse', '--prompt', 'C:\Program Files\']})
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When `window` entry is a dictionary, fzf will start in a popup window. The
|
|
|
|
|
|
|
|
following options are allowed:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Required:
|
|
|
|
|
|
|
|
- `width` [float]
|
|
|
|
|
|
|
|
- `height` [float]
|
|
|
|
|
|
|
|
- Optional:
|
|
|
|
|
|
|
|
- `highlight` [string default `'Comment'`]: Highlight group for border
|
|
|
|
|
|
|
|
- `rounded` [boolean default `v:true`]: Use rounded border
|
|
|
|
|
|
|
|
|
|
|
|
`fzf#wrap`
|
|
|
|
`fzf#wrap`
|
|
|
|
----------
|
|
|
|
----------
|
|
|
|
|
|
|
|
|
|
|
@ -276,44 +287,17 @@ The latest versions of Vim and Neovim include builtin terminal emulator
|
|
|
|
- On Terminal Vim with a non-default layout
|
|
|
|
- On Terminal Vim with a non-default layout
|
|
|
|
- `call fzf#run({'left': '30%'})` or `let g:fzf_layout = {'left': '30%'}`
|
|
|
|
- `call fzf#run({'left': '30%'})` or `let g:fzf_layout = {'left': '30%'}`
|
|
|
|
|
|
|
|
|
|
|
|
#### Starting fzf in Neovim floating window
|
|
|
|
#### Starting fzf in a popup window
|
|
|
|
|
|
|
|
|
|
|
|
```vim
|
|
|
|
```vim
|
|
|
|
" Using floating windows of Neovim to start fzf
|
|
|
|
" Required:
|
|
|
|
if has('nvim')
|
|
|
|
" - width [float]
|
|
|
|
function! FloatingFZF(width, height, border_highlight)
|
|
|
|
" - height [float]
|
|
|
|
function! s:create_float(hl, opts)
|
|
|
|
"
|
|
|
|
let buf = nvim_create_buf(v:false, v:true)
|
|
|
|
" Optional:
|
|
|
|
let opts = extend({'relative': 'editor', 'style': 'minimal'}, a:opts)
|
|
|
|
" - highlight [string default 'Comment']: Highlight group for border
|
|
|
|
let win = nvim_open_win(buf, v:true, opts)
|
|
|
|
" - rounded [boolean default v:true]: Use rounded border
|
|
|
|
call setwinvar(win, '&winhighlight', 'NormalFloat:'.a:hl)
|
|
|
|
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
|
|
|
|
call setwinvar(win, '&colorcolumn', '')
|
|
|
|
|
|
|
|
return buf
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Size and position
|
|
|
|
|
|
|
|
let width = float2nr(&columns * a:width)
|
|
|
|
|
|
|
|
let height = float2nr(&lines * a:height)
|
|
|
|
|
|
|
|
let row = float2nr((&lines - height) / 2)
|
|
|
|
|
|
|
|
let col = float2nr((&columns - width) / 2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Border
|
|
|
|
|
|
|
|
let top = '╭' . repeat('─', width - 2) . '╮'
|
|
|
|
|
|
|
|
let mid = '│' . repeat(' ', width - 2) . '│'
|
|
|
|
|
|
|
|
let bot = '╰' . repeat('─', width - 2) . '╯'
|
|
|
|
|
|
|
|
let border = [top] + repeat([mid], height - 2) + [bot]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Draw frame
|
|
|
|
|
|
|
|
let s:frame = s:create_float(a:border_highlight, {'row': row, 'col': col, 'width': width, 'height': height})
|
|
|
|
|
|
|
|
call nvim_buf_set_lines(s:frame, 0, -1, v:true, border)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Draw viewport
|
|
|
|
|
|
|
|
call s:create_float('Normal', {'row': row + 1, 'col': col + 2, 'width': width - 4, 'height': height - 2})
|
|
|
|
|
|
|
|
autocmd BufWipeout <buffer> execute 'bwipeout' s:frame
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let g:fzf_layout = { 'window': 'call FloatingFZF(0.9, 0.6, "Comment")' }
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
#### Hide statusline
|
|
|
|
#### Hide statusline
|
|
|
|