From 268c37e52f6ca99e248d5f1653fbffc1d1696b7d Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Mon, 26 Jul 2021 14:32:29 +0530 Subject: [PATCH] mappings: Allow moving the cursor through wrapped lines normally This doesn't affect any other stuff like 10j or 10k --- lua/mappings.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/mappings.lua b/lua/mappings.lua index 815bf4d..17848db 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -26,6 +26,14 @@ vim.api.nvim_set_keymap("t", "jk", "", {}) -- Don't copy the replaced text after pasting in visual mode map("v", "p", '"_dP', opt) +-- 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}) + -- OPEN TERMINALS -- map("n", "", ":vnew +terminal | setlocal nobuflisted ", opt) -- term over right map("n", "", ":10new +terminal | setlocal nobuflisted ", opt) -- term bottom