shergill
shergill

Reputation: 3788

How to search for complete words in vim?

If I search for 'string'; I want to find exactly 'string' as a word; and not 'qstring', 'sostring' etc.

Here are the options in my .vimrc

set ic
set showmatch
set smartcase
set incsearch

Upvotes: 9

Views: 4486

Answers (3)

Thomi
Thomi

Reputation: 11808

Why not just search for " string "? Works for me...

Upvotes: -2

João Silva
João Silva

Reputation: 91299

Use this:

\<string\>

Upvotes: 10

Michael F
Michael F

Reputation: 40832

Maybe this regexp will help you: "\<string\>"

Upvotes: 15

Related Questions