AstroVimConfig/mappings.lua

50 lines
1.7 KiB
Lua

-- Mapping data with "desc" stored directly by vim.keymap.set().
--
-- Please use this mappings table to set keyboard mapping since this is the
-- lower level configuration and more robust one. (which-key will
-- automatically pick-up stored data by this setting.)
return {
-- first key is the mode
n = {
-- second key is the lefthand side of the map
-- mappings seen under group name "Buffer"
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
["<leader>bD"] = {
function()
require("astronvim.utils.status").heirline.buffer_picker(function(bufnr)
require("astronvim.utils.buffer").close(
bufnr)
end)
end,
desc = "Pick to close",
},
-- tables with the `name` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<leader>b"] = { name = "Buffers" },
-- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
["<S-g>"] = { "<C-w>k" },
["<S-r>"] = { "<C-w>j" },
["<S-n>"] = { "<C-w>h" },
["<S-t>"] = { "<C-w>l" },
["<C-g>"] = { "<C-w>K" },
["<C-r>"] = { "<C-w>J" },
["<C-n>"] = { "<C-w>H" },
["<C-t>"] = { "<C-w>L" },
["<leader>lgd"] = { vim.lsp.buf.hover() }
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
v = {
["<S-up>"] = { ":m '<-2<CR>gv=gv'" },
["<S-down>"] = { ":m '>+1<CR>gv=gv'" },
},
i = {
-- ["<C-f>"] = { "copilot#Accept(\"\\<CR>\")", desc = "copilot expand", silent = true, expr = true, script = true }
["<C-f>"] = { "copilot#Accept(\"\\<CR>\")", desc = "copilot expand", silent = true, expr = true, replace_keycodes = false }
}
}