nvde/lua/config/bindings.lua
2024-01-28 22:20:37 +01:00

40 lines
1.9 KiB
Lua

--tab navigation
vim.keymap.set("n", "<A-1>", "1gt")
vim.keymap.set("n", "<A-2>", "2gt")
vim.keymap.set("n", "<A-3>", "3gt")
vim.keymap.set("n", "<A-4>", "4gt")
vim.keymap.set("n", "<A-5>", "5gt")
vim.keymap.set("n", "<A-6>", "6gt")
vim.keymap.set("n", "<A-7>", "7gt")
vim.keymap.set("n", "<A-8>", "8gt")
vim.keymap.set("n", "<A-9>", "9gt")
vim.keymap.set("n", "<A-0>", ":tablast<cr>")
vim.keymap.set("n", "<C-t>", ":tab new<cr>")
--move between splits with hjkl
vim.keymap.set("n", "<A-l>", ":wincmd l<cr>")
vim.keymap.set("n", "<A-k>", ":wincmd k<cr>")
vim.keymap.set("n", "<A-j>", ":wincmd j<cr>")
vim.keymap.set("n", "<A-h>", ":wincmd h<cr>")
--misc
vim.keymap.set("n", "<C-w>", ":q<cr>") --ctrl+w shortcut of :q
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<cr>") --open file tree
vim.keymap.set("n", "<A-cr>", ":tabnew +term<cr>") --create terminal in new tab
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --exit terminal mode with esc
vim.keymap.set("n", "<A-ESC>", ":tabnew | terminal htop<cr>") --open htop in new tab
vim.keymap.set("n", "<A-t>", ":tabnew | terminal termusic<cr>") --open termusic (a music player) in new tab
vim.keymap.set("n", "<A-m>", ":tabnew | terminal gomuks<cr>") --open gomuks (a matrix client) in new tab
vim.keymap.set("n", "<A-V>", ":split new<cr>") --create a new split
vim.keymap.set("n", "<A-v>", ":vs new<cr>") --create a vplit
--dvorak
vim.keymap.set({"n","v","o"}, "h", "h") --move left
vim.keymap.set({"n","v","o"}, "t", "j") --move down
vim.keymap.set({"n","v","o"}, "n", "k") --move up
vim.keymap.set({"n","v","o"}, "s", "l") --move right
vim.keymap.set({"n","v","o"}, "l", "n") --next
vim.keymap.set({"n","v","o"}, "L", "N") --last
vim.keymap.set("n", "<A-s>", ":wincmd l<cr>")
vim.keymap.set("n", "<A-n>", ":wincmd k<cr>")
vim.keymap.set("n", "<A-t>", ":wincmd j<cr>")
vim.keymap.set("n", "<A-h>", ":wincmd h<cr>")