tags:

views:

205

answers:

3

If I search for 'string'; i want to find just 'string'; and not 'qstring', 'sostring' etc ect

Here are the options in my .vimrc

set ic
set showmatch
set smartcase
set incsearch
+9  A: 

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

Michael Foukarakis
If i type in '\' to go into search mode; and then type in 's'; thenit tries to search for a 'space'; since \s means space right?
shergill
here is my sequence of keystrokes1. \ (to go into search mode)2. /s (this tries to find a space)
shergill
No. You need to go into search mode first and then type the pattern. So try hitting the keys exactly:- /\<string\>
Gavin Gilmour
@shergill: you may want to look at :h \<
Michael
If you can put your cursor on the string, then * will search forward for that exact string and # searches backwards.
Drew Stephens
+5  A: 

Use this:

\<string\>
JG
A: 

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

Thomi
not for me; maybe i have some special flags set in vim
shergill
Doing that assumes the words don't have punctuation attached. It also won't match words that might be at the end of a line.
Gavin Gilmour