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

Re: toggling keymap in normal mode

Expand Messages
  • Bram Moolenaar
    ... No, since the mappings only take effect in Insert mode, it s logical that you can only enable/disable them from Insert mode. Well, except when you want to
    Message 1 of 9 , Apr 3, 2001
    • 0 Attachment
      Alexey Marinichev wrote:

      > How do I toggle keyboard map set by 'keymap' option from the normal
      > mode? There isn't anything simpler than :normal a <Ctrl-^> <Esc> <CR>,
      > is there?

      No, since the mappings only take effect in Insert mode, it's logical that you
      can only enable/disable them from Insert mode. Well, except when you want to
      use "r".

      > Related issue: if I set 'keymap' option, keyboard gets remapped. It
      > would be nice to be able to set the option and leave the keyboard in its
      > unmapped state, to have Ctrl-^ switch the mappings.

      Pff, yet another option?

      Why do you first tell Vim to map keys for your language and then say "but I
      don't want to use them"? Perhaps you should postpone loading them until you
      really want to use them.

      --
      I learned the customs and mannerisms of engineers by observing them, much the
      way Jane Goodall learned about the great apes, but without the hassle of
      grooming.
      (Scott Adams - The Dilbert principle)

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    • Alexey Marinichev
      ... Also f and F . That s the whole point of lmaps, to have remapping working everywhere. ... It doesn t have to be an option. I m file with normal mode
      Message 2 of 9 , Apr 3, 2001
      • 0 Attachment
        On Tue, Apr 03, 2001 at 08:45:18PM +0200, Bram Moolenaar wrote:
        >
        > Alexey Marinichev wrote:
        >
        > > How do I toggle keyboard map set by 'keymap' option from the normal
        > > mode? There isn't anything simpler than :normal a <Ctrl-^> <Esc> <CR>,
        > > is there?
        >
        > No, since the mappings only take effect in Insert mode, it's logical that you
        > can only enable/disable them from Insert mode. Well, except when you want to
        > use "r".

        Also "f" and "F". That's the whole point of lmaps, to have remapping
        working everywhere.

        > > Related issue: if I set 'keymap' option, keyboard gets remapped. It
        > > would be nice to be able to set the option and leave the keyboard in its
        > > unmapped state, to have Ctrl-^ switch the mappings.
        >
        > Pff, yet another option?

        It doesn't have to be an option. I'm file with normal mode command that
        switches mapping, then I could do :normal g<C-^> or whatever it would
        be.

        > Why do you first tell Vim to map keys for your language and then say "but I
        > don't want to use them"? Perhaps you should postpone loading them until you
        > really want to use them.

        I use vim as an editor to compose emails. Sometimes I write in English
        and sometimes in Russian. I do not know in advance which language it
        will be. Right now, I have to type :set keymap=something once before I
        can type cyrillic. That's annoying. I just want C-^ to always work.
        Imapping C-^ to clever combination of setting keymap and unmapping C-^
        is just too hacky, is it not?

        --Lyosha
      • Ron Aaron
        ... Hi, Alexey! Will you be contributing your russian Keymaps? All we have so far in the official distro is my Hebrew ones. Best regards, Ron
        Message 3 of 9 , Apr 3, 2001
        • 0 Attachment
          Alexey Marinichev <lyosha@...> writes:
          >I use vim as an editor to compose emails. Sometimes I write in English
          >and sometimes in Russian. I do not know in advance which language it

          Hi, Alexey!

          Will you be contributing your russian Keymaps? All we have so far in the
          official distro is my Hebrew ones.

          Best regards,
          Ron
        • Bram Moolenaar
          ... The current support of keymap is for what most people would need. If you start editing a Russian file, you select the Russian keymap . That should be
          Message 4 of 9 , Apr 3, 2001
          • 0 Attachment
            Alexey Marinichev wrote:

            > I use vim as an editor to compose emails. Sometimes I write in English
            > and sometimes in Russian. I do not know in advance which language it
            > will be. Right now, I have to type :set keymap=something once before I
            > can type cyrillic. That's annoying. I just want C-^ to always work.
            > Imapping C-^ to clever combination of setting keymap and unmapping C-^
            > is just too hacky, is it not?

            The current support of 'keymap' is for what most people would need. If you
            start editing a Russian file, you select the Russian 'keymap'. That should be
            easy and straightforward.

            If you want to switch the 'keymap' on/off for specific situations, like when
            editing an e-mail that contains a MIME note about the charset, feel free to
            make any mapping, script and function that you need. The most obvious would
            be:

            :map <F4> :set keymap=russian<CR>
            :map <F5> :set keymap=<CR>

            Actually, if there would be an option to enable/disable the keymap, this would
            probably end up being used with a mapping as well.

            --
            Often you're less important than your furniture. If you think about it, you
            can get fired but your furniture stays behind, gainfully employed at the
            company that didn't need _you_ anymore.
            (Scott Adams - The Dilbert principle)

            /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
            ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
            \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
          • Alexey Marinichev
            On Tue, Apr 03, 2001 at 11:02:20PM +0200, Bram Moolenaar wrote: [...] ... The problem is once is pressed, insert mode Ctrl-^ is not working anymore. In
            Message 5 of 9 , Apr 3, 2001
            • 0 Attachment
              On Tue, Apr 03, 2001 at 11:02:20PM +0200, Bram Moolenaar wrote:
              [...]
              > If you want to switch the 'keymap' on/off for specific situations, like when
              > editing an e-mail that contains a MIME note about the charset, feel free to
              > make any mapping, script and function that you need. The most obvious would
              > be:
              >
              > :map <F4> :set keymap=russian<CR>
              > :map <F5> :set keymap=<CR>

              The problem is once <F5> is pressed, insert mode Ctrl-^ is not working
              anymore.

              In any case: I *always* *always* want insert mode Ctrl-^ to work. I do
              not want to remember to press <F4> to initialise keymap option. *And*,
              when I start vim, I expect it to be in normal latin mode. That's it.
              What's the simplest way to do it?

              --Lyosha
            • Alexey Marinichev
              On Tue, Apr 03, 2001 at 01:28:58PM -0700, Ron Aaron wrote: [...] ... [...] Hello, I shall be delighted to. Unfortunately the layout I am using is not the
              Message 6 of 9 , Apr 3, 2001
              • 0 Attachment
                On Tue, Apr 03, 2001 at 01:28:58PM -0700, Ron Aaron wrote:
                [...]
                > Hi, Alexey!
                >
                > Will you be contributing your russian Keymaps? All we have so far in the
                > official distro is my Hebrew ones.
                [...]

                Hello,

                I shall be delighted to. Unfortunately the layout I am using is not the
                standard one, so the version I have is little use for others. I will
                put together keymap to emulate windows ones. Do we want all codepages
                or UTF-8 is enough?

                --Lyosha
              • Andrew Rodionoff
                Greetings, Alexey On Tue, Apr 03, 2001 at 14:28:50, Alexey Marinichev wrote: AM On Tue, Apr 03, 2001 at 11:02:20PM +0200, Bram Moolenaar wrote: [...] ... AM
                Message 7 of 9 , Apr 5, 2001
                • 0 Attachment
                  Greetings, Alexey

                  On Tue, Apr 03, 2001 at 14:28:50, Alexey Marinichev wrote:
                  AM> On Tue, Apr 03, 2001 at 11:02:20PM +0200, Bram Moolenaar wrote: [...]
                  >> If you want to switch the 'keymap' on/off for specific situations, like
                  >> when editing an e-mail that contains a MIME note about the charset, feel
                  >> free to make any mapping, script and function that you need. The most
                  >> obvious would be:

                  >> :map <F4> :set keymap=russian<CR> :map <F5> :set keymap=<CR>

                  AM> The problem is once <F5> is pressed, insert mode Ctrl-^ is not working
                  AM> anymore.

                  AM> In any case: I *always* *always* want insert mode Ctrl-^ to work. I do
                  AM> not want to remember to press <F4> to initialise keymap option. *And*,
                  AM> when I start vim, I expect it to be in normal latin mode. That's it.
                  AM> What's the simplest way to do it?
                  I manage my keymaps with simple plugin script attached to this msg. I hope
                  its comments are sufficient to understand how it works. I've also included my
                  Russian keymap file as a reference to newbie i18n keymap users.

                  --
                  Best regards, Andrew

                  np: Manowar//Gloves Of Metal (Into Glory Ride)
                • Alexey Marinichev
                  On Thu, Apr 05, 2001 at 11:38:51AM +0400, Andrew Rodionoff wrote: [...] ... [...] Thanks. My research ended up with the following: imap :set
                  Message 8 of 9 , Apr 6, 2001
                  • 0 Attachment
                    On Thu, Apr 05, 2001 at 11:38:51AM +0400, Andrew Rodionoff wrote:
                    [...]
                    > I manage my keymaps with simple plugin script attached to this msg. I hope
                    > its comments are sufficient to understand how it works. I've also included my
                    > Russian keymap file as a reference to newbie i18n keymap users.
                    [...]

                    Thanks. My research ended up with the following:
                    imap <C-^> <esc>:set keymap=my_wacky_keymap <bar> iunmap <C-V><C-^><cr>a

                    When <C-^> is used the first time in insert mode, it assigns keymap
                    value and unmaps itself. Seems to work. Does exactly what I want.

                    --Lyosha
                  Your message has been successfully submitted and would be delivered to recipients shortly.