Loading ...
Sorry, an error occurred while loading the content.

47353Re: Change highlighted pattern, don't move cursor/window

Expand Messages
  • Fred Ma
    Feb 1, 2004
    • 0 Attachment
      Sven Guckes wrote:
      >
      > * Fred Ma <fma@...> [2004-02-01]:
      > > When I use vim to search for a pattern with the "/", the
      > > cursor moves to the next occurance, and all matching text is
      > > highlighted. That's almost exactly what I want. I want to
      > > provide a pattern to highlight from the command line, but I
      > > don't want the cursor to move, or the window to scroll.
      >
      > sounds like you want "incremental search". see ":help incsearch".

      That doesn't seem to do it. It only highlights the next
      occurance. Also, in order not to move the cursor, I have
      to not complete the search command, which terminates even
      that highlighting.

      > > I thought I could find where vim stores it's notion of last
      > > pattern searched for, but can't seem to find it.
      >
      > the last search pattern is in register '/'.

      I tried yanking a search expression into register '/', but
      turns out that it's not possible (the help on registers).
      Fortunately, I can assign to register "/", and it does
      force highlighting of all text matching the new expression.

      Thanks for the hint on which register to read up on.

      Fred
      --
      Fred Ma
      Dept. of Electronics, Carleton University
      1125 Colonel By Drive, Ottawa, Ontario
      Canada, K1S 5B6
    • Show all 3 messages in this topic