summaryrefslogtreecommitdiffstats
path: root/runtime/doc/tips.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-02-26 23:04:13 +0000
committerBram Moolenaar <Bram@vim.org>2005-02-26 23:04:13 +0000
commit05159a0c6a27a030c8497c5cf836977090f9e75d (patch)
tree9ccc167cf3e830e5d01aff4555f99d854cbb623b /runtime/doc/tips.txt
parent5313dcb75ac76501f23d21ac94efdbeeabc860bc (diff)
updated for version 7.0052v7.0052
Diffstat (limited to 'runtime/doc/tips.txt')
-rw-r--r--runtime/doc/tips.txt25
1 files changed, 13 insertions, 12 deletions
diff --git a/runtime/doc/tips.txt b/runtime/doc/tips.txt
index 70747797e3..917ab9c75f 100644
--- a/runtime/doc/tips.txt
+++ b/runtime/doc/tips.txt
@@ -1,4 +1,4 @@
-*tips.txt* For Vim version 7.0aa. Last change: 2004 Feb 17
+*tips.txt* For Vim version 7.0aa. Last change: 2005 Feb 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -201,21 +201,22 @@ abbreviations that correct them. For example: >
==============================================================================
Counting words, lines, etc. *count-items*
-To count how often any pattern occurs in a buffer, set 'report' to 0, and use
-the substitute command to replace the pattern with itself. The reported
-number of substitutions is the number of items. Examples: >
+To count how often any pattern occurs in the current buffer use the substitute
+command and add the 'n' flag to avoid the substitution. The reported number
+of substitutions is the number of items. Examples: >
- :set report=0
- :%s/./&/g characters
- :%s/\i\+/&/g words
- :%s/^ lines
- :%s/the/&/g "the" anywhere
- :%s/\<the\>/&/g "the" as a word
+ :%s/./&/gn characters
+ :%s/\i\+/&/gn words
+ :%s/^//n lines
+ :%s/the/&/gn "the" anywhere
+ :%s/\<the\>/&/gn "the" as a word
You might want to reset 'hlsearch' or do ":nohlsearch".
+Add the 'e' flag if you don't want an error when there are no matches.
-This does not work if the 'modifiable' option is off. An alternative is using
-|v_g_CTRL-G| in Visual mode.
+An alternative is using |v_g_CTRL-G| in Visual mode.
+
+If you want to find matches in multiple files use |:vimgrep|.
*count-bytes*
If you want to count bytes, you can use this: