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

Highlight after invoking a function

Expand Messages
  • rameo
    I would like to know how to highlight matches after invoking a function p.e. function! s:MyFunction() let search = d + let @/ = search return normal n
    Message 1 of 1 , May 2, 2012
    • 0 Attachment
      I would like to know how to highlight matches after invoking a function p.e.

      function! s:MyFunction()
      let search = '\d\+'
      let @/ = search
      return "normal n"
      endfunction

      :call <SID>Test()<CR>
      does not highlight the matches.

      I know I can add :set hls<CR> after the function call but that creates problems
      with output of echo commands.

      :set hls<CR> does also create problems if the function
      waits for an user input p.e.
      :%s/pattern/replace-pattern/gc

      Thanks in advance.

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.