2021-05-19 00:53:42 +02:00
|
|
|
-- Author : swytch
|
|
|
|
-- Created : Friday Mar 12, 2021 20:17:19 CET
|
|
|
|
-- License : GPLv3
|
|
|
|
-- Description : neovim mappings file
|
|
|
|
|
2023-01-02 19:47:28 +01:00
|
|
|
vim.keymap.set({ "n", "v" }, "<space>",
|
|
|
|
"<Nop>",
|
|
|
|
{
|
|
|
|
silent = true,
|
|
|
|
desc = "leader key"
|
|
|
|
})
|
2022-04-27 21:30:56 +02:00
|
|
|
vim.g.mapleader = " "
|
2021-05-21 23:57:34 +02:00
|
|
|
|
2023-01-07 22:11:21 +01:00
|
|
|
-- dealing with word wrap
|
2023-01-02 19:47:28 +01:00
|
|
|
vim.keymap.set("n", "k",
|
|
|
|
"v:count == 0 ? 'gk' : 'k'",
|
|
|
|
{
|
|
|
|
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"
|
|
|
|
})
|
2022-04-27 21:30:56 +02:00
|
|
|
|
2023-01-07 22:11:21 +01:00
|
|
|
-- yank and pasting
|
2023-01-07 22:30:23 +01:00
|
|
|
vim.keymap.set({ "n", "x" }, "<leader>y",
|
2023-01-02 19:47:28 +01:00
|
|
|
"\"+y",
|
|
|
|
{ desc = "Yank to clipboard"}
|
|
|
|
)
|
|
|
|
vim.keymap.set("n", "<leader>p",
|
|
|
|
"\"+P",
|
2023-01-07 22:11:21 +01:00
|
|
|
{ desc = "Paste from clipboard" }
|
2023-01-02 19:47:28 +01:00
|
|
|
)
|
2023-01-07 22:09:20 +01:00
|
|
|
vim.keymap.set("x", "<leader>p",
|
|
|
|
"\"_dP",
|
|
|
|
{ desc = "Send selection to void register and paste from clipboard" }
|
|
|
|
)
|
|
|
|
|
2023-01-07 22:30:59 +01:00
|
|
|
-- deletion
|
|
|
|
vim.keymap.set({ "n", "x" }, "<leader>d",
|
|
|
|
"\"_d",
|
|
|
|
{ desc = "Send selection to void register" }
|
|
|
|
)
|
|
|
|
|
2023-01-07 22:11:21 +01:00
|
|
|
-- comfort zone
|
2023-01-02 19:47:28 +01:00
|
|
|
vim.keymap.set("n", "<leader><enter>",
|
|
|
|
"<cmd>w! | !compiler %<CR>",
|
2023-01-07 22:11:21 +01:00
|
|
|
{ desc = "Compile current file using ~/.local/bin/compiler" }
|
2023-01-02 19:47:28 +01:00
|
|
|
)
|
2023-01-07 22:11:21 +01:00
|
|
|
|
|
|
|
-- packer
|
2023-01-02 19:47:28 +01:00
|
|
|
vim.keymap.set("n", "<leader>u",
|
|
|
|
function() require("packer").sync() end,
|
2023-01-07 22:11:21 +01:00
|
|
|
{ desc = "Sync packer config and update plugins" }
|
2023-01-02 19:47:28 +01:00
|
|
|
)
|
2021-05-23 01:37:44 +02:00
|
|
|
|
|
|
|
-- telescope
|
2022-10-25 12:06:01 +02:00
|
|
|
vim.keymap.set("n", "<leader>tf",
|
2023-01-02 19:47:28 +01:00
|
|
|
function() require("telescope.builtin").find_files() end,
|
|
|
|
{ desc = "Fuzzy find files" }
|
|
|
|
)
|
2023-01-02 19:56:23 +01:00
|
|
|
vim.keymap.set("n", "<leader>tb",
|
2023-01-02 19:47:28 +01:00
|
|
|
function() require("telescope").extensions.file_browser.file_browser() end,
|
|
|
|
{ desc = "Open file browser" }
|
|
|
|
)
|
2023-01-02 19:56:23 +01:00
|
|
|
vim.keymap.set("n", "<leader>t/",
|
2023-01-02 19:47:28 +01:00
|
|
|
function() require("telescope.builtin").buffers() end,
|
|
|
|
{ desc = "Grep through buffers" }
|
|
|
|
)
|
2022-10-25 12:26:14 +02:00
|
|
|
vim.keymap.set("n", "<leader>tg",
|
2023-01-02 19:47:28 +01:00
|
|
|
function() require("telescope.builtin").grep_string() end,
|
|
|
|
{ desc = "Grep current word" }
|
|
|
|
)
|
2023-01-02 19:56:45 +01:00
|
|
|
vim.keymap.set("n", "<leader>th",
|
|
|
|
function() require("telescope.builtin").help_tags() end,
|
|
|
|
{ desc = "Search through help" }
|
|
|
|
)
|
2022-10-25 12:06:01 +02:00
|
|
|
vim.keymap.set("n", "<leader>tl",
|
2023-01-02 19:47:28 +01:00
|
|
|
function() require("telescope.builtin").live_grep() end,
|
|
|
|
{ desc = "Grep interactively" }
|
|
|
|
)
|
2021-10-22 22:40:18 +02:00
|
|
|
|
|
|
|
-- colorscheme
|
2023-01-02 20:17:56 +01:00
|
|
|
vim.keymap.set("n", "<leader>s",
|
2023-01-02 19:47:28 +01:00
|
|
|
function() require("astronomy").toggle_variant() end,
|
|
|
|
{ desc = "Switch between dark and light colorscheme" }
|
|
|
|
)
|
2021-11-20 16:02:59 +01:00
|
|
|
|
|
|
|
-- snippets
|
2023-01-07 22:11:01 +01:00
|
|
|
vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice",
|
|
|
|
{ desc = "Cycle through luasnip choices" }
|
|
|
|
)
|