From 73a7af26ffd6fd7ee1674765fed4534249395661 Mon Sep 17 00:00:00 2001 From: Maximilian Wolf <69987866+MaxWolf-01@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:36:27 +0100 Subject: [PATCH] nvim: smooth window navigation --- nvim/lua/mappings.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/nvim/lua/mappings.lua b/nvim/lua/mappings.lua index 81dcf51..21589c9 100644 --- a/nvim/lua/mappings.lua +++ b/nvim/lua/mappings.lua @@ -13,8 +13,9 @@ map("n", "U", "", opts) -- disable U (scary behvaior) -- Scroling and finding map("n", "", "zz", opts) -- centered cursor when scrolling down map("n", "", "zz", opts) -- centered cursor when scrolling up -map('n', 'n', 'nzzzv') -- Next search result stays centered -map('n', 'N', 'Nzzzv') -- Previous search result stays centered +map('n', '/', '/zz', opts) -- centered seach result +map('n', 'n', 'nzzzv') -- next search result stays centered +map('n', 'N', 'Nzzzv') -- previous search result stays centered -- Saving and quitting map("n", "", ":w", opts) -- ctrl+s saves in normal ... map("i", "", ":wa", opts) -- ... and in insert mode returns to insert @@ -50,9 +51,14 @@ map('n', 'cdwr', function() -- window-local cd to git root of current fi end end end) - --- window navigation --- to use ALT+{h,j,k,l} to navigate windows from any mode: +-- window splits +vim.keymap.set('n', 'vv', ':vsplit') +vim.keymap.set('n', 'vh', ':split') +-- window resizing +map('n', '', ':vertical resize +4') +map('n', '', ':resize -4') +map('n', '', ':resize +4') +-- use ALT+{h,j,k,l} to navigate windows from any mode map("t", "", "h", opts) map("t", "", "j", opts) map("t", "", "k", opts) @@ -65,8 +71,7 @@ map("n", "", "h", opts) map("n", "", "j", opts) map("n", "", "k", opts) map("n", "", "l", opts) - - +map('n', '', ':vertical resize -4') -- terminal stuff: http://neovim.io/doc/user/terminal.html#terminal map('n', 'tt', ':lcd %:p:h:terminal', opts) -- open terminal in dir of current file map('n', 'T', ':terminal', opts) -- open terminal in working directory