nvim/lua/pika/core/keymaps.lua

107 lines
6.7 KiB
Lua

vim.g.mapleader = " "
-- ─< lua/keymaps.lua >─────────────────────────────────────────────────────────────────
local nomap = vim.keymap.set
nomap("i", "<C-k>", "")
nomap("n", "<C-k>", "")
nomap("n", "q", "")
nomap("v", "q", "")
local map = vim.keymap.set
map("n", "<Esc>", "<cmd>nohlsearch<CR>")
-- ─< Comment >─────────────────────────────────────────────────────────────────────────
map("n", "<S-c>", "gcc", { desc = "comment toggle", remap = true })
map("v", "<S-c>", "gc", { desc = "comment toggle", remap = true })
-- ─< cmd line >────────────────────────────────────────────────────────────────────────
vim.api.nvim_set_keymap("n", ":", "<cmd>FineCmdline<CR>", { noremap = true })
map("n", "T", "<cmd>FineCmdline<CR>")
-- ─< Terminal >────────────────────────────────────────────────────────────────────────
map("t", "<C-x>", "<C-\\><C-N>", { desc = "terminal escape terminal mode" })
-- ─< Movement while in "insert"-mode >─────────────────────────────────────────────────
map("i", "<C-b>", "<ESC>^i", { desc = "move beginning of line" })
map("i", "<C-e>", "<End>", { desc = "move end of line" })
map("i", "<C-h>", "<Left>", { desc = "move left" })
map("i", "<C-l>", "<Right>", { desc = "move right" })
map("i", "<C-j>", "<Down>", { desc = "move down" })
map("i", "<C-k>", "<Up>", { desc = "move up" })
-- ───────────────────────────────────< Add yours here >───────────────────────────────────
map("n", ";", ":", { desc = "CMD enter command mode" })
map("i", "jk", "<ESC>")
map("i", "<C-c>", "<ESC>")
map("n", "<C-c>", "<ESC>")
map("v", "<C-c>", "<ESC>")
map("n", "<leader>x", "<cmd>bd!<CR>")
-- ─< Activate color plugin >───────────────────────────────────────────────────────────
map("n", "<leader>C", "<cmd>ColorizerToggle<CR>")
--─< Toggle NvimTree >─────────────────────────────────────────────────────────────────
map("n", "<leader>e", ":Neotree toggle<CR>", { noremap = true, silent = true, desc = "[e]xplorer" })
-- ─< Disable arrow keys in normal mode >───────────────────────────────────────────────
map("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
map("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
map("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
map("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
map("n", "<leader>l", "<C-w><C-l>", { desc = "Move focus to the right window" })
map("n", "<leader>h", "<C-w><C-h>", { desc = "Move focus to the left window" })
map("n", "<leader>j", "<C-w><C-j>", { desc = "Move focus to the lower window" })
map("n", "<leader>k", "<C-w><C-k>", { desc = "Move focus to the upper window" })
-- map("n", "<leader>p", vim.cmd.Ex)
map("n", "<leader>q", vim.cmd.q)
map("n", "<leader>s", vim.cmd.w)
-- ─< Comment-Box mappings >────────────────────────────────────────────────────────────
map("n", "<leader>cd", "<Cmd>CBd<CR>", { noremap = true, silent = true, desc = "[c]ommentbox [d]elete" })
map("v", "<leader>cd", "<Cmd>CBd<CR>", { noremap = true, silent = true, desc = "[c]ommentbox [d]elete" })
map("n", "<leader>cy", "<Cmd>CBy<CR>", { noremap = true, silent = true, desc = "[y]ank content of Commentbox" })
map("v", "<leader>cy", "<Cmd>CBy<CR>", { noremap = true, silent = true, desc = "[y]ank content of Commentbox" })
map("n", "<leader>cb", "<Cmd>CBlabox1<CR>", { noremap = true, silent = true, desc = "[c]reate comment [b]ox" })
map("v", "<leader>cb", "<Cmd>CBlabox1<CR>", { noremap = true, silent = true, desc = "[c]reate comment [b]ox" })
map(
"n",
"<leader>cB",
"<Cmd>CBcabox1<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [b]ox (centered)" }
)
map(
"v",
"<leader>cB",
"<Cmd>CBcabox1<CR>",
{ noremap = true, silent = true, desc = "[c]reate comment [b]ox (centered)" }
)
map("n", "<leader>cc", "<Cmd>CBllbox14<CR>", { noremap = true, silent = true, desc = "[c]reate [c]omment" })
map("v", "<leader>cc", "<Cmd>CBllbox14<CR>", { noremap = true, silent = true, desc = "[c]reate [c]omment" })
map("n", "<leader>cC", "<Cmd>CBclbox14<CR>", { noremap = true, silent = true, desc = "[c]reate [c]omment (C)entered" })
map("v", "<leader>cC", "<Cmd>CBclbox14<CR>", { noremap = true, silent = true, desc = "[c]reate [c]omment (C)entered" })
map("n", "<leader>cl", "<Cmd>CBllline8<CR>", { noremap = true, silent = true, desc = "[c]reate comment [l]ine" })
map("n", "<leader>cL", "<Cmd>CBlcline8<CR>", { noremap = true, silent = true, desc = "[c]reate comment [L]ine" })
-- ─< rename word under cursor >───────────────────────────────────────────────────────────
map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- ─< LoremIpsum generator >────────────────────────────────────────────────────────────
map("n", "<leader>L", ":LoremIpsum ")
map("n", "cd", ":CdProject<CR>", { noremap = true, silent = true, desc = "[c]d into a predefined project" })
map("n", "<leader>cd", ":CdProjectManualAdd<CR>", { noremap = true, silent = true, desc = "Add new projects to [cd]" })
-- window management
map("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
map("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
-- ─< genvim keymaps (ai enhanced, coding!) >───────────────────────────────────────────
map({ "n", "v" }, "<leader>a", ":Gen<CR>")