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

Remapping CTRL-I to

Expand Messages
  • Chris Jones
    Is it possible to remap CTRL-I to ‘Escape’ in insert mode without remapping at the same time? I normally use CTRL+[ because the Escape key on my
    Message 1 of 13 , Jan 27, 2011
    • 0 Attachment
      Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
      remapping <Tab> at the same time?

      I normally use CTRL+[ because the Escape key on my laptop is impossible
      to reach but even that is not really comfortable.

      Thanks,

      cj

      --
      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
    • Ben Schmidt
      ... No, this isn t currently possible with Vim. I don t think it will ever be possible with terminal Vim. But one day it might be possible with gVim, if the
      Message 2 of 13 , Jan 27, 2011
      • 0 Attachment
        On 28/01/11 3:56 PM, Chris Jones wrote:
        > Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
        > remapping<Tab> at the same time?
        >
        > I normally use CTRL+[ because the Escape key on my laptop is impossible
        > to reach but even that is not really comfortable.

        No, this isn't currently possible with Vim.

        I don't think it will ever be possible with terminal Vim. But one day it might be
        possible with gVim, if the keyboard code gets a thorough reworking. It probably
        won't happen any time soon.

        Ben.


        --
        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
      • Christophe-Marie Duquesne
        On Fri, Jan 28, 2011 at 6:52 AM, Ben Schmidt ... I think using an external tool such as xmodmap, you could remap to , but this solution would affect
        Message 3 of 13 , Jan 27, 2011
        • 0 Attachment
          On Fri, Jan 28, 2011 at 6:52 AM, Ben Schmidt
          <mail_ben_schmidt@...> wrote:
          > On 28/01/11 3:56 PM, Chris Jones wrote:
          >>
          >> Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
          >> remapping<Tab>  at the same time?

          I think using an external tool such as xmodmap, you could remap <c-i>
          to <esc>, but this solution would affect the whole system.

          --
          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
        • Tim Chase
          ... As others have mentioned, using ^I is a tough choice because it s usually treated as a . However there are other keys that may be accessible on your
          Message 4 of 13 , Jan 28, 2011
          • 0 Attachment
            On 01/27/2011 10:56 PM, Chris Jones wrote:
            > Is it possible to remap CTRL-I to ‘Escape’ in insert mode
            > without remapping <Tab> at the same time?
            >
            > I normally use CTRL+[ because the Escape key on my laptop is
            > impossible to reach but even that is not really comfortable.

            As others have mentioned, using ^I is a tough choice because it's
            usually treated as a <tab>. However there are other keys that
            may be accessible on your laptop. I happen to have <F1> remapped
            to <esc> as well because they're so physically close (and if I
            want help, I know to ask for it at the command-line) it's easy
            for me to mash a finger in the top-left of my keyboard to hit one
            of them.

            Alternatively, you could use some other control combination that
            you don't use frequently in insert-mode. Very few folks I know
            use ^A in insert mode (I can only think of about twice in my
            ~10yrs of vimming where it wasn't (a) to learn what it did or (b)
            to try and weasel down a keystroke on vimgolf.com) so it might
            make a good candidate -- especially if you've remapped/swapped
            your control-key and your caps-lock key. Another open candidate
            is ^B which non longer has any meaning.

            -tim



            --
            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
          • Chris Jones
            ... Thanks. A quick test showed me that the CTRL-I = equivalence is indeed ‘inherited’ from the underlying XTerm. So this is probably where I should
            Message 5 of 13 , Jan 28, 2011
            • 0 Attachment
              On Fri, Jan 28, 2011 at 12:52:55AM EST, Ben Schmidt wrote:
              > On 28/01/11 3:56 PM, Chris Jones wrote:

              >> Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
              >> remapping<Tab> at the same time?
              >>
              >> I normally use CTRL+[ because the Escape key on my laptop is
              >> impossible to reach but even that is not really comfortable.
              >
              > No, this isn't currently possible with Vim.
              >
              > I don't think it will ever be possible with terminal Vim.

              Thanks. A quick test showed me that the CTRL-I = <Tab> equivalence is
              indeed ‘inherited’ from the underlying XTerm. So this is probably where
              I should start looking.

              > But one day it might be possible with gVim,

              Me.. ‘gVim’.. that'll be the day.. :-)

              > if the keyboard code gets a thorough
              > reworking. It probably won't happen any time soon.

              cj

              --
              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
            • Chris Jones
              ... I have a couple of custom xkb layouts, including one that remaps Mod3+[UIOPHJKL] to the navigation keypad (arrows, Home, End, PgUp.. etc). I don t think
              Message 6 of 13 , Jan 28, 2011
              • 0 Attachment
                On Fri, Jan 28, 2011 at 01:37:17AM EST, Christophe-Marie Duquesne wrote:
                > On Fri, Jan 28, 2011 at 6:52 AM, Ben Schmidt
                > <mail_ben_schmidt@...> wrote:
                > > On 28/01/11 3:56 PM, Chris Jones wrote:

                > >> Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
                > >> remapping<Tab>  at the same time?
                >
                > I think using an external tool such as xmodmap, you could remap <c-i>
                > to <esc>, but this solution would affect the whole system.

                I have a couple of custom xkb layouts, including one that remaps
                Mod3+[UIOPHJKL] to the navigation keypad (arrows, Home, End, PgUp..
                etc). I don't think this approach handles Control key combos, though..

                I'll have to take a closer look.

                Thanks,

                cj

                --
                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
              • Chris Jones
                CM SPAM detection: spam References: User-Agent: Mutt/1.5.18 (2008-05-17)
                Message 7 of 13 , Jan 28, 2011
                • 0 Attachment
                  CM SPAM detection: spam
                  References: <20110128045628.GD4117@...>
                  <4D42BB15.6020300@...>
                  User-Agent: Mutt/1.5.18 (2008-05-17)
                  X-Original-Sender: cjns1989@...
                  X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com:
                  167.206.4.200 is neither permitted nor denied by domain of
                  cjns1989@...) smtp.mail=cjns1989@...
                  Reply-To: vim_use@...
                  Precedence: list
                  Mailing-list: list vim_use@...; contact vim_use+owners@...
                  List-ID: <vim_use.googlegroups.com>
                  List-Post: <http://groups.google.com/group/vim_use/post?hl=en_US>, <mailto:vim_use@...>
                  List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:vim_use+help@...>
                  List-Archive: <http://groups.google.com/group/vim_use?hl=en_US>
                  Sender: vim_use@...
                  List-Subscribe: <http://groups.google.com/group/vim_use/subscribe?hl=en_US>, <mailto:vim_use+subscribe@...>
                  List-Unsubscribe: <http://groups.google.com/group/vim_use/subscribe?hl=en_US>, <mailto:vim_use+unsubscribe@...>
                  Content-type: text/plain; charset=windows-1252
                  Content-transfer-encoding: quoted-printable
                  Content-disposition: inline

                  On Fri, Jan 28, 2011 at 07:48:21AM EST, Tim Chase wrote:

                  [..]

                  > As others have mentioned, using ^I is a tough choice because it's usually=
                  =20
                  > treated as a <tab>. =20

                  One thing I haven't looked at is using the underlying XTerm's Xresources
                  to remap CTRL-I. In theory, I would then be able to limit the scope of
                  this customization to a single XTerm by using its =91-name=92 command-line
                  flag to run it under a different name and thus customize its keyboard
                  map. Unfortunately, I run pretty much everything under a single instance
                  of XTerm multiplexed via GNU/screen.. so where I'm concerned, the change
                  would pretty much be =91system-wide=92 anyway.

                  > However there are other keys that may be accessible on your laptop.
                  > I happen to have <F1> remapped to <esc> as well because they're so
                  > physically close (and if I want help, I know to ask for it at the
                  > command-line) it's easy for me to mash a finger in the top-left of my
                  > keyboard to hit one of them.

                  That's precisely the problem I am running into with this new laptop: the
                  folks at Lenovo have placed the <Esc> key ais ll by itself above the
                  function keys row. But in any case, I tend to use function key mappings
                  only for stuff that I do once in a while (the pastetoggle key is a good
                  example). Speaking of toggles, I like them for very frequent keyboard
                  actions especially when they result in switching back and forth between
                  two keyboard states.. but obviously I couldn't =91imap=92 the I-key to
                  escape :-) .. and so I thought that the next best thing would be to use
                  =91i=92 to switch to insert mode and <modifier>+I to go back to normal mode=
                  .

                  > Alternatively, you could use some other control combination that you
                  > don't use frequently in insert-mode. Very few folks I know use ^A in
                  > insert mode (I can only think of about twice in my ~10yrs of vimming
                  > where it wasn't (a) to learn what it did or (b) to try and weasel down
                  > a keystroke on vimgolf.com) so it might make a good candidate --
                  > especially if you've remapped/swapped your control-key and your
                  > caps-lock key. Another open candidate is ^B which non longer has any
                  > meaning.

                  Ah.. i_CTRL-A indeed.. And I thought I knew everything.. :-)=20

                  I'll have to decide whether it's worth integrating to my working
                  habits.. there might be cases where doing a bunch of those in quick
                  succession might be a valuable timesaver.

                  Actually, while writing my reply, I tried a:

                  | :inoremap <Esc>i <Esc>

                  In my environment, this causes the <Alt+I> combo to send <Esc> to Vim..
                  and it looks like it might work with no side effects -- I first checked
                  in insert mode that <Alt+I> did not do anything that I could see and
                  I don't remember ever using it for anything else (?).

                  Hm. Touch wood, but this would be perfect.. it's as close as I'll get to
                  using the <I> key as a toggle.. and for a home-row person like me.. it
                  works very well indeed in terms of accessibiity.. My left thumb usually
                  rests on top of the left Alt key.. goody.. goody..!

                  Thanks to all for your comments. If this holds.. you very much helped
                  make my day!

                  cj

                  --=20
                  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
                • Ben Fritz
                  ... Alt keys do nothing special in Vim by default. If you re using GUI Vim you may need to read :help winaltkeys but it sounds like you re sticking with the
                  Message 8 of 13 , Jan 28, 2011
                  • 0 Attachment
                    On Jan 28, 12:14 pm, Chris Jones <cjns1...@...> wrote:
                    >
                    > Actually, while writing my reply, I tried a:
                    >
                    > | :inoremap <Esc>i <Esc>
                    >
                    > In my environment, this causes the <Alt+I> combo to send <Esc> to Vim..
                    > and it looks like it might work with no side effects -- I first checked
                    > in insert mode that <Alt+I> did not do anything that I could see and
                    > I don't remember ever using it for anything else (?).
                    >

                    Alt keys do nothing special in Vim by default. If you're using GUI Vim
                    you may need to read :help 'winaltkeys' but it sounds like you're
                    sticking with the terminal.

                    You can probably map it directly:

                    :inoremap <A-i> <Esc>

                    or

                    :inoremap <M-i> <Esc>

                    Note that Alt maps, unlike CTRL maps, are case-sensitive.

                    --
                    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
                  • Tim Chase
                    ... The only catch is that (depending on your encoding and other stellar alignments) some alt+letter combinations produce various accented & ASCII characters
                    Message 9 of 13 , Jan 28, 2011
                    • 0 Attachment
                      On 01/28/2011 12:14 PM, Chris Jones wrote:
                      > In my environment, this causes the<Alt+I> combo to send<Esc>
                      > to Vim.. and it looks like it might work with no side effects
                      > -- I first checked in insert mode that<Alt+I> did not do
                      > anything that I could see and I don't remember ever using it
                      > for anything else (?).

                      The only catch is that (depending on your encoding and other
                      stellar alignments) some alt+letter combinations produce various
                      accented & ASCII characters >128. If you type those characters
                      intentionally (which it sounds like you don't), it may interfere.
                      Otherwise, they should be safe to use (as mentioned in a
                      sibling reply, they're case-sensitive).

                      -tim



                      --
                      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
                    • Chris Jones
                      ... Ah, yes.. that s probably what I had at the back of my mind re: using the Alt modifier. ... Well, you know what.. I ve never been able to use the A- or M-
                      Message 10 of 13 , Jan 28, 2011
                      • 0 Attachment
                        On Fri, Jan 28, 2011 at 02:20:06PM EST, Ben Fritz wrote:
                        >
                        >
                        > On Jan 28, 12:14 pm, Chris Jones <cjns1...@...> wrote:
                        > >
                        > > Actually, while writing my reply, I tried a:
                        > >
                        > > | :inoremap <Esc>i <Esc>
                        > >
                        > > In my environment, this causes the <Alt+I> combo to send <Esc> to Vim..
                        > > and it looks like it might work with no side effects -- I first checked
                        > > in insert mode that <Alt+I> did not do anything that I could see and
                        > > I don't remember ever using it for anything else (?).
                        > >
                        >
                        > Alt keys do nothing special in Vim by default. If you're using GUI Vim
                        > you may need to read :help 'winaltkeys' but it sounds like you're
                        > sticking with the terminal.

                        Ah, yes.. that's probably what I had at the back of my mind re: using
                        the Alt modifier.

                        > You can probably map it directly:
                        >
                        > :inoremap <A-i> <Esc>
                        >
                        > or
                        >
                        > :inoremap <M-i> <Esc>

                        Well, you know what.. I've never been able to use the A- or M- syntax..
                        Tha's why I always specify <Esc> instead in my mappings. Time to revisit
                        this maybe..

                        > Note that Alt maps, unlike CTRL maps, are case-sensitive.

                        Interesting.. would mean that I can map Alt+<key> and Shift+Alt+<key> to
                        different things.. right?

                        Thanks,

                        cj

                        --
                        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
                      • Chris Jones
                        ... Sounds promising.. Straight US-ASCII boy that I am.. this shouldn t be a problem. Matter of fact, the first thing I do to an XTerm is make sure the 8th bit
                        Message 11 of 13 , Jan 28, 2011
                        • 0 Attachment
                          On Fri, Jan 28, 2011 at 03:14:36PM EST, Tim Chase wrote:
                          > On 01/28/2011 12:14 PM, Chris Jones wrote:

                          >> In my environment, this causes the<Alt+I> combo to send<Esc> to
                          >> Vim.. and it looks like it might work with no side effects -- I first
                          >> checked in insert mode that<Alt+I> did not do anything that I could
                          >> see and I don't remember ever using it for anything else (?).
                          >
                          > The only catch is that (depending on your encoding and other stellar
                          > alignments) some alt+letter combinations produce various accented
                          > & ASCII characters >128.

                          Sounds promising.. Straight US-ASCII boy that I am.. this shouldn't be
                          a problem. Matter of fact, the first thing I do to an XTerm is make sure
                          the 8th bit is disabled, so I can use Alt+. in the shell to retrieve the
                          last word of the previous command.

                          As in:

                          | $ mkdir foofoofoobarbarbar
                          | $ cd Alt+. # gives me: cd foofoofoobarbarbar etc.

                          I use this all the time.

                          > If you type those characters intentionally (which it sounds like you
                          > don't), it may interfere. Otherwise, they should be safe to use (as
                          > mentioned in a sibling reply, they're case-sensitive).

                          I usually enter such characters either via the compose key, level three
                          mappings accessed by pressign the Winkeys, or occasionally Vim digraphs.

                          Thanks,

                          cj

                          --
                          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
                        • Erik Christiansen
                          ... Originally to compensate for a uselessly small laptop ESC key, I long ago remapped Caps Lock to ESC: To change CAPS_LOCK to ESCAPE, put into ~/.Xmodmap:
                          Message 12 of 13 , Feb 1, 2011
                          • 0 Attachment
                            On Fri, Jan 28, 2011 at 07:37:17AM +0100, Christophe-Marie Duquesne wrote:
                            > On Fri, Jan 28, 2011 at 6:52 AM, Ben Schmidt
                            > <mail_ben_schmidt@...> wrote:
                            > > On 28/01/11 3:56 PM, Chris Jones wrote:
                            > >>
                            > >> Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
                            > >> remapping<Tab>  at the same time?
                            >
                            > I think using an external tool such as xmodmap, you could remap <c-i>
                            > to <esc>, but this solution would affect the whole system.

                            Originally to compensate for a uselessly small laptop ESC key, I long
                            ago remapped "Caps Lock" to ESC:

                            To change CAPS_LOCK to ESCAPE, put into ~/.Xmodmap:
                            keycode 0x42 = Escape
                            clear Lock # Disable Caps-Lock

                            Now I use it on desktops as well, because I've never found a use for
                            "Caps Lock" [1]. Since ESC is used so much in vim, it seems useful to have
                            it on a single key. Consistent behaviour across all applications is an
                            advantage, I find.

                            YMMV (by a large margin ;-)

                            Erik

                            [1] If ever a long shouting heading were needed, there are several vim
                            ways to convert after input.

                            --
                            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
                          • Chris Jones
                            ... I tried that.. but the problem is that I have switched the location of CapsLock and Left Control.. And on a ThinkPad keyboard, the left Control key sits
                            Message 13 of 13 , Feb 1, 2011
                            • 0 Attachment
                              On Tue, Feb 01, 2011 at 05:49:13AM EST, Erik Christiansen wrote:
                              > On Fri, Jan 28, 2011 at 07:37:17AM +0100, Christophe-Marie Duquesne wrote:
                              > > On Fri, Jan 28, 2011 at 6:52 AM, Ben Schmidt
                              > > <mail_ben_schmidt@...> wrote:
                              > > > On 28/01/11 3:56 PM, Chris Jones wrote:
                              > > >>
                              > > >> Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
                              > > >> remapping<Tab>  at the same time?
                              > >
                              > > I think using an external tool such as xmodmap, you could remap <c-i>
                              > > to <esc>, but this solution would affect the whole system.
                              >
                              > Originally to compensate for a uselessly small laptop ESC key, I long
                              > ago remapped "Caps Lock" to ESC:

                              I tried that.. but the problem is that I have switched the location of
                              CapsLock and Left Control.. And on a ThinkPad keyboard, the left Control
                              key sits between the Fn key and the Logo key.. it's also smaller than on
                              most keyboards.. Makes hitting it accurately even more of a challenge
                              than hitting the CTRL-[ combo.

                              Other things that I tried include remapping Escape to a double keystroke
                              such as in

                              :inoremap ;; <Esc>

                              but that didn't work out very well either.

                              > To change CAPS_LOCK to ESCAPE, put into ~/.Xmodmap:
                              > keycode 0x42 = Escape
                              > clear Lock # Disable Caps-Lock

                              > Now I use it on desktops as well, because I've never found a use for
                              > "Caps Lock" [1].

                              Apart from old-fashioned typing drills..

                              > Since ESC is used so much in vim, it seems useful to have it on
                              > a single key. Consistent behaviour across all applications is an
                              > advantage, I find.

                              Yes that's the main problem with remapping. Pretty useless if it clashes
                              with any other environment you use freaquently.. And the reason I am
                              dreaming of a desktop that gives you the option of some form of Vim
                              mode. I actually patched Window Maker, so that I could use hjkl to move
                              around menus.

                              Thanks,

                              cj

                              --
                              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
                            Your message has been successfully submitted and would be delivered to recipients shortly.