diff options
Diffstat (limited to '.config/nvim')
-rw-r--r-- | .config/nvim/init.lua | 31 |
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", {}) |