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

34932Re: [vim] Mapping with count

Expand Messages
  • Klaus Bosau
    Dec 4, 2002
    • 0 Attachment
      On Wed, 4 Dec 2002, BenjiFisher wrote:

      > Charles E. Campbell wrote:
      >
      > > ---------------------------------------------------------------------
      > > fun! F() range
      > > " Remember to start the function name with a capital!
      > > echo "count =".v:count.", count1 =".v:count1.", prevcount =".v:prevcount
      > > endfun
      > > nmap \F :call F()<Cr>
      > > ---------------------------------------------------------------------
      > >
      > > There's still a problem, however: if the number sent to the function
      > > is greater than the number of lines in the file, you'll get an
      > > "E16: Invalid Range" error.
      >
      > Sorry, I forgot about that. I think the right solution is to
      > cancel the count:
      >
      > fun! EchoCount()
      > echo v:count
      > endfun
      > nnoremap \F :<C-U>call EchoCount()<CR>
      >
      > I use the "nore" form because some people have :cmap's for <C-U>.

      Hi,

      and thanks a lot to all helpers! I found this very helpful cause I
      didn't know where to look for information on this topic in Vim's help
      file...

      Thanks again!

      Klaus
    • Show all 9 messages in this topic