summaryrefslogtreecommitdiff
path: root/lua/talha/remap.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/talha/remap.lua')
-rw-r--r--lua/talha/remap.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/lua/talha/remap.lua b/lua/talha/remap.lua
new file mode 100644
index 0000000..442ec9d
--- /dev/null
+++ b/lua/talha/remap.lua
@@ -0,0 +1,37 @@
+vim.g.mapleader = " "
+
+-- open project view with netrw
+vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
+
+-- file splitting
+vim.keymap.set("n", "<leader>vs", vim.cmd.vsplit)
+vim.keymap.set("n", "<leader>hs", vim.cmd.split)
+
+-- moving selected lines across lines
+vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
+vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
+
+-- not moving cursor when bringing files up
+vim.keymap.set("n", "J", "mzJ`z")
+
+-- keep cursor in screen center when moving up and down
+vim.keymap.set("n", "<C-d>", "<C-d>zz")
+vim.keymap.set("n", "<C-u>", "<C-u>zz")
+
+-- keep cursor in screen center when traversing in find
+vim.keymap.set("n", "n", "nzzzv")
+vim.keymap.set("n", "N", "Nzzzv")
+
+vim.keymap.set("x", "<leader>p", "\"_dP")
+
+-- copying to system clipboard
+vim.keymap.set("n", "<leader>y", [["+y]])
+vim.keymap.set("v", "<leader>y", [["+y]])
+vim.keymap.set("n", "<leader>Y", [["+Y]])
+
+-- deleting without polluting vim clipboard
+vim.keymap.set({"n", "x"}, "x", [["_x]])
+vim.keymap.set({"n", "x"}, "X", [["_d]])
+
+-- global substitute the word cursor is on in current file
+vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])