diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-28 02:13:05 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-28 02:13:05 +0100 |
commit | 8b530c1ff91f07cf6b0289a536992b7dfbc86598 (patch) | |
tree | 6a672624551a6e1a4e07d5274c2149afdd486a35 /src/normal.c | |
parent | 077ff436a77f95c69da219af8cd8f553ff4f9ff8 (diff) | |
download | vim-git-8b530c1ff91f07cf6b0289a536992b7dfbc86598.tar.gz |
patch 8.1.2231: not easy to move to the middle of a text linev8.1.2231
Problem: Not easy to move to the middle of a text line.
Solution: Add the gM command. (Yasuhiro Matsumoto, closes #2070)
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/normal.c b/src/normal.c index f66a97c34..17db06a16 100644 --- a/src/normal.c +++ b/src/normal.c @@ -5979,6 +5979,24 @@ nv_g_cmd(cmdarg_T *cap) curwin->w_set_curswant = TRUE; break; + case 'M': + { + char_u *ptr = ml_get_curline(); + + oap->motion_type = MCHAR; + oap->inclusive = FALSE; + if (has_mbyte) + i = mb_string2cells(ptr, STRLEN(ptr)); + else + i = (int)STRLEN(ptr); + if (cap->count0 > 0 && cap->count0 <= 100) + coladvance((colnr_T)(i * cap->count0 / 100)); + else + coladvance((colnr_T)(i / 2)); + curwin->w_set_curswant = TRUE; + } + break; + case '_': /* "g_": to the last non-blank character in the line or <count> lines * downward. */ |