From e5ec96f86568c5641c03c9869d1e6d3930435f8d Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Mon, 28 Aug 2023 11:22:35 +0530 Subject: config/nvim: add new keybindings --- .config/nvim/init.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to '.config/nvim') 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", "" .. lhs, rhs, opts) end -- [[ keybindings ]] +-- splits +map("n", "", "h") +map("n", "", "j") +map("n", "", "k") +map("n", "", "l") +map("t", "", "h") +map("t", "", "j") +map("t", "", "k") +map("t", "", "l") +-- terminal +map("n", "t", ":vsplit:terminali") +map("t", "t", ":q") +-- buffer +mapnl("h", ":bprevious") +mapnl("l", ":bNext") +-- tabs +mapnl("j", ":tabprevious") +mapnl("k", ":tabNext") +-- files +mapnl("e", ":Lex") +-- column hint mapnl("cc", function() if vim.api.nvim_get_option_value("colorcolumn", {}) == "" then vim.api.nvim_set_option_value("colorcolumn", "79", {}) -- cgit v1.2.3