Skip to content
jinzhongjia edited this page Feb 1, 2024 · 3 revisions

To use bind a key with the lua api, use require("LspUI").api, for example:

local LspUI_api = require("LspUI").api

vim.keymap.set("n", "K", LspUI_api.hover, { desc = "LSP Hover" })
vim.keymap.set("n", "<leader>ca", LspUI_api.code_action, { desc = "LSP Code Action" })
-- ...etc.
-- see more in api.lua

Or you can use command:

vim.keymap.set("n", "K", "<cmd>LspUI hover<CR>", { desc = "LSP Hover" })
vim.keymap.set("n", "<leader>ca", "<cmd>LspUI code_action<CR>", { desc = "LSP Code Action" })
--- ...etc.

Command:

  • LspUI hover: Open an LSP hover window above cursor
  • LspUI rename: Rename the symbol below the cursor
  • LspUI code_action: Open a code action selection prompt
  • LspUI diagnostic next: Go to the next diagnostic
  • LspUI diagnostic prev: Go to the previous diagnostic
  • LspUI definition: Open the definition
  • LspUI type_definition: Open the type definition
  • LspUI declaration: Open the declaration
  • LspUI reference: Open the reference
  • LspUI implementation: Open the implementation
  • LspUI inlay_hint: Quickly open or close inlay hint
Clone this wiki locally