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

Problems with mappings using the Shift in the terminal

Expand Messages
  • Pablo Giménez
    Hi vims. Well I haveaa buch of keymaos using the Shift key that works perfectly in gvim, but not in the terminal, for instance: nnoremap v
    Message 1 of 5 , Apr 28, 2009
    • 0 Attachment
      Hi vims.
      Well I haveaa buch of keymaos using the Shift key that works perfectly in gvim, but not in the terminal, for instance:
      nnoremap <S-PageDown> v<C-D>
      nnoremap <S-PageUp> v<C-U>
      vnoremap <S-PageDown> <C-D>
      vnoremap <S-PageUp> <C-U>
      vnoremap <PageDown> <C-D>
      vnoremap <PageUp> <C-U>
      inoremap <S-PageDown> <Esc>v<C-D>
      inoremap <S-PageUp> <Esc>v<C-U>
       or
      nnoremap <S-Home> v<Home>
      nnoremap <S-End> v<End>
      nnoremap <C-S-Home> v<Home>
      nnoremap <C-S-End> v<End>
      inoremap <S-Home> <Esc>v<Home>
      inoremap <S-End> <Esc>v<End>

      I use these mappings to make selections using the shift key as in regular editors, but no one og them do nothing in the terminal.
      The thing that is strange for me is that these other maps works:
      nnoremap <C-S-Left> vb
      nnoremap <C-S-Right> ve
      vnoremap <C-S-Left> b
      vnoremap <C-S-Right> e
      inoremap <C-S-Left> <Esc><Left>vb
      inoremap <C-S-Right> <Esc><Right>ve

      So I guess that meybe the problem is with the PageDown/Up and Home/End keys and not with the Shift.
      Any ideas????
      thanks

      --
      Un saludo
      Best Regards
      Pablo Giménez

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---

    • Gene Kwiecinski
      ... Go into insert mode and hit ^V and the key in question, for each and and see what gets returned. Might be that the g version can
      Message 2 of 5 , Apr 28, 2009
      • 0 Attachment
        >Well I haveaa buch of keymaos using the Shift key that works
        >perfectly in gvim, but not in the terminal, for instance:

        Go into insert mode and hit ^V and the key in question, for each <PgDn>
        and <shf><PgDn> and see what gets returned. Might be that the g version
        can discern the two, but the console version might not.

        Sounds like the same complaint when people want to use, eg, ^g for one
        thing, then shift it and use ^G for something else. Both ^g and ^G
        "look the same", as both return the char \007 to the keyboard handler.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Gary Johnson
        ... [...] ... GUI programs such as gvim receive keyboard input in the form of keycodes, that is, some indication of which key was typed along with any modifier
        Message 3 of 5 , Apr 28, 2009
        • 0 Attachment
          On 2009-04-28, Pablo Giménez wrote:
          > Hi vims.
          > Well I haveaa buch of keymaos using the Shift key that works perfectly in
          > gvim, but not in the terminal, for instance:

          [...]

          > I use these mappings to make selections using the shift key as in regular
          > editors, but no one og them do nothing in the terminal.
          > The thing that is strange for me is that these other maps works:
          > nnoremap <C-S-Left> vb
          > nnoremap <C-S-Right> ve
          > vnoremap <C-S-Left> b
          > vnoremap <C-S-Right> e
          > inoremap <C-S-Left> <Esc><Left>vb
          > inoremap <C-S-Right> <Esc><Right>ve
          >
          > So I guess that meybe the problem is with the PageDown/Up and Home/End keys
          > and not with the Shift.
          > Any ideas????

          GUI programs such as gvim receive keyboard input in the form of
          keycodes, that is, some indication of which key was typed along with
          any modifier keys that were being pressed at the time. Terminal
          emulators also receive keyboard input in this form, but they send to
          their client programs (such as vim) only 8-bit characters. Some
          keys such as the arrow keys and the function keys (f1, et al.) are
          indicated to the clients by sequences of 7-bit (ASCII) characters.
          For example, when I press the left arrow on this keyboard, the
          terminal emulator sends <esc>OD to vim, where <esc> is the ASCII
          Escape character, decimal value 27.

          Terminal emulators typically send unique characters or sequences of
          characters beginning with the Escape character (escape sequences)
          only for symbols visible on the keyboard, not for arbitrary
          combinations of keys and modifiers. Notable exceptions, as you have
          discovered, are the arrow keys with Shift and/or Ctrl modifiers to
          allow terminal-based editors to adopt popular GUI editor paradigms.

          So, you're not going to be able to use with vim in a terminal all
          the mappings you can use with gvim. Which ones you can use depends
          on the particular terminal emulator you're using. To find out what
          character or charter sequence your terminal is emitting for a given
          key, put vim into insert mode, type Ctrl-V, then type the key in
          question. If Home and Shift-Home, for example, generate the same
          character sequence, then vim won't be able to distinguish them.

          HTH,
          Gary



          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Pablo Giménez
          2009/4/28 Gary Johnson ... Thanks Gary for he explanation, I understand. I have checked and yes in my terminal, a xterm, is returning the
          Message 4 of 5 , Apr 29, 2009
          • 0 Attachment
            2009/4/28 Gary Johnson <garyjohn@...>

            On 2009-04-28, Pablo Giménez wrote:
            > Hi vims.
            > Well I haveaa buch of keymaos using the Shift key that works perfectly in
            > gvim, but not in the terminal, for instance:

            [...]

            > I use these mappings to make selections using the shift key as in regular
            > editors, but no one og them do nothing in the terminal.
            > The thing that is strange for me is that these other maps works:
            > nnoremap <C-S-Left> vb
            > nnoremap <C-S-Right> ve
            > vnoremap <C-S-Left> b
            > vnoremap <C-S-Right> e
            > inoremap <C-S-Left> <Esc><Left>vb
            > inoremap <C-S-Right> <Esc><Right>ve
            >
            > So I guess that meybe the problem is with the PageDown/Up and Home/End keys
            > and not with the Shift.
            > Any ideas????

            GUI programs such as gvim receive keyboard input in the form of
            keycodes, that is, some indication of which key was typed along with
            any modifier keys that were being pressed at the time.  Terminal
            emulators also receive keyboard input in this form, but they send to
            their client programs (such as vim) only 8-bit characters.  Some
            keys such as the arrow keys and the function keys (f1, et al.) are
            indicated to the clients by sequences of 7-bit (ASCII) characters.
            For example, when I press the left arrow on this keyboard, the
            terminal emulator sends <esc>OD to vim, where <esc> is the ASCII
            Escape character, decimal value 27.

            Terminal emulators typically send unique characters or sequences of
            characters beginning with the Escape character (escape sequences)
            only for symbols visible on the keyboard, not for arbitrary
            combinations of keys and modifiers.  Notable exceptions, as you have
            discovered, are the arrow keys with Shift and/or Ctrl modifiers to
            allow terminal-based editors to adopt popular GUI editor paradigms.

            So, you're not going to be able to use with vim in a terminal all
            the mappings you can use with gvim.   Which ones you can use depends
            on the particular terminal emulator you're using.  To find out what
            character or charter sequence your terminal is emitting for a given
            key, put vim into insert mode, type Ctrl-V, then type the key in
            question.  If Home and Shift-Home, for example, generate the same
            character sequence, then vim won't be able to distinguish them.
            Thanks Gary for he explanation, I understand.
            I have checked and yes in my terminal, a xterm, is returning the same codes for both Home and Ctrl-Home, in fact any combination of Home returns always the same code.
            So is there any way so setup a xterm to send to client applicatins keycodes instead of the ASCII 8bits codes???
            thx


            HTH,
            Gary







            --
            Un saludo
            Best Regards
            Pablo Giménez

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---

          • Will
            ... Check for .Xresources/.Xdefaults for any keybindings/translations that might be interfering. Also, xterm normally captures Shift-PageUp/PageDown/Up/Down
            Message 5 of 5 , May 1, 2009
            • 0 Attachment
              On Apr 29, 1:17 pm, Pablo Giménez <pablog...@...> wrote:
              > I have checked and yes in my terminal, a xterm, is returning the same codes
              > for both Home and Ctrl-Home, in fact any combination of Home returns always
              > the same code.
              > So is there any way so setup a xterm to send to client applicatins keycodes
              > instead of the ASCII 8bits codes???
              > thx

              Check for .Xresources/.Xdefaults for any keybindings/translations that
              might be interfering.

              Also, xterm normally captures Shift-PageUp/PageDown/Up/Down for
              scrolling through the output buffer. This happens regardless of Ctrl,
              Alt, Meta, or any other modifier being used in addition.

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