From f0ca626c3fb04246c6dc2485d76d2503a9f7eb32 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sun, 14 Jul 2024 14:42:28 +0200 Subject: [PATCH] Don't use gj and gk in V-LINE and V-BLOCK modes In regular visual mode gk and gj make sense as the default, but when doing block or line selects regular j and k are better defaults. --- lua/lazyvim/config/keymaps.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 48ae24f8..b50dd4f1 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -5,10 +5,14 @@ local map = LazyVim.safe_keymap_set -- better up/down -map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) -map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) -map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) -map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) +map("n", "j", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +map("n", "", "v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +map("n", "k", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) +map("n", "", "v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) +map("x", "j", "mode() ==# 'v' && v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +map("x", "", "mode() ==# 'v' && v:count == 0 ? 'gj' : 'j'", { desc = "Down", expr = true, silent = true }) +map("x", "k", "mode() ==# 'v' && v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) +map("x", "", "mode() ==# 'v' && v:count == 0 ? 'gk' : 'k'", { desc = "Up", expr = true, silent = true }) -- Move to window using the hjkl keys map("n", "", "h", { desc = "Go to Left Window", remap = true })