Files
nvim/lua/custom/mappings.lua
thread 3fc6fde51c
Some checks failed
Close stale issues and PRs / stale (push) Has been cancelled
go stuff & a mess more
2025-03-28 14:53:54 -04:00

101 lines
3.1 KiB
Lua

---@type MappingsTable
local M = {}
M.general = {
i = {
["<c-r>"] = { "<c-v>", "paste from OS without autopairing" },
},
n = {
-- [";"] = { ":", "enter command mode", opts = { nowait = true } },
["go"] = {
function()
vim.lsp.buf.format { async = true }
end,
"LSP formatting",
},
["<leader>wv"] = { "<C-w>v", "Split vertical" },
["<leader>ws"] = { "<C-w>s", "Split horizontal" },
["<leader>wo"] = { "<C-w>o", "Maximize split" },
["<leader>wc"] = { "<C-w>c", "Close split" },
["<leader>wx"] = { "<C-w>c", "Close split" },
["<leader>w="] = { "<C-w>=", "Even splits" },
["<leader>h"] = { "<C-w>h", "Focus left split" },
["<leader>j"] = { "<C-w>j", "Focus lower split" },
["<leader>k"] = { "<C-w>k", "Focus upper split" },
["<leader>l"] = { "<C-w>l", "Focus right split" },
["<leader>ee"] = { ':e <C-R>=expand("%:p:h" . "/" <CR><CR>)', "Copy relative path to file" },
["<leader>er"] = { ":!echo -n % | pbcopy<CR>", "Copy absolute path to file" },
["<leader>gn"] = { ":Telescope resume<CR>", "Resume telescope" },
["<leader>eu"] = { '!!python -c "import uuid; print(uuid.uuid4())"<CR>', "Drop fresh uuid4" },
["<c-c>"] = { '"+y', "Copy to OS clipboard" },
[",,"] = { ":w<CR>", "save" },
["<leader> "] = { ":w<CR>", "save" },
["<leader>n"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
["<leader>N"] = { "<cmd> set nu! <CR>", "Toggle line number" },
["<leader>x"] = { "<cmd>bdelete<CR>", "Close Buffer and window" },
["<leader>X"] = { "<cmd>bdelete!<CR>", "Close Buffer and window!" },
["<leader>c"] = { "<cmd>Bdelete<CR>", "Close Buffer" },
["<leader>b"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
-- ["<A-Space>"] = cmp.mapping.complete(),
["gb"] = { "<cmd>Gitsigns blame<CR>", "Git blame" },
["gB"] = { "<cmd>Gitsigns blame_line<CR>", "Git blame line" },
["gu"] = { "<cmd>diffget //2<CR>", "Select left in conflict" },
["gh"] = { "<cmd>diffget //3<CR>", "Select right in conflict" },
["ge"] = {
function()
vim.diagnostic.open_float { border = "rounded" }
end,
"Floating diagnostic",
},
[",z"] = { ":bnext<CR>", "Next buffer" },
[",v"] = { ":bprevious<CR>", "Previous buffer" },
["<leader>z"] = {
function()
require("nvchad.tabufline").tabuflineNext()
end,
"Goto next buffer",
},
["<leader>v"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
end,
"Goto prev buffer",
},
["<leader>tl"] = { ":Neotest run last<CR>", "Neotest Run Last" },
["<leader>ts"] = { ":Neotest summary<CR>", "Neotest Summary" },
["<leader>to"] = { ":Neotest output<CR>", "Neotest Output" },
["<leader>ta"] = { ":Neotest output-panel<CR>", "Neotest Output Panel" },
},
v = {
[">"] = { ">gv", "indent" },
["<c-c>"] = { '"+y', "Copy to OS clipboard" },
},
}
M.crates = {
n = {
["<leader>rcu"] = {
function()
require("crates").upgrade_all_crates()
end,
"Update crates",
},
},
}
-- more keybinds!
return M