diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index b372c30..6f58bdb 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -19,10 +19,11 @@ M.misc = function() -- 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 - map("", "j", 'v:count ? "j" : "gj"', { expr = true }) - map("", "k", 'v:count ? "k" : "gk"', { expr = true }) - map("", "", 'v:count ? "j" : "gj"', { expr = true }) - map("", "", 'v:count ? "k" : "gk"', { expr = true }) + -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour + map("", "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true }) + map("", "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true }) + map("", "", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true }) + map("", "", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true }) -- use ESC to turn off search highlighting map("n", "", ":noh ")