From 7e935b12c09358adad480a566988b9cbfaf5999e Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 1 Sep 2022 22:01:42 +0100 Subject: [PATCH] feat(nvim): improve C-d and C-u mappings Move up or down by half a page but also automatically re-center the screen so that the cursor is always within a consistent positiion. --- roles/neovim/files/lua/opdavies/options.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/neovim/files/lua/opdavies/options.lua b/roles/neovim/files/lua/opdavies/options.lua index bf0ec9f..8073ced 100644 --- a/roles/neovim/files/lua/opdavies/options.lua +++ b/roles/neovim/files/lua/opdavies/options.lua @@ -100,6 +100,10 @@ local function set_key_mappings() nmap { "", ":m .-2==", opts } vmap { "", ":m '>+1gv=gv", opts } vmap { "", ":m '<-2gv=gv", opts } + + -- Move half a screen up or down and re-center. + nmap { "", "zz" } + nmap { "", "zz" } end local function set_highlights()