summaryrefslogtreecommitdiff
path: root/lua/tjk/keybindings.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/tjk/keybindings.lua')
-rw-r--r--lua/tjk/keybindings.lua46
1 files changed, 46 insertions, 0 deletions
diff --git a/lua/tjk/keybindings.lua b/lua/tjk/keybindings.lua
new file mode 100644
index 0000000..563d843
--- /dev/null
+++ b/lua/tjk/keybindings.lua
@@ -0,0 +1,46 @@
+local key = vim.keymap.set
+
+vim.g.mapleader = ","
+
+-- toggle spellcheck
+key("n", "<leader>l", [[:setlocal spell! spelllang=en_us<CR>]])
+-- toggle cursorcolumn
+key("n", "<leader>c", [[:set cursorcolumn!<CR>]])
+
+-- scroll doc with ctrl+[jk]
+key({ "n", "v" }, "<C-j>", "<C-e>")
+key({ "n", "v" }, "<C-k>", "<C-y>")
+-- go to begining or end of line with ctrl+[hl]
+key({ "n", "v" }, "<C-h>", "zh")
+key({ "n", "v" }, "<C-l>", "zl")
+
+-- split navigation with ctrl+shift+[hjkl]
+key("n", "<C-S-h>", "<C-w>h")
+key("n", "<C-S-j>", "<C-w>j")
+key("n", "<C-S-k>", "<C-w>k")
+key("n", "<C-S-l>", "<C-w>l")
+
+-- browser like tab shortcuts
+key("n", "<C-Tab>", "gt")
+key("n", "<C-S-Tab>", "gT")
+--key("n", "<C-t>", [[:tabe<CR>]])
+--key("n", "<C-w>", [[:tabclose<CR>]]) -- <C-w> is already used lol
+-- additional tab shortcuts
+key("n", "<C-t>", "gt")
+key("n", "<C-T>", "gT")
+
+
+-- copy text to x11 buffer
+key("", "<C-c>", [["+y]])
+key("", "<C-x>", [["+x]])
+key("", "<C-S-c>", [["+y]])
+key("", "<C-S-x>", [["+x]])
+
+-- unmap ex mode
+key("", "Q", "<NOP>")
+
+-- repeat commands with visual blocks using period
+key("v", ".", [[:normal .<CR>]])
+
+-- save files with root permissions with command `w!!`
+key("c", "w!!", [[execute 'silent! write !doas tee % >/dev/null' <bar> edit!]])