mirror of
https://github.com/aminnairi/dotfiles.git
synced 2026-09-14 19:12:13 +02:00
using the new format for which-key
This commit is contained in:
@@ -13,27 +13,10 @@ return {
|
||||
local whichKey = require("which-key")
|
||||
|
||||
whichKey.register({
|
||||
"<leader>b",
|
||||
desc = "Barbar",
|
||||
{
|
||||
"<leader>bc",
|
||||
desc = "Barbar Close",
|
||||
{
|
||||
"<leader>bcc",
|
||||
"<cmd>BufferCloseAllButCurrent<cr>",
|
||||
desc = "Barbar Close All But Current"
|
||||
},
|
||||
{
|
||||
"<leader>bcl",
|
||||
"<cmd>BufferCloseAllBuffersLeft<cr>",
|
||||
desc = "Barbar Close All Buffers Left"
|
||||
},
|
||||
{
|
||||
"<leader>bcr",
|
||||
"<cmd>BufferCloseAllBuffersRight<cr>",
|
||||
desc = "Barbar Close All Buffers Right"
|
||||
}
|
||||
},
|
||||
{ "", "<leader>bcl", desc = "<cmd>BufferCloseAllBuffersLeft<cr>" },
|
||||
{ "", desc = "<leader>bc" },
|
||||
{ "", "<leader>bcr", desc = "<cmd>BufferCloseAllBuffersRight<cr>" },
|
||||
{ "", "<leader>bcc", desc = "<cmd>BufferCloseAllButCurrent<cr>" },
|
||||
})
|
||||
|
||||
map("n", "<A-,>", "<Cmd>BufferPrevious<CR>", opts)
|
||||
|
||||
@@ -19,105 +19,22 @@ return {
|
||||
|
||||
local on_attach = function(_, buffer)
|
||||
whichKey.register({
|
||||
["<leader>l"] = {
|
||||
name = "LSP",
|
||||
d = {
|
||||
name = "LSP Diagnostic",
|
||||
o = {
|
||||
function()
|
||||
vim.diagnostic.open_float()
|
||||
end,
|
||||
"Open LSP diagnostic",
|
||||
},
|
||||
p = {
|
||||
function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end,
|
||||
"Previous LSP diagnostic",
|
||||
},
|
||||
n = {
|
||||
function()
|
||||
vim.diagnostic.goto_next()
|
||||
end,
|
||||
"Next LSP diagnostic",
|
||||
},
|
||||
},
|
||||
b = {
|
||||
name = "LSP Buffer",
|
||||
D = {
|
||||
function()
|
||||
vim.lsp.buf.declaration()
|
||||
end,
|
||||
"Go to symbol declaration",
|
||||
buffer = buffer,
|
||||
},
|
||||
d = {
|
||||
function()
|
||||
vim.lsp.buf.definition()
|
||||
end,
|
||||
"Go to symbol definition",
|
||||
buffer = buffer,
|
||||
},
|
||||
h = {
|
||||
function()
|
||||
vim.lsp.buf.hover()
|
||||
end,
|
||||
"Hover symbol documentation",
|
||||
buffer = buffer,
|
||||
},
|
||||
i = {
|
||||
function()
|
||||
vim.lsp.buf.implementation()
|
||||
end,
|
||||
"Go to symbol implementation",
|
||||
buffer = buffer,
|
||||
},
|
||||
s = {
|
||||
function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end,
|
||||
"Go to symbol signature",
|
||||
buffer = buffer,
|
||||
},
|
||||
t = {
|
||||
function()
|
||||
vim.lsp.buf.type_definition()
|
||||
end,
|
||||
"Go to symbol type definition",
|
||||
buffer = buffer,
|
||||
},
|
||||
r = {
|
||||
function()
|
||||
vim.lsp.buf.rename()
|
||||
end,
|
||||
"Rename symbol",
|
||||
buffer = buffer,
|
||||
},
|
||||
c = {
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
"LSP code action",
|
||||
buffer = buffer,
|
||||
},
|
||||
R = {
|
||||
function()
|
||||
vim.lsp.buf.references()
|
||||
end,
|
||||
"Go to symbol deferences",
|
||||
buffer = buffer,
|
||||
},
|
||||
f = {
|
||||
function()
|
||||
vim.lsp.buf.format({
|
||||
async = true,
|
||||
})
|
||||
end,
|
||||
"Format file",
|
||||
buffer = buffer,
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "<leader>l", group = "LSP" },
|
||||
{ "<leader>lb", group = "LSP Buffer" },
|
||||
{ "<leader>lbD", function() vim.lsp.buf.declaration() end, buffer = 1, desc = "Go to symbol declaration" },
|
||||
{ "<leader>lbR", function() vim.lsp.buf.references() end, buffer = 1, desc = "Go to symbol references" },
|
||||
{ "<leader>lbc", function() vim.lsp.buf.code_action() end, buffer = 1, desc = "LSP code action" },
|
||||
{ "<leader>lbd", function() vim.lsp.buf.definition() end, buffer = 1, desc = "Go to symbol definition" },
|
||||
{ "<leader>lbf", function() vim.lsp.buf.format() end, buffer = 1, desc = "Format file" },
|
||||
{ "<leader>lbh", function() vim.lsp.buf.hover() end, buffer = 1, desc = "Hover symbol documentation" },
|
||||
{ "<leader>lbi", function() vim.lsp.buf.implementation() end, buffer = 1, desc = "Go to symbol implementation" },
|
||||
{ "<leader>lbr", function() vim.lsp.buf.rename() end, buffer = 1, desc = "Rename symbol" },
|
||||
{ "<leader>lbs", function() vim.lsp.buf.signature_help() end, buffer = 1, desc = "Go to symbol signature" },
|
||||
{ "<leader>lbt", function() vim.lsp.buf.type_definition() end, buffer = 1, desc = "Go to symbol type definition" },
|
||||
{ "<leader>ld", group = "LSP Diagnostic" },
|
||||
{ "<leader>ldn", function() vim.diagnostic.goto_next() end, desc = "Next LSP diagnostic" },
|
||||
{ "<leader>ldo", function() vim.diagnostic.open_float() end, desc = "Open LSP diagnostic" },
|
||||
{ "<leader>ldp", function() vim.diagnostic.goto_prev() end, desc = "Previous LSP diagnostic" },
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
@@ -7,30 +7,12 @@ return {
|
||||
end,
|
||||
config = function()
|
||||
require("which-key").register({
|
||||
["<C-s>"] = {
|
||||
":write<CR>",
|
||||
"Persist the content of the current buffer to the file system"
|
||||
},
|
||||
["<C-q>"] = {
|
||||
":quitall<CR>",
|
||||
"Quit the editor with confirmation"
|
||||
},
|
||||
["<C-h>"] = {
|
||||
"<C-w>h",
|
||||
"Move to the window on the left"
|
||||
},
|
||||
["<C-l>"] = {
|
||||
"<C-w>l",
|
||||
"Move to the window on the right"
|
||||
},
|
||||
["<C-k>"] = {
|
||||
"<C-w>k",
|
||||
"Move to the window on the top"
|
||||
},
|
||||
["<C-j>"] = {
|
||||
"<C-w>j",
|
||||
"Move to the window on the bottom"
|
||||
}
|
||||
{ "<C-h>", "<C-w>h", desc = "Move to the window on the left" },
|
||||
{ "<C-j>", "<C-w>j", desc = "Move to the window on the bottom" },
|
||||
{ "<C-k>", "<C-w>k", desc = "Move to the window on the top" },
|
||||
{ "<C-l>", "<C-w>l", desc = "Move to the window on the right" },
|
||||
{ "<C-q>", ":quitall<CR>", desc = "Quit the editor with confirmation" },
|
||||
{ "<C-s>", ":write<CR>", desc = "Persist the content of the current buffer to the file system" },
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user