mirror of
https://github.com/neovim/neovim.git
synced 2025-10-18 15:51:50 +00:00
Merge pull request #2041 from fmoralesc/command-ranges
Command ranges (was PR #1793)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*editing.txt* For Vim version 7.4. Last change: 2014 Jul 19
|
*editing.txt* For Vim version 7.4. Last change: 2015 Apr 18
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -801,8 +801,9 @@ current window. The two windows then share this list, until one of them uses
|
|||||||
USING THE ARGUMENT LIST
|
USING THE ARGUMENT LIST
|
||||||
|
|
||||||
*:argdo*
|
*:argdo*
|
||||||
:argdo[!] {cmd} Execute {cmd} for each file in the argument list.
|
:[range]argdo[!] {cmd} Execute {cmd} for each file in the argument list or,
|
||||||
It works like doing this: >
|
if [range] is specified, only for arguments in that
|
||||||
|
range. It works like doing this: >
|
||||||
:rewind
|
:rewind
|
||||||
:{cmd}
|
:{cmd}
|
||||||
:next
|
:next
|
||||||
|
@@ -1358,6 +1358,20 @@ Possible attributes are:
|
|||||||
Note that -range=N and -count=N are mutually exclusive - only one should be
|
Note that -range=N and -count=N are mutually exclusive - only one should be
|
||||||
specified.
|
specified.
|
||||||
|
|
||||||
|
*E889* *:command-addr*
|
||||||
|
It is possible that the special characters in the range like `.`, `$` or `%`
|
||||||
|
which by default correspond to the current line, last line and the whole
|
||||||
|
buffer, relate to arguments, (loaded) buffers, windows or tab pages.
|
||||||
|
|
||||||
|
Possible values are:
|
||||||
|
-addr=lines Range of lines (this is the default)
|
||||||
|
-addr=arguments Range for arguments
|
||||||
|
-addr=buffers Range for buffers (also not loaded buffers)
|
||||||
|
-addr=loaded_buffers Range for loaded buffers
|
||||||
|
-addr=windows Range for windows
|
||||||
|
-addr=tabs Range for tab pages
|
||||||
|
|
||||||
|
|
||||||
Special cases *:command-bang* *:command-bar*
|
Special cases *:command-bang* *:command-bar*
|
||||||
*:command-register* *:command-buffer*
|
*:command-register* *:command-buffer*
|
||||||
There are some special cases as well:
|
There are some special cases as well:
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
*tabpage.txt* For Vim version 7.4. Last change: 2012 Aug 08
|
*tabpage.txt* For Vim version 7.4. Last change: 2015 Apr 18
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -61,16 +61,25 @@ In the GUI tab pages line you can use the right mouse button to open menu.
|
|||||||
:[count]tabe[dit] *:tabe* *:tabedit* *:tabnew*
|
:[count]tabe[dit] *:tabe* *:tabedit* *:tabnew*
|
||||||
:[count]tabnew
|
:[count]tabnew
|
||||||
Open a new tab page with an empty window, after the current
|
Open a new tab page with an empty window, after the current
|
||||||
tab page. For [count] see |:tab| below.
|
tab page. If [count] is given the new tab page appears after
|
||||||
|
the tabpage [count] otherwise the new tab page will appear
|
||||||
|
after the current one. >
|
||||||
|
:tabnew " opens tabpage after the current one
|
||||||
|
:.tabnew " as above
|
||||||
|
:+tabnew " opens tabpage after the next tab page
|
||||||
|
" note: it is one further than :tabnew
|
||||||
|
:-tabnew " opens tabpage before the current
|
||||||
|
:0tabnew " opens tabpage before the first one
|
||||||
|
:$tabnew " opens tabpage after the last one
|
||||||
|
|
||||||
:[count]tabe[dit] [++opt] [+cmd] {file}
|
:[count]tabe[dit] [++opt] [+cmd] {file}
|
||||||
:[count]tabnew [++opt] [+cmd] {file}
|
:[count]tabnew [++opt] [+cmd] {file}
|
||||||
Open a new tab page and edit {file}, like with |:edit|.
|
Open a new tab page and edit {file}, like with |:edit|.
|
||||||
For [count] see |:tab| below.
|
For [count] see |:tabnew| above.
|
||||||
|
|
||||||
:[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind*
|
:[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind*
|
||||||
Open a new tab page and edit {file} in 'path', like with
|
Open a new tab page and edit {file} in 'path', like with
|
||||||
|:find|. For [count] see |:tab| below.
|
|:find|. For [count] see |:tabnew| above.
|
||||||
{not available when the |+file_in_path| feature was disabled
|
{not available when the |+file_in_path| feature was disabled
|
||||||
at compile time}
|
at compile time}
|
||||||
|
|
||||||
@@ -110,12 +119,18 @@ something else.
|
|||||||
- When 'hidden' is not set, [!] is not used, a buffer has
|
- When 'hidden' is not set, [!] is not used, a buffer has
|
||||||
changes, and there is no other window on this buffer.
|
changes, and there is no other window on this buffer.
|
||||||
Changes to the buffer are not written and won't get lost, so
|
Changes to the buffer are not written and won't get lost, so
|
||||||
this is a "safe" command.
|
this is a "safe" command. >
|
||||||
|
:tabclose " close the current tab page
|
||||||
|
|
||||||
|
:{count}tabc[lose][!]
|
||||||
:tabc[lose][!] {count}
|
:tabc[lose][!] {count}
|
||||||
Close tab page {count}. Fails in the same way as `:tabclose`
|
Close tab page {count}. Fails in the same way as `:tabclose`
|
||||||
above.
|
above. >
|
||||||
|
:-tabclose " close the previous tab page
|
||||||
|
:+tabclose " close the next tab page
|
||||||
|
:1tabclose " close the first tab page
|
||||||
|
:$tabclose " close the last tab page
|
||||||
|
<
|
||||||
*:tabo* *:tabonly*
|
*:tabo* *:tabonly*
|
||||||
:tabo[nly][!] Close all other tab pages.
|
:tabo[nly][!] Close all other tab pages.
|
||||||
When the 'hidden' option is set, all buffers in closed windows
|
When the 'hidden' option is set, all buffers in closed windows
|
||||||
@@ -124,7 +139,16 @@ something else.
|
|||||||
modified buffers are written. Otherwise, windows that have
|
modified buffers are written. Otherwise, windows that have
|
||||||
buffers that are modified are not removed, unless the [!] is
|
buffers that are modified are not removed, unless the [!] is
|
||||||
given, then they become hidden. But modified buffers are
|
given, then they become hidden. But modified buffers are
|
||||||
never abandoned, so changes cannot get lost.
|
never abandoned, so changes cannot get lost. >
|
||||||
|
:tabonly " close all tab pages except the current one
|
||||||
|
|
||||||
|
:{count}tabo[nly][!]
|
||||||
|
Close all tab pages except the {count}th one. >
|
||||||
|
:.tabonly " one
|
||||||
|
:-tabonly " close all tab pages except the previous one
|
||||||
|
:+tabonly " close all tab pages except the next one
|
||||||
|
:1tabonly " close all tab pages except the first one
|
||||||
|
:$tabonly " close all tab pages except the last one.
|
||||||
|
|
||||||
|
|
||||||
SWITCHING TO ANOTHER TAB PAGE:
|
SWITCHING TO ANOTHER TAB PAGE:
|
||||||
@@ -176,8 +200,15 @@ REORDERING TAB PAGES:
|
|||||||
:[N]tabm[ove]
|
:[N]tabm[ove]
|
||||||
Move the current tab page to after tab page N. Use zero to
|
Move the current tab page to after tab page N. Use zero to
|
||||||
make the current tab page the first one. Without N the tab
|
make the current tab page the first one. Without N the tab
|
||||||
page is made the last one.
|
page is made the last one. >
|
||||||
|
:-tabmove " move the tab page to the left
|
||||||
|
:tabmove " move the tab page to the right
|
||||||
|
:.tabmove " as above
|
||||||
|
:+tabmove " as above
|
||||||
|
:0tabmove " move the tab page to the beginning of the tab
|
||||||
|
" list
|
||||||
|
:$tabmove " move the tab page to the end of the tab list
|
||||||
|
<
|
||||||
:tabm[ove] +[N]
|
:tabm[ove] +[N]
|
||||||
:tabm[ove] -[N]
|
:tabm[ove] -[N]
|
||||||
Move the current tab page N places to the right (with +) or to
|
Move the current tab page N places to the right (with +) or to
|
||||||
@@ -191,8 +222,10 @@ clarification what +N means in this context see |[range]|.
|
|||||||
LOOPING OVER TAB PAGES:
|
LOOPING OVER TAB PAGES:
|
||||||
|
|
||||||
*:tabd* *:tabdo*
|
*:tabd* *:tabdo*
|
||||||
:tabd[o] {cmd} Execute {cmd} in each tab page.
|
:[range]tabd[o] {cmd}
|
||||||
It works like doing this: >
|
Execute {cmd} in each tab page or, if [range] is given, only
|
||||||
|
in tabpages which tab page number is in the [range]. It works
|
||||||
|
like doing this: >
|
||||||
:tabfirst
|
:tabfirst
|
||||||
:{cmd}
|
:{cmd}
|
||||||
:tabnext
|
:tabnext
|
||||||
|
@@ -263,28 +263,54 @@ left of the Vim window.
|
|||||||
Closing a window
|
Closing a window
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
:q[uit]
|
||||||
|
:{count}q[uit]
|
||||||
CTRL-W q *CTRL-W_q*
|
CTRL-W q *CTRL-W_q*
|
||||||
CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
|
CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
|
||||||
:q[uit] Quit current window. When quitting the last window (not
|
Without {count}: Quit the current window. If {count} is
|
||||||
counting a help window), exit Vim.
|
given quit the {count} window
|
||||||
|
|
||||||
|
When quitting the last window (not counting a help window),
|
||||||
|
exit Vim.
|
||||||
|
|
||||||
When 'hidden' is set, and there is only one window for the
|
When 'hidden' is set, and there is only one window for the
|
||||||
current buffer, it becomes hidden.
|
current buffer, it becomes hidden. When 'hidden' is not set,
|
||||||
When 'hidden' is not set, and there is only one window for the
|
and there is only one window for the current buffer, and the
|
||||||
current buffer, and the buffer was changed, the command fails.
|
buffer was changed, the command fails.
|
||||||
(Note: CTRL-Q does not work on all terminals)
|
(Note: CTRL-Q does not work on all terminals).
|
||||||
|
If [count] is greater than the last window number the last
|
||||||
:q[uit]! Quit current window. If this was the last window for a buffer,
|
window will be closed: >
|
||||||
any changes to that buffer are lost. When quitting the last
|
:1quit " quit the first window
|
||||||
window (not counting help windows), exit Vim. The contents of
|
:$quit " quit the last window
|
||||||
the buffer are lost, even when 'hidden' is set.
|
:9quit " quit the last window
|
||||||
|
" if there are less than 9 windows opened
|
||||||
|
:-quit " quit the previous window
|
||||||
|
:+quit " quit the next window
|
||||||
|
:+2quit " will also work as expected
|
||||||
|
<
|
||||||
|
:q[uit]!
|
||||||
|
:{count}q[uit]!
|
||||||
|
Without {count}: Quit the current window. If {count} is
|
||||||
|
given quit the {count} window
|
||||||
|
If this was the last window for a buffer, any changes to that
|
||||||
|
buffer are lost. When quitting the last window (not counting
|
||||||
|
help windows), exit Vim. The contents of the buffer are lost,
|
||||||
|
even when 'hidden' is set.
|
||||||
|
|
||||||
|
:clo[se][!]
|
||||||
|
:{count}clo[se][!]
|
||||||
CTRL-W c *CTRL-W_c* *:clo* *:close*
|
CTRL-W c *CTRL-W_c* *:clo* *:close*
|
||||||
:clo[se][!] Close current window. When the 'hidden' option is set, or
|
Without {count}: Close the current window. If given close the
|
||||||
when the buffer was changed and the [!] is used, the buffer
|
{count} window.
|
||||||
becomes hidden (unless there is another window editing it).
|
|
||||||
|
When 'hidden' is set, or when the buffer was changed and the
|
||||||
|
[!] is used, the buffer becomes hidden (unless there is another
|
||||||
|
window editing it).
|
||||||
|
|
||||||
When there is only one window in the current tab page and
|
When there is only one window in the current tab page and
|
||||||
there is another tab page, this closes the current tab page.
|
there is another tab page, this closes the current tab page.
|
||||||
|tab-page|.
|
|tab-page|.
|
||||||
|
|
||||||
This command fails when: *E444*
|
This command fails when: *E444*
|
||||||
- There is only one window on the screen.
|
- There is only one window on the screen.
|
||||||
- When 'hidden' is not set, [!] is not used, the buffer has
|
- When 'hidden' is not set, [!] is not used, the buffer has
|
||||||
@@ -297,29 +323,38 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C*
|
|||||||
window, but that does not work, because the CTRL-C cancels the
|
window, but that does not work, because the CTRL-C cancels the
|
||||||
command.
|
command.
|
||||||
|
|
||||||
*:hide*
|
*:hide*
|
||||||
:hid[e] Quit current window, unless it is the last window on the
|
:hid[e]
|
||||||
screen. The buffer becomes hidden (unless there is another
|
:{count}hid[e]
|
||||||
window editing it or 'bufhidden' is "unload" or "delete").
|
Quit the current window, unless it is the last window on the
|
||||||
If the window is the last one in the current tab page the tab
|
screen. For {count} see |:quit|.
|
||||||
page is closed. |tab-page|
|
|
||||||
|
The buffer becomes hidden (unless there is another window
|
||||||
|
editing it or 'bufhidden' is `unload` or `delete`). If the
|
||||||
|
window is the last one in the current tab page the tab page is
|
||||||
|
closed. |tab-page|
|
||||||
|
|
||||||
The value of 'hidden' is irrelevant for this command.
|
The value of 'hidden' is irrelevant for this command.
|
||||||
Changes to the buffer are not written and won't get lost, so
|
Changes to the buffer are not written and won't get lost, so
|
||||||
this is a "safe" command.
|
this is a "safe" command.
|
||||||
|
|
||||||
:hid[e] {cmd} Execute {cmd} with 'hidden' is set. The previous value of
|
:hid[e] {cmd} Execute {cmd} with 'hidden' set. The previous value of
|
||||||
'hidden' is restored after {cmd} has been executed.
|
'hidden' is restored after {cmd} has been executed.
|
||||||
Example: >
|
Example: >
|
||||||
:hide edit Makefile
|
:hide edit Makefile
|
||||||
< This will edit "Makefile", and hide the current buffer if it
|
< This will edit "Makefile", and hide the current buffer if it
|
||||||
has any changes.
|
has any changes.
|
||||||
|
|
||||||
|
:on[ly][!]
|
||||||
|
:{count}on[ly][!]
|
||||||
CTRL-W o *CTRL-W_o* *E445*
|
CTRL-W o *CTRL-W_o* *E445*
|
||||||
CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only*
|
CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only*
|
||||||
:on[ly][!] Make the current window the only one on the screen. All other
|
Make the current window the only one on the screen. All other
|
||||||
windows are closed.
|
windows are closed. For {count} see |:quit|.
|
||||||
|
|
||||||
When the 'hidden' option is set, all buffers in closed windows
|
When the 'hidden' option is set, all buffers in closed windows
|
||||||
become hidden.
|
become hidden.
|
||||||
|
|
||||||
When 'hidden' is not set, and the 'autowrite' option is set,
|
When 'hidden' is not set, and the 'autowrite' option is set,
|
||||||
modified buffers are written. Otherwise, windows that have
|
modified buffers are written. Otherwise, windows that have
|
||||||
buffers that are modified are not removed, unless the [!] is
|
buffers that are modified are not removed, unless the [!] is
|
||||||
@@ -660,8 +695,9 @@ can also get to them with the buffer list commands, like ":bnext".
|
|||||||
8. Do a command in all buffers or windows *list-repeat*
|
8. Do a command in all buffers or windows *list-repeat*
|
||||||
|
|
||||||
*:windo*
|
*:windo*
|
||||||
:windo {cmd} Execute {cmd} in each window.
|
:[range]windo {cmd} Execute {cmd} in each window or if [range] is given
|
||||||
It works like doing this: >
|
only in windows for which the window number lies in
|
||||||
|
the [range]. It works like doing this: >
|
||||||
CTRL-W t
|
CTRL-W t
|
||||||
:{cmd}
|
:{cmd}
|
||||||
CTRL-W w
|
CTRL-W w
|
||||||
@@ -679,8 +715,10 @@ can also get to them with the buffer list commands, like ":bnext".
|
|||||||
Also see |:tabdo|, |:argdo| and |:bufdo|.
|
Also see |:tabdo|, |:argdo| and |:bufdo|.
|
||||||
|
|
||||||
*:bufdo*
|
*:bufdo*
|
||||||
:bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list.
|
:[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if
|
||||||
It works like doing this: >
|
[range[ is given only for buffers for which their
|
||||||
|
buffer name is in the [range]. It works like doing
|
||||||
|
this: >
|
||||||
:bfirst
|
:bfirst
|
||||||
:{cmd}
|
:{cmd}
|
||||||
:bnext
|
:bnext
|
||||||
@@ -992,8 +1030,11 @@ list of buffers. |unlisted-buffer|
|
|||||||
Actually, the buffer isn't completely deleted, it is removed
|
Actually, the buffer isn't completely deleted, it is removed
|
||||||
from the buffer list |unlisted-buffer| and option values,
|
from the buffer list |unlisted-buffer| and option values,
|
||||||
variables and mappings/abbreviations for the buffer are
|
variables and mappings/abbreviations for the buffer are
|
||||||
cleared.
|
cleared. Examples: >
|
||||||
|
:.,$-bdelete "delete buffers from the current one to
|
||||||
|
" last but one
|
||||||
|
:%bdelete " delete all buffers
|
||||||
|
<
|
||||||
:bdelete[!] {bufname} *E93* *E94*
|
:bdelete[!] {bufname} *E93* *E94*
|
||||||
Like ":bdelete[!] [N]", but buffer given by name. Note that a
|
Like ":bdelete[!] [N]", but buffer given by name. Note that a
|
||||||
buffer whose name is a number cannot be referenced by that
|
buffer whose name is a number cannot be referenced by that
|
||||||
@@ -1016,8 +1057,11 @@ list of buffers. |unlisted-buffer|
|
|||||||
Like |:bdelete|, but really delete the buffer. Everything
|
Like |:bdelete|, but really delete the buffer. Everything
|
||||||
related to the buffer is lost. All marks in this buffer
|
related to the buffer is lost. All marks in this buffer
|
||||||
become invalid, option settings are lost, etc. Don't use this
|
become invalid, option settings are lost, etc. Don't use this
|
||||||
unless you know what you are doing.
|
unless you know what you are doing. Examples: >
|
||||||
|
:.+,$bwipeout " wipe out all buffers after the current
|
||||||
|
" one
|
||||||
|
:%bwipeout " wipe out all buffers
|
||||||
|
<
|
||||||
:[N]bun[load][!] *:bun* *:bunload* *E515*
|
:[N]bun[load][!] *:bun* *:bunload* *E515*
|
||||||
:bun[load][!] [N]
|
:bun[load][!] [N]
|
||||||
Unload buffer [N] (default: current buffer). The memory
|
Unload buffer [N] (default: current buffer). The memory
|
||||||
|
@@ -67,8 +67,9 @@ for i, cmd in ipairs(defs) do
|
|||||||
[%s] = {
|
[%s] = {
|
||||||
.cmd_name = (char_u *) "%s",
|
.cmd_name = (char_u *) "%s",
|
||||||
.cmd_func = &%s,
|
.cmd_func = &%s,
|
||||||
.cmd_argt = %u
|
.cmd_argt = %uL,
|
||||||
}]], enumname, cmd.command, cmd.func, cmd.flags))
|
.cmd_addr_type = %i
|
||||||
|
}]], enumname, cmd.command, cmd.func, cmd.flags, cmd.addr_type))
|
||||||
end
|
end
|
||||||
defsfile:write([[
|
defsfile:write([[
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1844,13 +1844,33 @@ void ex_listdo(exarg_T *eap)
|
|||||||
|| !check_changed(curbuf, CCGD_AW
|
|| !check_changed(curbuf, CCGD_AW
|
||||||
| (eap->forceit ? CCGD_FORCEIT : 0)
|
| (eap->forceit ? CCGD_FORCEIT : 0)
|
||||||
| CCGD_EXCMD)) {
|
| CCGD_EXCMD)) {
|
||||||
/* start at the first argument/window/buffer */
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
/* start at the eap->line1 argument/window/buffer */
|
||||||
wp = firstwin;
|
wp = firstwin;
|
||||||
tp = first_tabpage;
|
tp = first_tabpage;
|
||||||
|
switch (eap->cmdidx) {
|
||||||
|
case CMD_windo:
|
||||||
|
for (; wp != NULL && i + 1 < eap->line1; wp = wp->w_next) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CMD_tabdo:
|
||||||
|
for (; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CMD_argdo:
|
||||||
|
i = eap->line1 - 1;
|
||||||
|
break;
|
||||||
|
case CMD_bufdo:
|
||||||
|
i = eap->line1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* set pcmark now */
|
/* set pcmark now */
|
||||||
if (eap->cmdidx == CMD_bufdo)
|
if (eap->cmdidx == CMD_bufdo)
|
||||||
goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
|
goto_buffer(eap, DOBUF_FIRST, FORWARD, i);
|
||||||
else
|
else
|
||||||
setpcmark();
|
setpcmark();
|
||||||
listcmd_busy = TRUE; /* avoids setting pcmark below */
|
listcmd_busy = TRUE; /* avoids setting pcmark below */
|
||||||
@@ -1873,7 +1893,6 @@ void ex_listdo(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
if (curwin->w_arg_idx != i)
|
if (curwin->w_arg_idx != i)
|
||||||
break;
|
break;
|
||||||
++i;
|
|
||||||
} else if (eap->cmdidx == CMD_windo) {
|
} else if (eap->cmdidx == CMD_windo) {
|
||||||
/* go to window "wp" */
|
/* go to window "wp" */
|
||||||
if (!win_valid(wp))
|
if (!win_valid(wp))
|
||||||
@@ -1899,13 +1918,14 @@ void ex_listdo(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++i;
|
||||||
/* execute the command */
|
/* execute the command */
|
||||||
do_cmdline(eap->arg, eap->getline, eap->cookie,
|
do_cmdline(eap->arg, eap->getline, eap->cookie,
|
||||||
DOCMD_VERBOSE + DOCMD_NOWAIT);
|
DOCMD_VERBOSE + DOCMD_NOWAIT);
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_bufdo) {
|
if (eap->cmdidx == CMD_bufdo) {
|
||||||
/* Done? */
|
/* Done? */
|
||||||
if (next_fnum < 0)
|
if (next_fnum < 0 || next_fnum > eap->line2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Check if the buffer still exists. */
|
/* Check if the buffer still exists. */
|
||||||
@@ -1939,6 +1959,14 @@ void ex_listdo(exarg_T *eap)
|
|||||||
if (curwin->w_p_scb)
|
if (curwin->w_p_scb)
|
||||||
do_check_scrollbind(TRUE);
|
do_check_scrollbind(TRUE);
|
||||||
}
|
}
|
||||||
|
if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo) {
|
||||||
|
if (i + 1 > eap->line2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (eap->cmdidx == CMD_argdo && i >= eap->line2) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
listcmd_busy = FALSE;
|
listcmd_busy = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -71,6 +71,14 @@
|
|||||||
#define WORD1 (EXTRA | NOSPC) /* one extra word allowed */
|
#define WORD1 (EXTRA | NOSPC) /* one extra word allowed */
|
||||||
#define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */
|
#define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */
|
||||||
|
|
||||||
|
// values for cmd_addr_type
|
||||||
|
#define ADDR_LINES 0
|
||||||
|
#define ADDR_WINDOWS 1
|
||||||
|
#define ADDR_ARGUMENTS 2
|
||||||
|
#define ADDR_LOADED_BUFFERS 3
|
||||||
|
#define ADDR_BUFFERS 4
|
||||||
|
#define ADDR_TABS 5
|
||||||
|
|
||||||
typedef struct exarg exarg_T;
|
typedef struct exarg exarg_T;
|
||||||
|
|
||||||
/* behavior for bad character, "++bad=" argument */
|
/* behavior for bad character, "++bad=" argument */
|
||||||
@@ -87,6 +95,7 @@ typedef struct cmdname {
|
|||||||
char_u *cmd_name; ///< Name of the command.
|
char_u *cmd_name; ///< Name of the command.
|
||||||
ex_func_T cmd_func; ///< Function with implementation of this command.
|
ex_func_T cmd_func; ///< Function with implementation of this command.
|
||||||
uint32_t cmd_argt; ///< Relevant flags from the declared above.
|
uint32_t cmd_argt; ///< Relevant flags from the declared above.
|
||||||
|
int cmd_addr_type; ///< Flag for address type
|
||||||
} CommandDefinition;
|
} CommandDefinition;
|
||||||
|
|
||||||
/// Arguments used for Ex commands.
|
/// Arguments used for Ex commands.
|
||||||
@@ -102,6 +111,7 @@ struct exarg {
|
|||||||
int addr_count; ///< the number of addresses given
|
int addr_count; ///< the number of addresses given
|
||||||
linenr_T line1; ///< the first line number
|
linenr_T line1; ///< the first line number
|
||||||
linenr_T line2; ///< the second line number or count
|
linenr_T line2; ///< the second line number or count
|
||||||
|
int addr_type; ///< type of the count/range
|
||||||
int flags; ///< extra flags after count: EXFLAG_
|
int flags; ///< extra flags after count: EXFLAG_
|
||||||
char_u *do_ecmd_cmd; ///< +command arg to be used in edited file
|
char_u *do_ecmd_cmd; ///< +command arg to be used in edited file
|
||||||
linenr_T do_ecmd_lnum; ///< the line number in an edited file
|
linenr_T do_ecmd_lnum; ///< the line number in an edited file
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -3701,6 +3701,7 @@ ExpandFromContext (
|
|||||||
{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
|
{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
|
||||||
{EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
|
{EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
|
||||||
{EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
|
{EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
|
||||||
|
{EXPAND_USER_ADDR_TYPE, get_user_cmd_addr_type, FALSE, TRUE},
|
||||||
{EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
|
{EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
|
||||||
{EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE},
|
{EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE},
|
||||||
{EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE},
|
{EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE},
|
||||||
|
@@ -29,7 +29,11 @@ SCRIPTS := test_autoformat_join.out \
|
|||||||
test86.out test87.out test88.out \
|
test86.out test87.out test88.out \
|
||||||
test96.out \
|
test96.out \
|
||||||
test_listlbr.out \
|
test_listlbr.out \
|
||||||
test_breakindent.out
|
test_breakindent.out \
|
||||||
|
test_argument_count.out \
|
||||||
|
test_close_count.out \
|
||||||
|
test_command_count.out \
|
||||||
|
test_argument_0count.out
|
||||||
|
|
||||||
SCRIPTS_GUI := test16.out
|
SCRIPTS_GUI := test16.out
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ STARTTEST
|
|||||||
:" Open three tab pages and use ":tabdo"
|
:" Open three tab pages and use ":tabdo"
|
||||||
:0tabnew
|
:0tabnew
|
||||||
:1tabnew
|
:1tabnew
|
||||||
:888tabnew
|
:$tabnew
|
||||||
:tabdo call append(line('$'), 'this is tab page ' . tabpagenr())
|
:tabdo call append(line('$'), 'this is tab page ' . tabpagenr())
|
||||||
:tabclose! 2
|
:tabclose! 2
|
||||||
:tabrewind
|
:tabrewind
|
||||||
|
28
src/nvim/testdir/test_argument_0count.in
Normal file
28
src/nvim/testdir/test_argument_0count.in
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
Tests for :0argadd and :0argedit vim: set ft=vim :
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:so small.vim
|
||||||
|
:let arglists = []
|
||||||
|
:%argd
|
||||||
|
:arga a b c d
|
||||||
|
:2argu
|
||||||
|
:0arga added
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:2argu
|
||||||
|
:arga third
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:%argd
|
||||||
|
:arga a b c d
|
||||||
|
:2argu
|
||||||
|
:0arge edited
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:2argu
|
||||||
|
:arga third
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:e! test.out
|
||||||
|
:call append(0, map(copy(arglists), 'join(v:val, " ")'))
|
||||||
|
:w
|
||||||
|
:qa!
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
|
5
src/nvim/testdir/test_argument_0count.ok
Normal file
5
src/nvim/testdir/test_argument_0count.ok
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
added a b c d
|
||||||
|
added a third b c d
|
||||||
|
edited a b c d
|
||||||
|
edited a third b c d
|
||||||
|
|
46
src/nvim/testdir/test_argument_count.in
Normal file
46
src/nvim/testdir/test_argument_count.in
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Tests for :[count]argument! and :[count]argdelete vim: set ft=vim :
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:%argd
|
||||||
|
:argadd a b c d
|
||||||
|
:set hidden
|
||||||
|
:let buffers = []
|
||||||
|
:augroup TEST
|
||||||
|
:au BufEnter * call add(buffers, expand('%:t'))
|
||||||
|
:augroup END
|
||||||
|
:$argu
|
||||||
|
:$-argu
|
||||||
|
:-argu
|
||||||
|
:1argu
|
||||||
|
:+2argu
|
||||||
|
:augroup TEST
|
||||||
|
:au!
|
||||||
|
:augroup END
|
||||||
|
:let arglists = []
|
||||||
|
:.argd
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:-argd
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:$argd
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:1arga c
|
||||||
|
:1arga b
|
||||||
|
:$argu
|
||||||
|
:$arga x
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:0arga Y
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:%argd
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:arga a b c d e f
|
||||||
|
:2,$-argd
|
||||||
|
:call add(arglists, argv())
|
||||||
|
:e! test.out
|
||||||
|
:call append(0, buffers)
|
||||||
|
:let lnr = line('$')
|
||||||
|
:call append(lnr, map(copy(arglists), 'join(v:val, " ")'))
|
||||||
|
:w
|
||||||
|
:qa!
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
|
13
src/nvim/testdir/test_argument_count.ok
Normal file
13
src/nvim/testdir/test_argument_count.ok
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
d
|
||||||
|
c
|
||||||
|
b
|
||||||
|
a
|
||||||
|
c
|
||||||
|
|
||||||
|
a b d
|
||||||
|
a d
|
||||||
|
a
|
||||||
|
a b c x
|
||||||
|
Y a b c x
|
||||||
|
|
||||||
|
a f
|
156
src/nvim/testdir/test_close_count.in
Normal file
156
src/nvim/testdir/test_close_count.in
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
Tests for :[count]close! and :[count]hide vim: set ft=vim :
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:let tests = []
|
||||||
|
:so tiny.vim
|
||||||
|
:for i in range(5)
|
||||||
|
:new
|
||||||
|
:endfor
|
||||||
|
:4wincmd w
|
||||||
|
:close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:$close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1wincmd w
|
||||||
|
:2close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1wincmd w
|
||||||
|
:new
|
||||||
|
:new
|
||||||
|
:2wincmd w
|
||||||
|
:-1close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:2wincmd w
|
||||||
|
:+1close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:e! test.out
|
||||||
|
:call append(0, map(copy(tests), 'join(v:val, " ")'))
|
||||||
|
:w
|
||||||
|
:only!
|
||||||
|
:b1
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:let tests = []
|
||||||
|
:so tiny.vim
|
||||||
|
:for i in range(5)
|
||||||
|
:new
|
||||||
|
:endfor
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:4wincmd w
|
||||||
|
:.hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:$hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1wincmd w
|
||||||
|
:2hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1wincmd w
|
||||||
|
:new
|
||||||
|
:new
|
||||||
|
:3wincmd w
|
||||||
|
:-hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:2wincmd w
|
||||||
|
:+hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:e! test.out
|
||||||
|
:call append(line('$'), map(copy(tests), 'join(v:val, " ")'))
|
||||||
|
Go
|
||||||
|
:w
|
||||||
|
:only!
|
||||||
|
:b1
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:let tests = []
|
||||||
|
:so tiny.vim
|
||||||
|
:set hidden
|
||||||
|
:for i in range(5)
|
||||||
|
:new
|
||||||
|
:endfor
|
||||||
|
:1wincmd w
|
||||||
|
:$ hide
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:$-1 close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1wincmd w
|
||||||
|
:.+close!
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:e! test.out
|
||||||
|
:call append(line('$'), map(copy(tests), 'join(v:val, " ")'))
|
||||||
|
Go
|
||||||
|
:w
|
||||||
|
:only!
|
||||||
|
:b1
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:let tests = []
|
||||||
|
:so tiny.vim
|
||||||
|
:set hidden
|
||||||
|
:for i in range(5)
|
||||||
|
:new
|
||||||
|
:endfor
|
||||||
|
:4wincmd w
|
||||||
|
c
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
1c
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
9c
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:1wincmd w
|
||||||
|
2c
|
||||||
|
:let buffers = []
|
||||||
|
:windo call add(buffers, bufnr('%'))
|
||||||
|
:call add(tests, buffers)
|
||||||
|
:only!
|
||||||
|
:e! test.out
|
||||||
|
:call append(line('$'), map(copy(tests), 'join(v:val, " ")'))
|
||||||
|
:w
|
||||||
|
:qa!
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
|
23
src/nvim/testdir/test_close_count.ok
Normal file
23
src/nvim/testdir/test_close_count.ok
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
6 5 4 2 1
|
||||||
|
5 4 2 1
|
||||||
|
5 4 2
|
||||||
|
5 2
|
||||||
|
7 5 2
|
||||||
|
7 5
|
||||||
|
|
||||||
|
13 12 11 10 9 1
|
||||||
|
13 12 11 9 1
|
||||||
|
12 11 9 1
|
||||||
|
12 11 9
|
||||||
|
12 9
|
||||||
|
15 12 9
|
||||||
|
15 12
|
||||||
|
|
||||||
|
20 19 18 17 16
|
||||||
|
20 19 18 16
|
||||||
|
20 18 16
|
||||||
|
|
||||||
|
25 24 23 21 1
|
||||||
|
24 23 21 1
|
||||||
|
24 23 21
|
||||||
|
24 21
|
157
src/nvim/testdir/test_command_count.in
Normal file
157
src/nvim/testdir/test_command_count.in
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
Test for user command counts vim: set ft=vim :
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:so tiny.vim
|
||||||
|
:lang C
|
||||||
|
:let g:lines = []
|
||||||
|
:com -range=% RangeLines :call add(g:lines, 'RangeLines '.<line1>.' '.<line2>)
|
||||||
|
:com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '.<line1>.' '.<line2>)
|
||||||
|
:com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '.<line1>.' '.<line2>)
|
||||||
|
:com -range -addr=loaded_buffers RangeLoadedBuffers :call add(g:lines, 'RangeLoadedBuffers '.<line1>.' '.<line2>)
|
||||||
|
:com -range=% -addr=loaded_buffers RangeLoadedBuffersAll :call add(g:lines, 'RangeLoadedBuffersAll '.<line1>.' '.<line2>)
|
||||||
|
:com -range -addr=buffers RangeBuffers :call add(g:lines, 'RangeBuffers '.<line1>.' '.<line2>)
|
||||||
|
:com -range=% -addr=buffers RangeBuffersAll :call add(g:lines, 'RangeBuffersAll '.<line1>.' '.<line2>)
|
||||||
|
:com -range -addr=windows RangeWindows :call add(g:lines, 'RangeWindows '.<line1>.' '.<line2>)
|
||||||
|
:com -range=% -addr=windows RangeWindowsAll :call add(g:lines, 'RangeWindowsAll '.<line1>.' '.<line2>)
|
||||||
|
:com -range -addr=tabs RangeTabs :call add(g:lines, 'RangeTabs '.<line1>.' '.<line2>)
|
||||||
|
:com -range=% -addr=tabs RangeTabsAll :call add(g:lines, 'RangeTabsAll '.<line1>.' '.<line2>)
|
||||||
|
:set hidden
|
||||||
|
:arga a b c d
|
||||||
|
:argdo echo "loading buffers"
|
||||||
|
:argu 3
|
||||||
|
:.-,$-RangeArguments
|
||||||
|
:%RangeArguments
|
||||||
|
:RangeArgumentsAll
|
||||||
|
:N
|
||||||
|
:.RangeArguments
|
||||||
|
:split|split|split|split
|
||||||
|
:3wincmd w
|
||||||
|
:.,$RangeWindows
|
||||||
|
:%RangeWindows
|
||||||
|
:RangeWindowsAll
|
||||||
|
:only
|
||||||
|
:blast|bd
|
||||||
|
:.,$RangeLoadedBuffers
|
||||||
|
:%RangeLoadedBuffers
|
||||||
|
:RangeLoadedBuffersAll
|
||||||
|
:.,$RangeBuffers
|
||||||
|
:%RangeBuffers
|
||||||
|
:RangeBuffersAll
|
||||||
|
:tabe|tabe|tabe|tabe
|
||||||
|
:normal 2gt
|
||||||
|
:.,$RangeTabs
|
||||||
|
:%RangeTabs
|
||||||
|
:RangeTabsAll
|
||||||
|
:1tabonly
|
||||||
|
:s/\n/\r\r\r\r\r/
|
||||||
|
:2ma<
|
||||||
|
:$-ma>
|
||||||
|
:'<,'>RangeLines
|
||||||
|
:com -range=% -buffer LocalRangeLines :call add(g:lines, 'LocalRangeLines '.<line1>.' '.<line2>)
|
||||||
|
:'<,'>LocalRangeLines
|
||||||
|
:b1
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:call add(g:lines, '')
|
||||||
|
:%argd
|
||||||
|
:arga a b c d
|
||||||
|
:let v:errmsg = ''
|
||||||
|
:5argu
|
||||||
|
:call add(g:lines, '5argu ' . v:errmsg)
|
||||||
|
:$argu
|
||||||
|
:call add(g:lines, '4argu ' . expand('%:t'))
|
||||||
|
:let v:errmsg = ''
|
||||||
|
:1argu
|
||||||
|
:call add(g:lines, '1argu ' . expand('%:t'))
|
||||||
|
:let v:errmsg = ''
|
||||||
|
:100b
|
||||||
|
:call add(g:lines, '100b ' . v:errmsg)
|
||||||
|
:split|split|split|split
|
||||||
|
:let v:errmsg = ''
|
||||||
|
:0close
|
||||||
|
:call add(g:lines, '0close ' . v:errmsg)
|
||||||
|
:$wincmd w
|
||||||
|
:$close
|
||||||
|
:call add(g:lines, '$close ' . winnr())
|
||||||
|
:let v:errmsg = ''
|
||||||
|
:$+close
|
||||||
|
:call add(g:lines, '$+close ' . v:errmsg)
|
||||||
|
:$tabe
|
||||||
|
:call add(g:lines, '$tabe ' . tabpagenr())
|
||||||
|
:let v:errmsg = ''
|
||||||
|
:$+tabe
|
||||||
|
:call add(g:lines, '$+tabe ' . v:errmsg)
|
||||||
|
:only!
|
||||||
|
:e x
|
||||||
|
:0tabm
|
||||||
|
:normal 1gt
|
||||||
|
:call add(g:lines, '0tabm ' . expand('%:t'))
|
||||||
|
:tabonly!
|
||||||
|
:only!
|
||||||
|
:e! test.out
|
||||||
|
:call append(0, g:lines)
|
||||||
|
:unlet g:lines
|
||||||
|
:w|bd
|
||||||
|
:b1
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:let g:lines = []
|
||||||
|
:func BufStatus()
|
||||||
|
: call add(g:lines, 'aaa: ' . buflisted(g:buf_aaa) . ' bbb: ' . buflisted(g:buf_bbb) . ' ccc: ' . buflisted(g:buf_ccc))
|
||||||
|
:endfunc
|
||||||
|
:se nohidden
|
||||||
|
:e aaa
|
||||||
|
:let buf_aaa = bufnr('%')
|
||||||
|
:e bbb
|
||||||
|
:let buf_bbb = bufnr('%')
|
||||||
|
:e ccc
|
||||||
|
:let buf_ccc = bufnr('%')
|
||||||
|
:b1
|
||||||
|
:call BufStatus()
|
||||||
|
:exe buf_bbb . "," . buf_ccc . "bdelete"
|
||||||
|
:call BufStatus()
|
||||||
|
:exe buf_aaa . "bdelete"
|
||||||
|
:call BufStatus()
|
||||||
|
:e! test.out
|
||||||
|
:call append('$', g:lines)
|
||||||
|
:unlet g:lines
|
||||||
|
:delfunc BufStatus
|
||||||
|
:w|bd
|
||||||
|
:b1
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
STARTTEST
|
||||||
|
:se hidden
|
||||||
|
:only!
|
||||||
|
:let g:lines = []
|
||||||
|
:%argd
|
||||||
|
:arga a b c d e f
|
||||||
|
:3argu
|
||||||
|
:let args = ''
|
||||||
|
:.,$-argdo let args .= ' '.expand('%')
|
||||||
|
:call add(g:lines, 'argdo:' . args)
|
||||||
|
:split|split|split|split
|
||||||
|
:2wincmd w
|
||||||
|
:let windows = ''
|
||||||
|
:.,$-windo let windows .= ' '.winnr()
|
||||||
|
:call add(g:lines, 'windo:'. windows)
|
||||||
|
:b2
|
||||||
|
:let buffers = ''
|
||||||
|
:.,$-bufdo let buffers .= ' '.bufnr('%')
|
||||||
|
:call add(g:lines, 'bufdo:' . buffers)
|
||||||
|
:let buffers = ''
|
||||||
|
:3,7bufdo let buffers .= ' '.bufnr('%')
|
||||||
|
:call add(g:lines, 'bufdo:' . buffers)
|
||||||
|
:tabe|tabe|tabe|tabe
|
||||||
|
:normal! 2gt
|
||||||
|
:let tabpages = ''
|
||||||
|
:.,$-tabdo let tabpages .= ' '.tabpagenr()
|
||||||
|
:call add(g:lines, 'tabdo:' . tabpages)
|
||||||
|
:e! test.out
|
||||||
|
:call append('$', g:lines)
|
||||||
|
:w|qa!
|
||||||
|
ENDTEST
|
||||||
|
|
||||||
|
|
38
src/nvim/testdir/test_command_count.ok
Normal file
38
src/nvim/testdir/test_command_count.ok
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
RangeArguments 2 4
|
||||||
|
RangeArguments 1 5
|
||||||
|
RangeArgumentsAll 1 5
|
||||||
|
RangeArguments 2 2
|
||||||
|
RangeWindows 3 5
|
||||||
|
RangeWindows 1 5
|
||||||
|
RangeWindowsAll 1 5
|
||||||
|
RangeLoadedBuffers 2 4
|
||||||
|
RangeLoadedBuffers 1 4
|
||||||
|
RangeLoadedBuffersAll 1 4
|
||||||
|
RangeBuffers 2 5
|
||||||
|
RangeBuffers 1 5
|
||||||
|
RangeBuffersAll 1 5
|
||||||
|
RangeTabs 2 5
|
||||||
|
RangeTabs 1 5
|
||||||
|
RangeTabsAll 1 5
|
||||||
|
RangeLines 2 5
|
||||||
|
LocalRangeLines 2 5
|
||||||
|
|
||||||
|
5argu E16: Invalid range
|
||||||
|
4argu d
|
||||||
|
1argu a
|
||||||
|
100b E16: Invalid range
|
||||||
|
0close
|
||||||
|
$close 3
|
||||||
|
$+close E16: Invalid range
|
||||||
|
$tabe 2
|
||||||
|
$+tabe E16: Invalid range
|
||||||
|
0tabm x
|
||||||
|
|
||||||
|
aaa: 1 bbb: 1 ccc: 1
|
||||||
|
aaa: 1 bbb: 0 ccc: 0
|
||||||
|
aaa: 0 bbb: 0 ccc: 0
|
||||||
|
argdo: c d e
|
||||||
|
windo: 2 3 4
|
||||||
|
bufdo: 2 3 4 5 6 7 8 9 10 15
|
||||||
|
bufdo: 3 4 5 6 7
|
||||||
|
tabdo: 2 3 4
|
@@ -184,22 +184,22 @@ static int included_patches[] = {
|
|||||||
//598,
|
//598,
|
||||||
//597,
|
//597,
|
||||||
//596,
|
//596,
|
||||||
//595,
|
595,
|
||||||
//594,
|
//594,
|
||||||
//593,
|
//593,
|
||||||
//592,
|
//592,
|
||||||
//591 NA
|
//591 NA
|
||||||
//590,
|
//590,
|
||||||
//589 NA
|
//589 NA
|
||||||
//588,
|
588,
|
||||||
//587,
|
//587,
|
||||||
//586 NA
|
//586 NA
|
||||||
//585,
|
585,
|
||||||
//584 NA
|
//584 NA
|
||||||
//583 NA
|
//583 NA
|
||||||
//582,
|
//582,
|
||||||
//581,
|
//581,
|
||||||
//580,
|
580,
|
||||||
//579,
|
//579,
|
||||||
578,
|
578,
|
||||||
//577,
|
//577,
|
||||||
@@ -207,18 +207,18 @@ static int included_patches[] = {
|
|||||||
//575,
|
//575,
|
||||||
//574,
|
//574,
|
||||||
//573,
|
//573,
|
||||||
//572,
|
572,
|
||||||
//571 NA
|
//571 NA
|
||||||
//570 NA
|
//570 NA
|
||||||
//569,
|
//569,
|
||||||
//568,
|
568,
|
||||||
567,
|
567,
|
||||||
//566,
|
566,
|
||||||
//565,
|
565,
|
||||||
//564,
|
//564,
|
||||||
563,
|
563,
|
||||||
//562,
|
//562,
|
||||||
//561,
|
561,
|
||||||
//560 NA
|
//560 NA
|
||||||
559,
|
559,
|
||||||
//558 NA
|
//558 NA
|
||||||
@@ -233,14 +233,14 @@ static int included_patches[] = {
|
|||||||
549,
|
549,
|
||||||
//548 NA
|
//548 NA
|
||||||
547,
|
547,
|
||||||
//546,
|
546,
|
||||||
545,
|
545,
|
||||||
//544 NA
|
//544 NA
|
||||||
543,
|
543,
|
||||||
//542,
|
542,
|
||||||
541,
|
541,
|
||||||
//540 NA
|
//540 NA
|
||||||
//539,
|
539,
|
||||||
538,
|
538,
|
||||||
537,
|
537,
|
||||||
536,
|
536,
|
||||||
|
@@ -182,6 +182,7 @@ enum {
|
|||||||
EXPAND_HISTORY,
|
EXPAND_HISTORY,
|
||||||
EXPAND_USER,
|
EXPAND_USER,
|
||||||
EXPAND_SYNTIME,
|
EXPAND_SYNTIME,
|
||||||
|
EXPAND_USER_ADDR_TYPE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -124,10 +124,7 @@ do_window (
|
|||||||
case Ctrl_HAT:
|
case Ctrl_HAT:
|
||||||
case '^':
|
case '^':
|
||||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
STRCPY(cbuf, "split #");
|
cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
|
||||||
if (Prenum)
|
|
||||||
vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7,
|
|
||||||
"%" PRId64, (int64_t)Prenum);
|
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -151,14 +148,16 @@ newwindow:
|
|||||||
case Ctrl_Q:
|
case Ctrl_Q:
|
||||||
case 'q':
|
case 'q':
|
||||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
do_cmdline_cmd((char_u *)"quit");
|
cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum);
|
||||||
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* close current window */
|
/* close current window */
|
||||||
case Ctrl_C:
|
case Ctrl_C:
|
||||||
case 'c':
|
case 'c':
|
||||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
do_cmdline_cmd((char_u *)"close");
|
cmd_with_count("close", cbuf, sizeof(cbuf), Prenum);
|
||||||
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* close preview window */
|
/* close preview window */
|
||||||
@@ -183,7 +182,8 @@ newwindow:
|
|||||||
case Ctrl_O:
|
case Ctrl_O:
|
||||||
case 'o':
|
case 'o':
|
||||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
do_cmdline_cmd((char_u *)"only");
|
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
|
||||||
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* cursor to next window with wrap around */
|
/* cursor to next window with wrap around */
|
||||||
@@ -487,6 +487,16 @@ wingotofile:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize,
|
||||||
|
long Prenum)
|
||||||
|
{
|
||||||
|
size_t len = xstrlcpy((char *)bufp, cmd, bufsize);
|
||||||
|
|
||||||
|
if (Prenum > 0 && len < bufsize) {
|
||||||
|
vim_snprintf((char *)bufp + len, bufsize - len, "%" PRId64, Prenum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* split the current window, implements CTRL-W s and :split
|
* split the current window, implements CTRL-W s and :split
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user