aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/motion.txt10
-rw-r--r--src/nvim/normal.c1
-rw-r--r--test/old/testdir/test_normal.vim13
3 files changed, 19 insertions, 5 deletions
diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt
index 26e4ada7d4..1a2df7d69a 100644
--- a/runtime/doc/motion.txt
+++ b/runtime/doc/motion.txt
@@ -355,11 +355,11 @@ gg Goto line [count], default first line, on the first
See also 'startofline' option.
:[range]go[to] [count] *:go* *:goto* *go*
-[count]go Go to [count] byte in the buffer. Default [count] is
- one, start of the file. When giving [range], the
- last number in it used as the byte count. End-of-line
- characters are counted depending on the current
- 'fileformat' setting.
+[count]go Go to [count] byte in the buffer. |exclusive| motion.
+ Default [count] is one, start of the file. When
+ giving [range], the last number in it used as the byte
+ count. End-of-line characters are counted depending
+ on the current 'fileformat' setting.
Also see the |line2byte()| function, and the 'o'
option in 'statusline'.
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 9e17fe234d..f44a64af21 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -5631,6 +5631,7 @@ static void nv_g_cmd(cmdarg_T *cap)
// "go": goto byte count from start of buffer
case 'o':
+ oap->inclusive = false;
goto_byte(cap->count0);
break;
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index 6ebdfb1604..8088b1fc57 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -4291,4 +4291,17 @@ func Test_scroll_longline_no_loop()
exe "normal! \<C-E>"
bwipe!
endfunc
+
+" Test for go command
+func Test_normal_go()
+ new
+ call setline(1, ['one two three four'])
+ call cursor(1, 5)
+ norm! dvgo
+ call assert_equal('wo three four', getline(1))
+ norm! ...
+ call assert_equal('three four', getline(1))
+
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab nofoldenable