From bfe5cdd6074c0f2c27ca7089697438a37d3ad372 Mon Sep 17 00:00:00 2001 From: krolyxon Date: Fri, 20 Jan 2023 00:21:02 +0530 Subject: [PATCH] keybind: allow moving cursor through wrapped lines --- lua/core/mappings.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 5bacb80..042ac8f 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -10,6 +10,13 @@ M.general = { [""] = { "j", "window down" }, [""] = { "k", "window up" }, + -- Allow moving the cursor through wrapped lines with j, k, and + -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/ + -- empty mode is same as using :map + -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour + ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, + ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, + -- new buffer ["b"] = { " enew ", "new buffer" },