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

95332Re: How to search only for 1st instance of the pattern in a line?

Expand Messages
  • Venkata Suryam Setty ISSA
    Aug 31 11:57 PM
    • 0 Attachment


      Teemu Likonen wrote:
      Venkata Suryam Setty ISSA wrote (2008-09-01 10:09 +0530):
      
        
      Anton Sharonov wrote:
      
          
      /^.\{-}\zsabc
            
        
      Is there no other simple way (i.e. with less number of additional 
      characters) to do this?
          
      I don't think so, but of course you can make a new command. For example:
      
          command! -nargs=+ SF let @/ = '^.\{-}\zs'.<q-args> | call search('','s')
      
      Then :SF command will be your "search the first instance" command. The 
      command takes search pattern as its parameter:
      
          :SF abc
      
      After the first search you can use "n" and "N" in normal mode to search 
      for next and previous match.
        

      Thanks a lot Teemu. This is what I wanted for.

      Regards
      Venkat.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---

    • Show all 5 messages in this topic