Floating Windows
Use and configure coc.nvim floating windows and Vim popups, including scrolling, focus, closing, borders, related commands, variables, and highlights.
FLOATING WINDOWS
Floating windows/popups use coc's floating window API (see coc-floating) on
Neovim and Vim's popupwin on Vim.
Scroll floating windows
See coc#float#has_scroll() for example.
Note: use coc#pum#scroll() for scroll popup menu.
Close floating windows
To close all floating windows/popups use coc#float#close_all() or
popup_clear() on Vim. On Neovim you can also use <CTRL-w>o, which closes
all split windows as well.
To close single floating window/popup, use coc#float#close().
Focus floating windows
On Neovim, <CTRL-w>w (or <Plug>(coc-float-jump)) can focus a floating
window that was just created (if it's focusable). Popups on Vim can't be
focused unless they use a terminal buffer.
Configure floating windows
To set custom window options when a floating window is created, use the
CocOpenFloat or CocOpenFloatPrompt autocommand.
Related variables
Related highlight groups
CocFloatingFor floating window background.CocFloatBorderDefault border highlight group of floating window.CocFloatDividingLineFor dividing lines.CocFloatActiveFor active parts.CocMenuSelFor selected line.
To customize floating windows used by popup menu, use:
For floating windows created around the cursor, such as diagnostics, hover,
and signature help, use coc-config-floatFactory-floatConfig for common
float configurations. For further customization, use:
To customize dialog windows, use coc-config-dialog.
To customize notification windows, use coc-config-notification.
Configure coc-preferences-enableMessageDialog to show non-interactive or
interactive messages to the user as notifications. To enable more flexible
user interaction with messages, check coc-preferences-messageDialogKind and
coc-preferences-messageReportKind.
Use coc-preferences-messageDialogKind to configure how interactive messages
that require user input are shown to the user. This configuration supersedes
coc-preferences-enableMessageDialog.
Use coc-preferences-messageReportKind to configure how regular
non-interactive messages are reported to the user.
Vim popups and Neovim floats
coc.nvim uses Neovim floating windows and Vim popupwin windows as the editor-specific primitives. The same coc.nvim float commands and settings are exposed through each editor, but focus behavior is different:
| Editor | Window primitive | Focus behavior |
|---|---|---|
| Neovim | coc.nvim floating window | <C-w>w or <Plug>(coc-float-jump) can focus a newly created float when it is focusable. |
| Vim | Vim popupwin | A popup cannot be focused unless it uses a terminal buffer. |
Use coc#float#close_all() or Vim popup_clear() to close all coc.nvim floating UI. Keep editor-specific mappings in your own configuration; do not assume a Vim popup can receive normal window focus.