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

RE: Capture registers in maps

Expand Messages
  • Yegappan Lakshmanan
    ... What about doing the following? function! TestCmd(count, register) echomsg Count = . a:count echomsg register = . a:register endfunction nnoremap yy
    Message 1 of 13 , Feb 26, 2005
      >
      > I think I forgot to mention.
      >
      > Want I want to do is this:
      > 5yy
      >
      > Which will yank 5 lines, the command is not preceeded by a :.
      >
      > So how do you define a function/command that will accept the count?
      >

      What about doing the following?

      function! TestCmd(count, register)
      echomsg "Count = " . a:count
      echomsg "register = " . a:register
      endfunction

      nnoremap yy :<C-U>call TestCmd(v:count, v:register)<CR>

      BTW, you should checkout the Yank() function in the foo.vim
      Vim plugin (What happened to Benji Fisher?)

      - Yegappan
    Your message has been successfully submitted and would be delivered to recipients shortly.