neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit f5588ee8968c564f6f7b0e42ac0ad44f83489659
parent 7a076306e4e35371160d1a5d09c92744b8461b57
Author: Famiu Haque <famiuhaque@protonmail.com>
Date:   Wed, 17 Aug 2022 17:50:40 +0600

feat: allow :wincmd to accept a count (#19815)

Let :wincmd command accept a count like what its documentation suggests.
Previously it could only accept a range, which led to some ambiguity on
which attribute should be used when executing :wincmd using nvim_cmd.

Closes #19662.

Also fix a typo in a related Vim test:

vim-patch:9.0.0223: typo in diffmode test

Problem:    Typo in diffmode test.
Solution:   Fix the typo. (closes vim/vim#10932)
https://github.com/vim/vim/commit/5fd6ab820b4a0aaa5c6020852f39d118375fab49
Diffstat:
Mruntime/doc/vim_diff.txt | 1+
Mruntime/doc/windows.txt | 1+
Msrc/nvim/ex_cmds.lua | 2+-
Msrc/nvim/testdir/test_diffmode.vim | 2+-
Atest/functional/ex_cmds/wincmd_spec.lua | 13+++++++++++++
5 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt @@ -372,6 +372,7 @@ Lua interface (|lua.txt|): Commands: |:doautocmd| does not warn about "No matching autocommands". + |:wincmd| accepts a count. Functions: |input()| and |inputdialog()| support for each other’s features (return on diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt @@ -442,6 +442,7 @@ position is set to keep the same Visual area selected. These commands can also be executed with ":wincmd": :[count]winc[md] {arg} +:winc[md] [count] {arg} Like executing CTRL-W [count] {arg}. Example: > :wincmd j < Moves to the window below the current one. diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua @@ -3181,7 +3181,7 @@ module.cmds = { }, { command='wincmd', - flags=bit.bor(NEEDARG, WORD1, RANGE, CMDWIN, LOCK_OK), + flags=bit.bor(NEEDARG, WORD1, RANGE, COUNT, CMDWIN, LOCK_OK), addr_type='ADDR_OTHER', func='ex_wincmd', }, diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim @@ -137,7 +137,7 @@ func Common_vert_split() " Test diffoff diffoff! - 1wincmd 2 + 1wincmd w let &diff = 1 let &fdm = diff_fdm let &fdc = diff_fdc diff --git a/test/functional/ex_cmds/wincmd_spec.lua b/test/functional/ex_cmds/wincmd_spec.lua @@ -0,0 +1,13 @@ +local helpers = require("test.functional.helpers")(after_each) +local clear = helpers.clear +local eq = helpers.eq +local funcs = helpers.funcs +local command = helpers.command + +it(':wincmd accepts a count', function() + clear() + command('vsplit') + eq(1, funcs.winnr()) + command('wincmd 2 w') + eq(2, funcs.winnr()) +end)