From 2809ea08cf9833521860f0bdee51698bb238dbcc Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Tue, 6 Dec 2022 01:07:30 -0800 Subject: [PATCH] :sparkles: Pageup/pagedown now recenter in vim --- .config/nvim/lua/keybindings.lua | 8 ++++++++ nvim/lua/keybindings.lua | 8 ++++++++ nvim_custom_keys.txt | 5 ++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua index 3a2defa5..d7abcda7 100644 --- a/.config/nvim/lua/keybindings.lua +++ b/.config/nvim/lua/keybindings.lua @@ -20,6 +20,14 @@ keymap('n', '', ':FZFExplore', {}) -- vim.cmd[[nnoremap gb :silent :GitBlameToggle]] keymap('n', '', ':GitBlameToggle', {}) +-- pageup/pagedown autotmatically recenters +vim.cmd[[:map zz]] +vim.cmd[[:map zz]] + +-- search automatically recenters +vim.cmd[[nnoremap n nzz]] +vim.cmd[[nnoremap N Nzz]] + -- open ripgrep vim.cmd[[nnoremap rg :silent :Rg]] diff --git a/nvim/lua/keybindings.lua b/nvim/lua/keybindings.lua index 3a2defa5..d7abcda7 100644 --- a/nvim/lua/keybindings.lua +++ b/nvim/lua/keybindings.lua @@ -20,6 +20,14 @@ keymap('n', '', ':FZFExplore', {}) -- vim.cmd[[nnoremap gb :silent :GitBlameToggle]] keymap('n', '', ':GitBlameToggle', {}) +-- pageup/pagedown autotmatically recenters +vim.cmd[[:map zz]] +vim.cmd[[:map zz]] + +-- search automatically recenters +vim.cmd[[nnoremap n nzz]] +vim.cmd[[nnoremap N Nzz]] + -- open ripgrep vim.cmd[[nnoremap rg :silent :Rg]] diff --git a/nvim_custom_keys.txt b/nvim_custom_keys.txt index 1d401997..3a4259fd 100644 --- a/nvim_custom_keys.txt +++ b/nvim_custom_keys.txt @@ -35,7 +35,10 @@ gg - go to top of the page shift + g - go to the bottom of the page ctrl u -page up ctrl d - page down -/ - forwards slash searches foor the word/term you wish to jump to, just press enter once it is highlighted +/ - forwards slash searches for the word/term you wish to jump to, just press enter once it is highlighted +? - question mark searches for the word/term you wish to jump to, just press enter once it is highlighted +n - jump to the next occurence of search term entered from / or ? (/ goes forwards in document, ? goes backwards in document) +N - jump to the previous occurence of search term entered from / or ? (/ goes backwards in document, ? goes forwards in document) :w - writes (my nneovim setup as autosave, but it's still a good feature to have) :q - quits neovim (first neovim command to learn) u - undoes last change (can be used with prepended numbers depending on how many steps you want to undo)