aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2018-07-13 15:14:46 -0400
committerJustin M. Keyes <justinkz@gmail.com>2018-07-13 21:14:46 +0200
commit392817c2da46024177e32ac478769d6aad6b4449 (patch)
treea9e3417b4942f7ccad47d7007991dee848ae3b9f /runtime
parentfc45c978297b76e76756345798a2c51cbbb909dc (diff)
downloadrneovim-392817c2da46024177e32ac478769d6aad6b4449.tar.gz
rneovim-392817c2da46024177e32ac478769d6aad6b4449.tar.bz2
rneovim-392817c2da46024177e32ac478769d6aad6b4449.zip
vim-patch:8.0.0630: it is not easy to work on lines without a match (#8734)
Problem: The :global command does not work recursively, which makes it difficult to execute a command on a line where one pattern matches and another does not match. (Miles Cranmer) Solution: Allow for recursion if it is for only one line. (closes vim/vim#1760) https://github.com/vim/vim/commit/f84b122a99da75741ae686fabb6f81b8b4755998
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/repeat.txt13
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 421ebab100..42889cca50 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -37,7 +37,7 @@ of area is used, see |visual-repeat|.
==============================================================================
2. Multiple repeats *multi-repeat*
- *:g* *:global* *E147* *E148*
+ *:g* *:global* *E148*
:[range]g[lobal]/{pattern}/[cmd]
Execute the Ex command [cmd] (default ":p") on the
lines within [range] where {pattern} matches.
@@ -70,8 +70,15 @@ The default for [range] is the whole buffer (1,$). Use "CTRL-C" to interrupt
the command. If an error message is given for a line, the command for that
line is aborted and the global command continues with the next marked or
unmarked line.
-
-To repeat a non-Ex command, you can use the ":normal" command: >
+ *E147*
+When the command is used recursively, it only works on one line. Giving a
+range is then not allowed. This is useful to find all lines that match a
+pattern and do not match another pattern: >
+ :g/found/v/notfound/{cmd}
+This first finds all lines containing "found", but only executes {cmd} when
+there is no match for "notfound".
+
+To execute a non-Ex command, you can use the `:normal` command: >
:g/pat/normal {commands}
Make sure that {commands} ends with a whole command, otherwise Vim will wait
for you to type the rest of the command for each match. The screen will not