Vim's `/` command doesn't search for lines containing a pattern; it
searches for specific matches of a pattern. It is character-wise rather
than linewise. If you just want to find lines that don't match a
particular pattern, the easiest way it to just use grep, if you are on a
system that has a grep implementation (i.e. non-Windows). `grep -v` is
just like grep, but it inverts the pattern, which is what you want. Note
that you can invoke grep from within Vim using the `:grep` command, if
'grepprg' is set. Vim also has its own internal grep (`:vimgrep`), but I
don't know if it has the ability to invert the pattern like external
grep does. From a cursory glance at the docs, it looks like it doesn't.

Vim also has the `\@!` modifier which you can use within a search
pattern, which means "the preceding atom does not match here". For
instance, searching for:

    \%(foobar\)\@!

will find every position in the file where "foobar" does not match.
However, this is not usually what you want: almost every position in a
given file will not match "foobar", so you will get a lot more matches
than you're really looking for.

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to