summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@firemail.cc>2023-08-28 11:22:35 +0530
committersinanmohd <sinan@firemail.cc>2023-08-28 11:52:27 +0530
commite5ec96f86568c5641c03c9869d1e6d3930435f8d (patch)
tree72c0c063f1185f5792d2ede09c1f27e8e7ea49be
parentc9e9a17b8b083dfa3bd6c12b82a59d4e9f6b57e8 (diff)
config/nvim: add new keybindings
-rw-r--r--.config/nvim/init.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index d9ddec1..410d6e1 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -13,11 +13,42 @@ vim.o.termguicolors = true
vim.wo.signcolumn = "yes"
-- [[ lib ]]
+local map = function(mode, lhs, rhs, opts)
+ if not opts then
+ opts = { silent = true }
+ end
+ vim.api.nvim_set_keymap(mode, lhs, rhs, opts)
+end
+
local mapnl = function(lhs, rhs, opts)
+ if not opts then
+ opts = { silent = true }
+ end
vim.keymap.set("n", "<leader>" .. lhs, rhs, opts)
end
-- [[ keybindings ]]
+-- splits
+map("n", "<C-h>", "<C-w>h")
+map("n", "<C-j>", "<C-w>j")
+map("n", "<C-k>", "<C-w>k")
+map("n", "<C-l>", "<C-w>l")
+map("t", "<C-h>", "<C-\\><C-n><C-w>h")
+map("t", "<C-j>", "<C-\\><C-n><C-w>j")
+map("t", "<C-k>", "<C-\\><C-n><C-w>k")
+map("t", "<C-l>", "<C-\\><C-n><C-w>l")
+-- terminal
+map("n", "<leader>t", ":vsplit<CR>:terminal<CR>i")
+map("t", "<leader>t", "<C-\\><C-n>:q<CR>")
+-- buffer
+mapnl("h", ":bprevious<CR>")
+mapnl("l", ":bNext<CR>")
+-- tabs
+mapnl("j", ":tabprevious<CR>")
+mapnl("k", ":tabNext<CR>")
+-- files
+mapnl("e", ":Lex<CR>")
+-- column hint
mapnl("cc", function()
if vim.api.nvim_get_option_value("colorcolumn", {}) == "" then
vim.api.nvim_set_option_value("colorcolumn", "79", {})