vim stuff. (was: [Nottingham] Grub quickie help please)

Roger Light rogerlight at gmail.com
Fri Mar 17 09:53:23 GMT 2006


On 17/03/06, Martin Garton <martin at stupids.org> wrote:
>
> > > How inefficient...
> > >
> > > Use "ESC :wq!" and save yourself two key presses :)
> >
> > what's wrong with :x ?
>
> or even ZZ?

I've never really liked ZZ, for no real reason. I get an error with it
saving an edited read only file, just like :wq (sudo or not) and :x

E45: 'readonly' option is set (add ! to override)

So I reckon that :x! is the winner.

> Another vim question then..
>
> How do I do case insensitive searches without resorting to "set
> ignorecase"?
>
> I have quite a few searches to do in a file some of which are case
> sensitive and some are not.  I don't want to keep toggling ignorecase on
> and off.

Try

:set ignorecase smartcase

Then if you do a search in all lower case it is case insensitive. If
there is an upper case character in the search string it is case
sensitive. Better is to prepend \C (match case) or \c (ignore case) to
your search string. This ignores the value of ignorecase.

So, if you're searching for foo, FOO, foO then your search string is

\cfoo

If you're searching for foo, but not FOO, the search string is

\Cfoo

This is all from the vim help file usr_27.txt by the way, I didn't
know it before (so thanks, it was useful).

> Also, any way of searching for a string all in the same case?  ie,
> searching for "foo" would match "foo" or "FOO" but not "foO".

Dunno.

Roger


More information about the Nottingham mailing list