or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

code-actions.mdcompletion.mdconfiguration.mddiagnostics.mdextensions.mdfloat-windows.mdindex.mdlists.mdnavigation.mdservice-management.md
tile.json

float-windows.mddocs/

Float Windows

Modern floating window interface for documentation, completion details, and other informational displays. Provides non-intrusive overlay windows with rich content rendering, hover information, and seamless integration with LSP features.

Capabilities

Float Window Control

Control floating window visibility, positioning, and behavior with dedicated commands and functions.

<Plug>(coc-float-hide)
    " Hide all floating windows
    " Closes hover, completion detail, and other float windows
    " Mode: Normal

<Plug>(coc-float-jump)
    " Jump to active floating window
    " Moves cursor into float window for scrolling/interaction
    " Mode: Normal

coc#float#close_all([{exclude}])
    " Close all floating windows programmatically
    " Parameters:
    "   {exclude} - array: window IDs to exclude (optional)
    " Returns: void

coc#float#has_float([{winid}])
    " Check if floating window exists
    " Parameters:
    "   {winid} - number: specific window ID (optional)
    " Returns: boolean

Usage Examples:

" Float window control mappings
nnoremap <silent> <Esc> <Plug>(coc-float-hide)
nnoremap <silent> <C-f> <Plug>(coc-float-jump)

" Hide floats on mode change
autocmd InsertEnter * call coc#float#close_all()
autocmd CmdlineEnter * call coc#float#close_all()

" Check for active floats
if coc#float#has_float()
  echo "Float window is active"
endif

" Custom float control
function! ToggleFloat()
  if coc#float#has_float()
    call coc#float#close_all()
    echo "Float windows hidden"
  else
    call CocActionAsync('doHover') 
    echo "Showing hover info"
  endif
endfunction

nnoremap <silent> <space>h :call ToggleFloat()<CR>

Float Window Scrolling

Navigate and scroll content within floating windows for detailed information review.

coc#float#scroll({forward} [, {amount}])
    " Scroll floating window content
    " Parameters:
    "   {forward} - boolean: true for down, false for up
    "   {amount} - number: scroll amount (optional, default: 4)
    " Returns: boolean - success status

coc#float#jump()
    " Jump cursor into floating window
    " Enables normal Vim navigation within float
    " Returns: void

Usage Examples:

" Float scrolling mappings
nnoremap <silent> <C-j> :call coc#float#scroll(1)<CR>
nnoremap <silent> <C-k> :call coc#float#scroll(0)<CR>

" Page scrolling in floats
nnoremap <silent> <C-d> :call coc#float#scroll(1, 10)<CR>
nnoremap <silent> <C-u> :call coc#float#scroll(0, 10)<CR>

" Jump into float for detailed navigation
nnoremap <silent> <space>j <Plug>(coc-float-jump)

" Smart scrolling - scroll float if exists, otherwise scroll buffer
function! SmartScroll(direction)
  if coc#float#has_float()
    call coc#float#scroll(a:direction == 'down' ? 1 : 0)
  else
    execute 'normal! ' . (a:direction == 'down' ? "\<C-d>" : "\<C-u>")
  endif
endfunction

nnoremap <silent> <C-d> :call SmartScroll('down')<CR>
nnoremap <silent> <C-u> :call SmartScroll('up')<CR>

Hover and Documentation

Display hover information, documentation, and contextual help in floating windows.

CocAction('doHover')
    " Show hover information at cursor position
    " Displays LSP hover info in floating window
    " Returns: void

CocAction('definitionHover')
    " Show definition preview in hover window
    " Alternative to jumping to definition
    " Returns: void

CocAction('signature')
    " Show function signature help
    " Displays parameter information while typing
    " Returns: void

Usage Examples:

" Hover information mapping
nnoremap <silent> K :call CocActionAsync('doHover')<CR>

" Show signature help in insert mode
inoremap <silent> <C-h> <C-r>=CocActionAsync('signature')<CR>

" Auto-show hover on cursor hold
autocmd CursorHold * silent call CocActionAsync('doHover')
autocmd CursorHoldI * silent call CocActionAsync('signature')

" Definition preview without jumping
nnoremap <silent> <space>K :call CocActionAsync('definitionHover')<CR>

" Custom hover with fallback
function! SmartHover()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    " Fallback to built-in help
    execute 'help ' . expand('<cword>')
  endif
endfunction

nnoremap <silent> H :call SmartHover()<CR>

Float Window Configuration

Customize floating window appearance, behavior, and positioning through configuration options.

" Float window configuration options:
"coc.preferences.useFloatWindow": boolean        // Enable float windows
"coc.preferences.hoverTarget": "preview" | "echo" | "float"  // Hover target
"coc.preferences.previewAutoClose": boolean      // Auto-close preview
"coc.preferences.previewMaxHeight": number       // Max preview height
"coc.preferences.floatFactory": boolean          // Use float factory

" Appearance settings:
"coc.preferences.floatConfig": {
  "winblend": number,                           // Window transparency
  "border": boolean,                            // Show border
  "highlight": string                           // Border highlight group
}

Usage Examples:

" Float window customization
{
  "coc.preferences.useFloatWindow": true,
  "coc.preferences.hoverTarget": "float",
  "coc.preferences.previewAutoClose": false,
  "coc.preferences.previewMaxHeight": 20,
  "coc.preferences.floatFactory": true,
  
  "coc.preferences.floatConfig": {
    "winblend": 10,
    "border": true,
    "highlight": "CocFloating"
  }
}

" Conditional float window usage
if has('nvim-0.5.0')
  call coc#config('coc.preferences.useFloatWindow', v:true)
  call coc#config('coc.preferences.floatConfig', {'winblend': 15})
else
  call coc#config('coc.preferences.hoverTarget', 'preview')
endif

Float Window Highlight Groups

Customize float window appearance through highlight groups and color schemes.

" Float window highlight groups:
" CocFloating          " Float window background
" CocFloatingBorder    " Float window border  
" CocErrorFloat        " Error float background
" CocWarningFloat      " Warning float background
" CocInfoFloat         " Info float background
" CocHintFloat         " Hint float background

" Documentation highlight groups:
" CocMarkdownLink      " Markdown links in float
" CocMarkdownCode      " Code blocks in float  
" CocMarkdownHeader    " Headers in float

Usage Examples:

" Custom float window colors
hi CocFloating guibg=#1e1e1e guifg=#ffffff
hi CocFloatingBorder guifg=#569cd6
hi CocErrorFloat guibg=#3c1f1f guifg=#f44747
hi CocWarningFloat guibg=#3c3c1f guifg=#ffcc02
hi CocInfoFloat guibg=#1f2f3c guifg=#3794ff
hi CocHintFloat guibg=#1f3c1f guifg=#4ec9b0

" Markdown styling in floats
hi CocMarkdownLink guifg=#569cd6 gui=underline
hi CocMarkdownCode guibg=#2d2d30 guifg=#d4d4d4
hi CocMarkdownHeader guifg=#4fc1ff gui=bold

" Transparency support for modern terminals
if has('nvim-0.5.0') || has('patch-8.2.0750')
  hi CocFloating guibg=NONE ctermbg=NONE
  set winblend=20
endif

Float Window Events and Automation

Handle float window events and create automation for improved user experience.

" Float window autocmd events:
" User CocOpenFloat    " When float window opens
" WinEnter            " When entering float window  
" WinLeave            " When leaving float window

" Event handlers for float windows:
autocmd User CocOpenFloat call OnFloatOpen()
autocmd WinEnter * if &ft == 'coc-float' | call OnFloatEnter() | endif

Usage Examples:

" Float window event handling
augroup coc_float_events
  autocmd!
  autocmd User CocOpenFloat call OnFloatOpen()
  autocmd WinEnter * if &ft == 'coc-float' | call OnFloatEnter() | endif
  autocmd WinLeave * if &ft == 'coc-float' | call OnFloatLeave() | endif
augroup end

function! OnFloatOpen()
  " Custom behavior when float opens
  echo "Float window opened"
endfunction

function! OnFloatEnter()
  " Setup float-specific mappings
  nnoremap <buffer> <silent> q :close<CR>
  nnoremap <buffer> <silent> <Esc> :close<CR>
  setlocal wrap
endfunction

function! OnFloatLeave()
  " Cleanup when leaving float
  echo "Left float window"
endfunction

" Auto-hide floats on certain events
autocmd FocusLost * call coc#float#close_all()
autocmd VimResized * call coc#float#close_all()
autocmd TabLeave * call coc#float#close_all()

Integration with Other Features

Integrate floating windows with other coc.nvim features for enhanced functionality.

" Float integration with other features:
CocAction('showIncomingCalls')          // Show incoming calls in float
CocAction('showOutgoingCalls')          // Show outgoing calls in float  
CocAction('showCallHierarchy')          // Show call hierarchy in float
CocAction('showTypeHierarchy')          // Show type hierarchy in float

Usage Examples:

" Enhanced navigation with floats
nnoremap <silent> <space>ic :call CocActionAsync('showIncomingCalls')<CR>
nnoremap <silent> <space>oc :call CocActionAsync('showOutgoingCalls')<CR>
nnoremap <silent> <space>ch :call CocActionAsync('showCallHierarchy')<CR>
nnoremap <silent> <space>th :call CocActionAsync('showTypeHierarchy')<CR>

" Smart documentation display
function! ShowDocumentation()
  if &filetype == 'vim' || &filetype == 'help'
    execute 'h ' . expand('<cword>')
  elseif coc#rpc#ready()
    call CocActionAsync('doHover')
  else
    execute '!' . &keywordprg . ' ' . expand('<cword>')
  endif
endfunction

nnoremap <silent> K :call ShowDocumentation()<CR>

" Context-aware float behavior
function! ContextualFloat()
  let word = expand('<cword>')
  let line = getline('.')
  
  if line =~# 'function\|class\|def'
    call CocActionAsync('showSignatureHelp')
  elseif word =~# '^[A-Z]'
    call CocActionAsync('showTypeHierarchy')
  else
    call CocActionAsync('doHover')
  endif
endfunction

nnoremap <silent> <space>? :call ContextualFloat()<CR>