mappings: Fix strange delete/yank/cut behaviour | Resolve #379
use mode() to detect if currently in operator pending mode, if then use normal j otherwise gj
This commit is contained in:
parent
a1c103b6a8
commit
2c33e3dd38
@ -19,10 +19,11 @@ M.misc = function()
|
|||||||
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
|
||||||
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
|
||||||
-- empty mode is same as using :map
|
-- empty mode is same as using :map
|
||||||
map("", "j", 'v:count ? "j" : "gj"', { 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("", "k", 'v:count ? "k" : "gk"', { expr = true })
|
map("", "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
|
||||||
map("", "<Down>", 'v:count ? "j" : "gj"', { expr = true })
|
map("", "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
|
||||||
map("", "<Up>", 'v:count ? "k" : "gk"', { expr = true })
|
map("", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
|
||||||
|
map("", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
|
||||||
|
|
||||||
-- use ESC to turn off search highlighting
|
-- use ESC to turn off search highlighting
|
||||||
map("n", "<Esc>", ":noh <CR>")
|
map("n", "<Esc>", ":noh <CR>")
|
||||||
|
Loading…
Reference in New Issue
Block a user