Skip to main content
2 of 2
added 381 characters in body
Martin Tournoij
  • 63.3k
  • 26
  • 199
  • 274

How about this:

/^[^#]*ipdb

The first ^ will anchor the match to the start of the line, [^#] will match any character except a # (the ^ means to match any character except those given), and the * repeats this 0 or more times.

See::help /^ :help /[ for some more information.

Note that this will match all lines with ipdb which don't start with a comment, including:

import other_module, ipdb

If you only want to match those starting with import ipdb, you can use:

/^\s*import ipdb

Here ^ will again anchor the match to the start of the line, \s will match any whitespace character, and * repeats this 0 or more times.

Martin Tournoij
  • 63.3k
  • 26
  • 199
  • 274