[nvim] feat: add descriptions to mappings
This commit is contained in:
parent
4419ce90b1
commit
6d5fa385d2
@ -3,35 +3,74 @@
|
|||||||
-- License : GPLv3
|
-- License : GPLv3
|
||||||
-- Description : neovim mappings file
|
-- Description : neovim mappings file
|
||||||
|
|
||||||
vim.keymap.set({ "n", "v" }, "<space>", "<Nop>", { silent = true })
|
vim.keymap.set({ "n", "v" }, "<space>",
|
||||||
|
"<Nop>",
|
||||||
|
{
|
||||||
|
silent = true,
|
||||||
|
desc = "leader key"
|
||||||
|
})
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
-- Dealing with word wrap
|
-- Dealing with word wrap
|
||||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'",
|
vim.keymap.set("n", "k",
|
||||||
{ expr = true, silent = true })
|
"v:count == 0 ? 'gk' : 'k'",
|
||||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'",
|
{
|
||||||
{ expr = true, silent = true })
|
expr = true,
|
||||||
|
silent = true,
|
||||||
|
desc = "Smart up motion"
|
||||||
|
})
|
||||||
|
vim.keymap.set("n", "j",
|
||||||
|
"v:count == 0 ? 'gj' : 'j'",
|
||||||
|
{
|
||||||
|
expr = true,
|
||||||
|
silent = true,
|
||||||
|
desc = "Smart down motion"
|
||||||
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>y", "\"+y")
|
vim.keymap.set("n", "<leader>y",
|
||||||
vim.keymap.set("n", "<leader>p", "\"+P")
|
"\"+y",
|
||||||
vim.keymap.set("n", "<leader><enter>", "<cmd>w! | !compiler %<CR>")
|
{ desc = "Yank to clipboard"}
|
||||||
vim.keymap.set("n", "<leader>u", function() require("packer").sync() end)
|
)
|
||||||
|
vim.keymap.set("n", "<leader>p",
|
||||||
|
"\"+P",
|
||||||
|
{ desc = "Copy from clipboard"}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader><enter>",
|
||||||
|
"<cmd>w! | !compiler %<CR>",
|
||||||
|
{ desc = "Compile current file using ~/.local/bin/compiler"}
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>u",
|
||||||
|
function() require("packer").sync() end,
|
||||||
|
{ desc = "Sync packer config and update plugins"}
|
||||||
|
)
|
||||||
|
|
||||||
-- telescope
|
-- telescope
|
||||||
vim.keymap.set("n", "<leader>tf",
|
vim.keymap.set("n", "<leader>tf",
|
||||||
function() require("telescope.builtin").find_files() end)
|
function() require("telescope.builtin").find_files() end,
|
||||||
|
{ desc = "Fuzzy find files" }
|
||||||
|
)
|
||||||
vim.keymap.set("n", "<leader>tef",
|
vim.keymap.set("n", "<leader>tef",
|
||||||
function() require("telescope").extensions.file_browser.file_browser() end)
|
function() require("telescope").extensions.file_browser.file_browser() end,
|
||||||
|
{ desc = "Open file browser" }
|
||||||
|
)
|
||||||
vim.keymap.set("n", "<leader>tb",
|
vim.keymap.set("n", "<leader>tb",
|
||||||
function() require("telescope.builtin").buffers() end)
|
function() require("telescope.builtin").buffers() end,
|
||||||
|
{ desc = "Grep through buffers" }
|
||||||
|
)
|
||||||
vim.keymap.set("n", "<leader>tg",
|
vim.keymap.set("n", "<leader>tg",
|
||||||
function() require("telescope.builtin").grep_string() end)
|
function() require("telescope.builtin").grep_string() end,
|
||||||
|
{ desc = "Grep current word" }
|
||||||
|
)
|
||||||
vim.keymap.set("n", "<leader>tl",
|
vim.keymap.set("n", "<leader>tl",
|
||||||
function() require("telescope.builtin").live_grep() end)
|
function() require("telescope.builtin").live_grep() end,
|
||||||
|
{ desc = "Grep interactively" }
|
||||||
|
)
|
||||||
|
|
||||||
-- colorscheme
|
-- colorscheme
|
||||||
vim.keymap.set("n", "<C-s>",
|
vim.keymap.set("n", "<C-s>",
|
||||||
function() require("astronomy").toggle_variant() end)
|
function() require("astronomy").toggle_variant() end,
|
||||||
|
{ desc = "Switch between dark and light colorscheme" }
|
||||||
|
)
|
||||||
|
|
||||||
-- snippets
|
-- snippets
|
||||||
vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice")
|
vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice")
|
||||||
|
Reference in New Issue
Block a user