Custom Input UI

Goto Preview includes a feature to override the native vim.ui.input interface with a floating window style that matches your preview windows.

Enabling

To enable this feature, set vim_ui_input = true in your setup:

require('goto-preview').setup {
  vim_ui_input = true
}

Behavior

When enabled, any plugin or Neovim command that calls vim.ui.input (like LSP rename actions) will open a small floating window at your cursor position.

Key Controls in Input Window:

  • <CR> (Enter): Confirm input.
  • <Esc>: Cancel input.

Technical Details

This implementation:

  1. Creates a scratch buffer.
  2. Calculates window width based on content (min 20, max 120 columns).
  3. Sets normal and insert mode mappings for Confirm and Cancel actions.
  4. Restores the original vim.ui.input if the plugin is unloaded (though typically this override persists for the session).