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

138507Re: how do i remap dd so that it becomes context-dependent?

Expand Messages
  • Paul Isambert
    Jul 14, 2013
      Nikolay Pavlov <zyx.vim@...> a écrit:
      > On Jul 14, 2013 1:53 AM, "Leonardo Barbosa" <barbosa.leonardo@...>
      > wrote:
      > >
      > > Thanks Nikolay. That did the job. I was wondering if i could pass an
      > > argument to the map so that i can do something like : 2dd, 3dd, and so
      > > on...
      > Count is accessible via v:count and v:count1. You will have to write
      > function that handles it properly though in the case of lengthy lines.

      This should work:

      nnoremap <buffer> <expr> dd (virtcol('$') > winwidth(0)) ? 'g0d' . (v:count > 1 ? 'v' . v:count : '') . 'g$' : 'dd'

      The conditional addition of “v” is explained (more or less) in my next message.

      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 5 messages in this topic