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

Re: Operator pending mode

Expand Messages
  • Ben Schmidt
    [CCing vim_dev; apologies for my continued disorganised postings!] OK, folks, After reading feedback, etc., here is a revised patch. It s just the
    Message 1 of 26 , Nov 4, 2007
    • 0 Attachment
      [CCing vim_dev; apologies for my continued disorganised postings!]

      OK, folks,

      After reading feedback, etc., here is a revised patch. It's just the documentation
      that is different from the previous patch.

      In the end, given that a number of things can be done without v:operator, as Andy
      demonstrated, and that Yankring is a pretty specific example, I thought perhaps
      the best thing would be to put a brief example analogous to the v:prevcount
      example which is right nextdoor in the docs.

      If you still think a lengthier example is better, though, Bram, I'm happy to
      revise the patch again. I thought this, or a scaled-down count-ignorant version
      might be a more useful lengthy example (compared to the function name thing I
      suggested before):

      :" Defines a motion/text-object <C> which allows you to operate on
      :" the {count}th column of a tab-delimited table, or the column
      :" the cursor is currently in if no count is given.
      :onoremap C <Esc>:call OperateColumn()<CR>
      :function! OperateColumn()
      : let c = v:prevcount
      : if c == 0
      : call search('^\|\t\zs','bc',line("."))
      : else
      : call cursor(line("."),1)
      : while search('\v(\zs[^\t]*(\t|$)){'.c.'}','c',line(".")) == 0
      : call setline(line("."),getline(line("."))."\t")
      : endwhile
      : endif
      : call feedkeys('"'.v:register.v:operator)
      : if strpart(getline(line('.')),col('.')-1,1) == "\t"
      : call feedkeys(":\<CR>")
      : else
      : call feedkeys(search('\t','n',line(".")) == 0 ? "$" : "t\t")
      : endif
      :endfun

      Ben.







      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.