Usage Guide

Mappings

Default Mappings

To use the built-in keybindings, set default_mappings = true in your configuration.

Key Action
gpd Goto Preview Definition
gpt Goto Preview Type Definition
gpi Goto Preview Implementation
gpD Goto Preview Declaration
gpr Goto Preview References
gP Close all preview windows

Custom Mappings

If default_mappings = false, you can define your own keybindings using the Lua API:

vim.keymap.set("n", "<leader>pd", require('goto-preview').goto_preview_definition, {noremap=true})
vim.keymap.set("n", "<leader>pi", require('goto-preview').goto_preview_implementation, {noremap=true})
-- etc...

Window Resizing

If resizing_mappings = true is set in the config, the following mappings are applied when inside a preview window:

  • <left> / <right> / <up> / <down>: Resize the floating window using Ctrl-w <, >, -, + logic.

Window Manipulation

The floating windows created by this plugin are standard Neovim windows. You can use standard window movement commands (<C-w>h, <C-w>j, etc.) to navigate between the preview and your main buffer.

If focus_on_open is true (default), the cursor immediately jumps to the new floating window.

Closing Windows

  • Manual: You can close the current preview window with :q or :close.
  • Programmatic: Use require('goto-preview').close_all_win().
  • Dismiss on Move: If dismiss_on_move = true is configured, simply moving your cursor in the parent window will close the preview.