diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2022-09-04 02:23:15 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2022-09-04 02:23:15 +0530 |
commit | 994cb1f91958a02415825a4dda74d18241096805 (patch) | |
tree | 684b61eada0b6e9de9c66df49c56a4dc92d8983e | |
parent | 1574754b4e1a246becdba050412647a056889cc8 (diff) |
adding keymaps neovim config
-rw-r--r-- | .config/nvim/init.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/keymaps.lua | 52 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/options.lua (renamed from .config/nvim/lua/saumit/options.lua) | 2 |
3 files changed, 56 insertions, 2 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index a35e9b3..d2b891d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1 +1,3 @@ -print ('while ( !(success = try() );') +require("justsaumit.options") +require("justsaumit.keymaps") +print ("while ( !(success = try() );") diff --git a/.config/nvim/lua/justsaumit/keymaps.lua b/.config/nvim/lua/justsaumit/keymaps.lua new file mode 100644 index 0000000..5445963 --- /dev/null +++ b/.config/nvim/lua/justsaumit/keymaps.lua @@ -0,0 +1,52 @@ +local opts = { noremap = true, silent = true } + +-- Shorten function name +local keymap = vim.keymap.set + +--Remap space as leader key +keymap("", "<Space>", "<Nop>", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Modes +-- normal_mode = "n", +-- insert_mode = "i", +-- visual_mode = "v", +-- visual_block_mode = "x", +-- command_mode = "c", + +-- Normal -- +-- Better window navigation for split +keymap("n", "<C-h>", "<C-w>h", opts) +keymap("n", "<C-j>", "<C-w>j", opts) +keymap("n", "<C-k>", "<C-w>k", opts) +keymap("n", "<C-l>", "<C-w>l", opts) + +-- Resize with arrows +keymap("n", "<C-Up>", ":resize -2<CR>", opts) +keymap("n", "<C-Down>", ":resize +2<CR>", opts) +keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts) +keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts) + +-- Move text up and down +keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts) +keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts) + +-- Insert -- + +-- Visual -- +-- Stay in indent mode +keymap("v", "<", "<gv", opts) +keymap("v", ">", ">gv", opts) + +-- Move text up and down +keymap("v", "<A-j>", ":m .+1<CR>==", opts) +keymap("v", "<A-k>", ":m .-2<CR>==", opts) +keymap("v", "p", '"_dP', opts) + +-- Visual Block -- +-- Move text up and down +keymap("x", "J", ":move '>+1<CR>gv-gv", opts) +keymap("x", "K", ":move '<-2<CR>gv-gv", opts) +keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts) +keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts) diff --git a/.config/nvim/lua/saumit/options.lua b/.config/nvim/lua/justsaumit/options.lua index b140c7c..30dbe9c 100644 --- a/.config/nvim/lua/saumit/options.lua +++ b/.config/nvim/lua/justsaumit/options.lua @@ -36,4 +36,4 @@ for key, value in pairs(options) do end --to 'cw/'dw' a word containing '-' in between -vim.cmd [[set iskeyword+=-]] +--vim.cmd [[set iskeyword+=-]] |