chore: update inputs
This commit is contained in:
parent
9e2c4205d9
commit
6bcccc1ff9
7 changed files with 334 additions and 342 deletions
|
|
@ -21,76 +21,80 @@ capabilities.didChangeWatchedFiles = {
|
|||
|
||||
local lspconfig = require("lspconfig")
|
||||
local on_attach_def = function(client, bufnr)
|
||||
require("which-key").register({
|
||||
K = {
|
||||
vim.lsp.buf.hover,
|
||||
"Hover",
|
||||
require("which-key").add({
|
||||
{ "<leader>c", buffer = bufnr, group = "code" },
|
||||
{
|
||||
"<leader>cr",
|
||||
function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end,
|
||||
buffer = bufnr,
|
||||
desc = "Rename",
|
||||
expr = true,
|
||||
replace_keycodes = false,
|
||||
},
|
||||
["<leader>"] = {
|
||||
c = {
|
||||
name = "code",
|
||||
c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } },
|
||||
r = {
|
||||
function()
|
||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||
end,
|
||||
"Rename",
|
||||
expr = true,
|
||||
},
|
||||
f = {
|
||||
function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end,
|
||||
"Format (lsp)",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
},
|
||||
t = {
|
||||
l = {
|
||||
function()
|
||||
lsp_lines.toggle()
|
||||
if vim.diagnostic.is_disabled() then
|
||||
vim.diagnostic.enable()
|
||||
else
|
||||
vim.diagnostic.disable()
|
||||
end
|
||||
end,
|
||||
"LSP lines",
|
||||
},
|
||||
i = {
|
||||
function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
end,
|
||||
"LSP inlay hints",
|
||||
},
|
||||
},
|
||||
{
|
||||
"<leader>ti",
|
||||
function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||
end,
|
||||
buffer = bufnr,
|
||||
desc = "LSP inlay hints",
|
||||
},
|
||||
g = {
|
||||
d = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_definitions({ reuse_win = true })
|
||||
end,
|
||||
"Goto definition",
|
||||
},
|
||||
t = {
|
||||
function()
|
||||
require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
|
||||
end,
|
||||
"Goto type definition",
|
||||
},
|
||||
r = { "<cmd>Telescope lsp_references<cr>", "Goto references" },
|
||||
D = { vim.lsp.buf.declaration, "Goto declaration" },
|
||||
I = { "<cmd>Telescope lsp_implementations<cr>", "Goto implementation" },
|
||||
K = { vim.lsp.buf.signature_help, "Signature help" },
|
||||
{
|
||||
"<leader>tl",
|
||||
function()
|
||||
lsp_lines.toggle()
|
||||
if vim.diagnostic.is_disabled() then
|
||||
vim.diagnostic.enable()
|
||||
else
|
||||
vim.diagnostic.disable()
|
||||
end
|
||||
end,
|
||||
buffer = bufnr,
|
||||
desc = "LSP lines",
|
||||
},
|
||||
["["] = {
|
||||
d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
|
||||
{ "K", vim.lsp.buf.hover, buffer = bufnr, desc = "Hover" },
|
||||
{ "[d", vim.diagnostic.goto_prev, buffer = bufnr, desc = "Previous diagnostic" },
|
||||
{ "]d", vim.diagnostic.goto_next, buffer = bufnr, desc = "Next diagnostic" },
|
||||
{ "gD", vim.lsp.buf.declaration, buffer = bufnr, desc = "Goto declaration" },
|
||||
{ "gI", "<cmd>Telescope lsp_implementations<cr>", buffer = bufnr, desc = "Goto implementation" },
|
||||
{ "gK", vim.lsp.buf.signature_help, buffer = bufnr, desc = "Signature help" },
|
||||
{
|
||||
"gd",
|
||||
function()
|
||||
require("telescope.builtin").lsp_definitions({ reuse_win = true })
|
||||
end,
|
||||
buffer = bufnr,
|
||||
desc = "Goto definition",
|
||||
},
|
||||
["]"] = {
|
||||
d = { vim.diagnostic.goto_next, "Next diagnostic" },
|
||||
},
|
||||
}, { buffer = bufnr, silent = true })
|
||||
{ "gr", "<cmd>Telescope lsp_references<cr>", buffer = bufnr, desc = "Goto references" },
|
||||
{
|
||||
"gt",
|
||||
|
||||
function()
|
||||
require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
|
||||
end,
|
||||
buffer = bufnr,
|
||||
desc = "Goto type definition",
|
||||
},
|
||||
{
|
||||
"<leader>cc",
|
||||
require("actions-preview").code_actions,
|
||||
buffer = bufnr,
|
||||
desc = "Code action",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"<leader>cf",
|
||||
function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end,
|
||||
buffer = bufnr,
|
||||
desc = "Format (lsp)",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
})
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
local slow_lsp_servers = {
|
||||
"rust_analyzer",
|
||||
|
|
@ -125,7 +129,7 @@ local servers = {
|
|||
"gopls",
|
||||
"nil_ls",
|
||||
"pylsp",
|
||||
"ruff_lsp",
|
||||
"ruff",
|
||||
"templ",
|
||||
"typst_lsp",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue