Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ncm2/float-preview.nvim
Less annoying completion preview window based on neovim's floating window
https://github.com/ncm2/float-preview.nvim
Last synced: 3 months ago
JSON representation
Less annoying completion preview window based on neovim's floating window
- Host: GitHub
- URL: https://github.com/ncm2/float-preview.nvim
- Owner: ncm2
- License: mit
- Created: 2019-03-06T13:41:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-04T03:47:40.000Z (over 1 year ago)
- Last Synced: 2024-07-05T13:54:55.450Z (4 months ago)
- Language: Vim Script
- Homepage:
- Size: 15.6 KB
- Stars: 235
- Watchers: 6
- Forks: 3
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# float-preview.nvim
- Completion preview window based on neovim's [floating window](https://github.com/neovim/neovim/pull/6619)
With `let g:float_preview#docked = 1`:
[![asciicast](https://asciinema.org/a/232057.svg)](https://asciinema.org/a/232057)
With `let g:float_preview#docked = 0`:
[![asciicast](https://asciinema.org/a/234259.svg)](https://asciinema.org/a/234259)
Note that this is a general purpose plugin instead of ncm2 only, it applies to
`:help complete-items` with `info` field available.## Why ?
Vim's builtin `set completeopt+=preview` is annoying. When the preview window
is opened, it simply pumps text out of my eye spot. Which makes it very
disturbing and actually unusable.This plugin uses neovim's floating Window, it should never pumps text out of
your eye spot.## Config && API
### `g:float_preview#win`
When the floating window opens, float-preview.nvim will emit a custom autocommand which you can use to further configure the opened window. The window ID will be exposed through `g:float_preview#win`.
Example: a function that disables numbers and the cursor line in the opened window.
```
function! DisableExtras()
call nvim_win_set_option(g:float_preview#win, 'number', v:false)
call nvim_win_set_option(g:float_preview#win, 'relativenumber', v:false)
call nvim_win_set_option(g:float_preview#win, 'cursorline', v:false)
endfunctionautocmd User FloatPreviewWinOpen call DisableExtras()
```### `g:float_preview#docked`
If set to 0, the preview window will be displayed beside the popup menu.
Defaults to `1`.### `g:float_preview#winhl`
Custom highlights for preview window. See `:help 'winhl'` for more
information.### `g:float_preview#max_height`
Height of the preview window. Defaults to `:help 'previewheight'`.
### `g:float_preview#max_width`
Only used when `g:float_preview#docked == 0`. Max width of the preview window.
Defaults to `50`.### `g:float_preview#auto_close`
Defaults to 1. Only used when `g:float_preview#docked == 1`.
If you don't want this plugin auto closing the preview window,
use `:let g:float_preview#auto_close = 0` and `call float_preview#close()` by
yourself.