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

Re: increment a binary number

Expand Messages
  • Charles Campbell
    ... The latest version of visincr (a plugin) supports production of binary incremented lists. 0 0 0 0 0 Use ctrl-v to select the column, then press :IB. The
    Message 1 of 3 , Jun 25, 2009
      guitou Foujanet wrote:
      > Hello ,
      >
      > I have started to use VIM 1 month ago and I think I start to
      > understand the philosophy of this editor.
      > But I have a problem, I am sure that there is a solution. My problem
      > is the following: I would like to increment a binary number. For
      > example, I would like to increment 00000001 -> 00000010 -> 00000011
      > and so on...
      >
      > But the key Ctrl-A increment a decimal number, and I don't find the
      > method to increment a binary number.
      >
      > And after that, I would like to use a macro to increment a number from
      > 2^0 to 2^8 for example.
      >
      The latest version of visincr (a plugin) supports production of binary
      incremented lists.

      0
      0
      0
      0
      0

      Use ctrl-v to select the column, then press :IB. The result:

      0
      1
      10
      11
      100

      Same, but use :IIB: (this is right-justified, but variable-width fonts
      won't work as well to show this)

      0
      1
      10
      11
      100

      Want zero-fill? Try the same with :IIB 1 0 (increment by one, fill
      with zero, right-justified):

      000
      001
      010
      011
      100

      If you want visincr, you can get it from my website:
      http://mysite.verizon.net/astronaut/vim/index.html#VISINCR .

      Regards,
      Chip Campbell


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