how to search in VI wih case insensitive
Hi guys,
I'm wondering how to do a case in-sensitive search in vi. I'm looking for a switch. Something like -i switch for grep. For example Code:
grep "string" file -i By the way, :set ignorecase and :set smartcase are not what I'm looking for. |
Could you elaborate? the :set ignorecase is exactly how you do it in vi. Are you saying it doesn't work? Are you trying to do a command line option?
Is it perhaps that you don't understand the usage. You do the ":set ignorecase" then hit enter THEN do the search - you're not trying to do it all on one line are you? Or maybe you're trying to figure out how to turn it on so you don't have to bother typing the :set each time? If so: Type "echo set ignorecase" >>.exrc" in your home directory. The .exrc is read each time you start vi. Of course its possible you have some flavor of vi that doesn't understand ed set commands but I haven't yet run across one (but then again I immediately install vim wherever I see nvi). |
I found this in the vim user manual pages (chapter 27.1) for you. Sounds like what you might want.
Quote:
|
It's the exact what I want. Thanks, Jlightner
Dengyi |
Glad I could help.
Quote:
|
Heheh, yeah, there is a lot there. I'm sure emacs has just as much, though. In this case, I found it simply by typing :help regexp, and then following some links in the help. (By moving the cursor over the links and hitting ctrl-])
Anyway, you don't really need to memorize everything vim can do. Once you pick up a few key features you can get along with it pretty well. But if there is ever something you want to find a way to do quicker in vim, there are probably more things you don't know about that you can search the help for. :) |
Yes I know. Been using vi since 1991 - vim has a few more features but vi (not nvi which bites) has a similarly long man page. I was just noting this is why no one actually memorizes it.
I am NOT a fan of emacs. In fact when developers ask me to install emacs for them I tell 'em to go pound sand (or do "man vi" which they somehow take the same way :rolleyes: ) |
how to search in VI wih case insensitive
or how to search in VIM with ignoring case sensitive
to search for non-case sensitive words, once you are in vim file, type: :set ic then, /[your search] |
All times are GMT -5. The time now is 07:36 PM. |