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

map ZZ

Expand Messages
  • Alex Efros
    Hi! Often you wanna be able to type vim command in normal mode when keyboard layout isn t English. Some time ago :langmap was used for this, later (probably
    Message 1 of 5 , Mar 30, 2013
    • 0 Attachment
      Hi!

      Often you wanna be able to type vim command in normal mode when keyboard
      layout isn't English. Some time ago :langmap was used for this, later
      (probably when moving to UTF-8) it was broken and replaced by usual :map
      (I see in doc example of :langmap with UTF-8, so probably it work now).

      Strange thing, some normal mode command doesn't work in this way: ZZ, ZQ
      (at least, maybe there are others too).

      Example (Russian layout):
      :map <unique> в d
      :map <unique> Я Z
      Now, in normal mode "вв" works as "dd", but "ЯЯ" doesn't work ("ЯQ" works,
      so looks like only first char mapped). This can be worked around by:
      :map <unique> ЯЯ ZZ
      :map <unique> ЯЙ ZQ
      but I wonder is this expected behavior (if ZZ somehow special command) or bug?
      And if this is expected behavior, then where I can find list of all such
      special commands to add maps for them all?

      I'm using vim-7.3.762, Gentoo Linux.

      --
      WBR, Alex.

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Lech Lorens
      On 30-Mar-2013 Alex Efros wrote: […] Confirmed on Vim 7.3.875. -- Lech Lorens -- -- You received this message from the vim_dev
      Message 2 of 5 , Mar 30, 2013
      • 0 Attachment
        On 30-Mar-2013 Alex Efros <powerman@...> wrote:
        […]

        Confirmed on Vim 7.3.875.

        --
        Lech Lorens

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • ZyX
        ... Can’t say whether this behavior is intentional, but it is the consequence of the way how things are implemented. Multicharacter commands like “gg”,
        Message 3 of 5 , Mar 30, 2013
        • 0 Attachment
          > but I wonder is this expected behavior (if ZZ somehow special command) or bug?
          > And if this is expected behavior, then where I can find list of all such
          > special commands to add maps for them all?

          Can’t say whether this behavior is intentional, but it is the consequence of the way how things are implemented. Multicharacter commands like “gg”, “ZZ” should be considered not like one command, but like two commands in different modes: first “g” enters “waiting for next character of multicharacter ‘g’ command” “mode”, next “g” actually does something.

          Implementation really does not switch any modes, it just instead of using something like a list of mapping tables {builtin_commands, global_mappings, local_mappings} special-cases all built-ins and uses plain_vgetc function in C code unconditionally waiting for next character.

          --
          --
          You received this message from the "vim_dev" 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_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Alex Efros
          Hi! ... Maybe I missed something in your explanation, but I still doesn t understand why first Z mapped from Russian char but not second Z. Or special-case
          Message 4 of 5 , Apr 2, 2013
          • 0 Attachment
            Hi!

            On Sat, Mar 30, 2013 at 01:25:07PM -0700, ZyX wrote:
            > Implementation really does not switch any modes, it just instead of
            > using something like a list of mapping tables {builtin_commands,
            > global_mappings, local_mappings} special-cases all built-ins and uses
            > plain_vgetc function in C code unconditionally waiting for next
            > character.

            Maybe I missed something in your explanation, but I still doesn't
            understand why first Z mapped from Russian char but not second Z.
            Or special-case handling begins _after_ entering first Z, so first and
            second Z read by Vim using different implementations? Sounds like a bug.

            Anyway, if no one bothers fixing this, where I can find list of all such
            special-case key combinations, to manually add mapping for them all in my
            plugin?

            --
            WBR, Alex.

            --
            --
            You received this message from the "vim_dev" 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_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • ZyX
            ... After first Z it uses plain_vgetc to get next character (which is a special-case because all user mappings use different method). plain_vgetc does not do
            Message 5 of 5 , Apr 2, 2013
            • 0 Attachment
              > > Implementation really does not switch any modes, it just instead of
              > > using something like a list of mapping tables {builtin_commands,
              > > global_mappings, local_mappings} special-cases all built-ins and uses
              > > plain_vgetc function in C code unconditionally waiting for next
              > > character.
              >
              > Maybe I missed something in your explanation, but I still doesn't
              > understand why first Z mapped from Russian char but not second Z.
              > Or special-case handling begins _after_ entering first Z, so first and
              > second Z read by Vim using different implementations? Sounds like a bug.

              After first Z it uses plain_vgetc to get next character (which is a special-case because all user mappings use different method). plain_vgetc does not do any remapping.

              > Anyway, if no one bothers fixing this, where I can find list of all such
              > special-case key combinations, to manually add mapping for them all in my
              > plugin?

              `:h normal-index`. Note that you have to remap also m…/`…/'… (ьф…ья → ma…mz, ьФ…ьЯ → mA…mZ, same for other), @… (accepts A-Z and all other register names in addition to a-z listed in `:h normal-index`), f…/F…/t…/T… (accepts anything), r… (accepts anything), do/dp, maybe something else in addition to commands listed under `:h g`, `:h z` and `:h [`.

              --
              --
              You received this message from the "vim_dev" 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_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            Your message has been successfully submitted and would be delivered to recipients shortly.