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

139358Re: Calling a user function via a map cancels visual mode

Expand Messages
  • Ben Fritz
    Sep 27, 2013
    • 0 Attachment
      On Thursday, September 26, 2013 10:40:27 PM UTC-5, skeept wrote:
      > noremap ,n :<C-U>call JumpToNextNonMatching(1)<CR><C-L>
      > noremap ,N :<C-U>call JumpToNextNonMatching(-1)<CR><C-L>
      >
      > The idea is simply to jump to a previous or next line not matching the beggining of current line.
      >
      > But if I am in visual mode and use one of the mappings then visual mode is cancelled.
      > Any suggestions on howto properly define the function of the mapping so when I use it I stay in visual mode (with the selection resulting of applying the map, of course).
      >

      The : in your mappings is what ends visual mode.

      You can't avoid this, but you can go back into visual mode with the same region as you had, simply by adding 'gv' to the end of your mapping.

      :help gv

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 4 messages in this topic