float-preview.nvim


Ⅰ. 插件描述

Less annoying completion preview window based on neovim's floating window

Ⅱ. 基本信息

创建日期:  2019-03-06
使用用户:  17
Github星:  144
插件作者:  ncm2

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'ncm2/float-preview-nvim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'ncm2/float-preview-nvim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'ncm2/float-preview-nvim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/ncm2/float-preview.nvim

Ⅳ. 文档说明

# float-preview.nvim

With let g:float_preview#docked = 1:

asciicast

With let g:float_preview#docked = 0:

asciicast

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)
endfunction

autocmd 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.

添加新评论