Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
For questions about searching for text with / or search(). For find/replace operations, use tag [substitute] instead.
186
votes
Accepted
Is there a way to count the number of occurrences of a word in a file?
Quincy's answer is fine, but there's an exact way to do this which doesn't require editing the buffer:
:%s/pattern//ng
This will print a message like 3 matches on 2 lines, and no changes will be ma …
6
votes
Restricting operations to a section of code
If you're comfortable taking the plugin route, there's NrrwRgn.
You visually select a block, then run the :NR command, which opens a new buffer (in a split) with the selected text. You can make modif …