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

Control-

Expand Messages
  • Paul
    In gvim, when at vim s command line, I can do c- and c- to move the cursor to the previous/next word boundary. In normal vim, I cannot do this. It
    Message 1 of 9 , Jan 26, 2010
      In gvim, when at vim's command line, I can do c-<left> and c-<right> to move the cursor to the previous/next word boundary. In normal vim, I cannot do this. It tries to enter the control code text "1;5D" into the document instead (and I lose the command that I was composing).

      I had a look at what :imap shows for both vim and gvim, but all those imaps are the same.

      Is there anything I can do to make c-<left> and c-<right> work at the : command in vim?

      Also, I suppose there would be no way to make that work with standard readline? :help readline just brings up stuff about the readline.vim syntax file.

      --

      .

      --
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Gary Johnson
      ... I m not sure about this, but I think vim uses an internal terminal-definition database to determine the escape sequences used by some terminals for keys
      Message 2 of 9 , Jan 26, 2010
        On 2010-01-26, Paul wrote:
        > In gvim, when at vim's command line, I can do c-<left> and c-<right> to
        > move the cursor to the previous/next word boundary. In normal vim, I cannot
        > do this. It tries to enter the control code text "1;5D" into the document
        > instead (and I lose the command that I was composing).
        >
        > I had a look at what :imap shows for both vim and gvim, but all those imaps
        > are the same.
        >
        > Is there anything I can do to make c-<left> and c-<right> work at the :
        > command in vim?

        I'm not sure about this, but I think vim uses an internal
        terminal-definition database to determine the escape sequences used
        by some terminals for keys that don't have terminfo or termcap
        definitions. The value of TERM in your environment may be one that
        vim does not recognize as supporting c-<left> and c-<right>.

        One solution is to set the value of TERM to one that vim recognizes
        and whose terminfo database accurately reflects the capabilities of
        your terminal. I think the ones vim recognizes are:

        xterm
        nxterm
        kterm
        mlterm
        rxvt

        Another solution would be to map the sequences your terminal emits
        to the <C-Left> and <C-Right> key codes, e.g.,

        :cmap <Esc>[1;5D <C-Left>
        :cmap <Esc>[1;5C <C-Right>

        > Also, I suppose there would be no way to make that work with standard
        > readline? :help readline just brings up stuff about the readline.vim syntax
        > file.

        Do you mean have Ctrl-Left and Ctrl-Right work at the shell prompt
        or do you mean have vim use readline? If you mean the latter, then
        no. For the former, see

        man readline

        HTH,
        Gary


        --
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
      • Paul
        ... I m using mlterm, but XTERM is set to xterm . When I set it to mlterm , I get the same behaviour. It works when I run vim from xterm, though, both when
        Message 3 of 9 , Jan 30, 2010
          On Tue, Jan 26, 2010 at 11:35:08AM -0800, Gary Johnson wrote:
          >One solution is to set the value of TERM to one that vim recognizes
          >and whose terminfo database accurately reflects the capabilities of
          >your terminal. I think the ones vim recognizes are:
          >
          > xterm
          > nxterm
          > kterm
          > mlterm
          > rxvt

          I'm using mlterm, but XTERM is set to 'xterm'. When I set it to 'mlterm', I get the same behaviour. It works when I run vim from xterm, though, both when TERM is 'xterm' and 'mlterm'.

          >Another solution would be to map the sequences your terminal emits
          >to the <C-Left> and <C-Right> key codes, e.g.,
          >
          > :cmap <Esc>[1;5D <C-Left>
          > :cmap <Esc>[1;5C <C-Right>

          I tried it but it didn't work - same behaviour :(

          >> Also, I suppose there would be no way to make that work with standard
          >> readline? :help readline just brings up stuff about the readline.vim syntax
          >> file.
          >
          >Do you mean have Ctrl-Left and Ctrl-Right work at the shell prompt
          >or do you mean have vim use readline? If you mean the latter, then
          >no. For the former, see

          The former. Oh well :)

          --

          .

          --
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
        • Gary Johnson
          ... I assume that XTERM is a typo and that you meant TERM . ... That suggests to me that vim is properly configuring itself to accept the escape sequences
          Message 4 of 9 , Jan 31, 2010
            On 2010-01-30, Paul wrote:
            > On Tue, Jan 26, 2010 at 11:35:08AM -0800, Gary Johnson wrote:
            > >One solution is to set the value of TERM to one that vim recognizes
            > >and whose terminfo database accurately reflects the capabilities of
            > >your terminal. I think the ones vim recognizes are:
            > >
            > > xterm
            > > nxterm
            > > kterm
            > > mlterm
            > > rxvt
            >
            > I'm using mlterm, but XTERM is set to 'xterm'. When I set it to 'mlterm', I
            > get the same behaviour. It works when I run vim from xterm, though, both
            > when TERM is 'xterm' and 'mlterm'.

            I assume that "XTERM" is a typo and that you meant "TERM".

            > >Another solution would be to map the sequences your terminal emits
            > >to the <C-Left> and <C-Right> key codes, e.g.,
            > >
            > > :cmap <Esc>[1;5D <C-Left>
            > > :cmap <Esc>[1;5C <C-Right>
            >
            > I tried it but it didn't work - same behaviour :(

            That suggests to me that vim is properly configuring itself to
            accept the escape sequences for those keys from both terminal types,
            but that your mlterm is emitting different sequences from the ones
            that vim expects from an mlterm. Try this. Open a new buffer and
            enter insert mode. Then type Ctrl-V followed by Ctrl-Left. Type
            Enter, then Ctrl-V followed by Ctrl-Right. What do you see?

            Regards,
            Gary


            --
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
          • Benjamin R. Haskell
            ... There was a similar thread recently on the Zsh list about the Home and End keys. If I m not mistaken, Vim puts terminals into application mode,
            Message 5 of 9 , Jan 31, 2010
              On Sun, 31 Jan 2010, Gary Johnson wrote:

              > On 2010-01-30, Paul wrote:
              > > On Tue, Jan 26, 2010 at 11:35:08AM -0800, Gary Johnson wrote:
              > > >One solution is to set the value of TERM to one that vim recognizes
              > > >and whose terminfo database accurately reflects the capabilities of
              > > >your terminal. I think the ones vim recognizes are:
              > > >
              > > > xterm
              > > > nxterm
              > > > kterm
              > > > mlterm
              > > > rxvt
              > >
              > > I'm using mlterm, but XTERM is set to 'xterm'. When I set it to
              > > 'mlterm', I get the same behaviour. It works when I run vim from
              > > xterm, though, both when TERM is 'xterm' and 'mlterm'.
              >
              > I assume that "XTERM" is a typo and that you meant "TERM".
              >
              > > >Another solution would be to map the sequences your terminal emits
              > > >to the <C-Left> and <C-Right> key codes, e.g.,
              > > >
              > > > :cmap <Esc>[1;5D <C-Left>
              > > > :cmap <Esc>[1;5C <C-Right>
              > >
              > > I tried it but it didn't work - same behaviour :(
              >
              > That suggests to me that vim is properly configuring itself to accept
              > the escape sequences for those keys from both terminal types, but that
              > your mlterm is emitting different sequences from the ones that vim
              > expects from an mlterm. Try this. Open a new buffer and enter insert
              > mode. Then type Ctrl-V followed by Ctrl-Left. Type Enter, then
              > Ctrl-V followed by Ctrl-Right. What do you see?
              >

              There was a similar thread recently on the Zsh list about the 'Home' and
              'End' keys. If I'm not mistaken, Vim puts terminals into 'application'
              mode, where, in mlterm, the sequences are:

              (bare) (Ctrl+)
              Up ^[OA ^[O1;5A
              Down ^[OB ^[O1;5B
              Right ^[OC ^[O1;5C
              Left ^[OD ^[O1;5D
              O = capital o, not zero

              I found those by using 'zsh' running under 'mlterm' via:

              print $terminfo[smkx] ; cat > /dev/null ; print $terminfo[rmkx]

              (Without the 'smkx'/'rmkx' enter- and leave- keyboard_transmit-mode, it
              emits XTerm-like sequences:)

              (bare) (Ctrl+)
              Up ^[[A ^[[1;5A
              Down ^[[B ^[[1;5B
              Right ^[[C ^[[1;5C
              Left ^[[D ^[[1;5D

              The upshot is that the Vim mappings the OP is looking for are:

              :cmap <Esc>O1;5A <C-Up>
              :cmap <Esc>O1;5B <C-Down>
              :cmap <Esc>O1;5C <C-Right>
              :cmap <Esc>O1;5D <C-Left>

              (Then any <C-arrow> mappings should work.)

              It may or may not matter, but I was using the correct TERM value
              (TERM=mlterm).

              --
              Best,
              Ben

              --
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
            • Benjamin R. Haskell
              ... But, I could just as well have read Gary s suggestion more closely and typed *Ctrl-V followed by* the keys in Vim insert mode. Oops. :-) -- Best, Ben --
              Message 6 of 9 , Jan 31, 2010
                On Sun, 31 Jan 2010, Benjamin R. Haskell wrote:

                > On Sun, 31 Jan 2010, Gary Johnson wrote:
                >
                > > [...]
                > >
                > > That suggests to me that vim is properly configuring itself to
                > > accept the escape sequences for those keys from both terminal types,
                > > but that your mlterm is emitting different sequences from the ones
                > > that vim expects from an mlterm. Try this. Open a new buffer and
                > > enter insert mode. Then type Ctrl-V followed by Ctrl-Left. Type
                > > Enter, then Ctrl-V followed by Ctrl-Right. What do you see?
                > >
                >
                > [...]
                >
                > I found those by using 'zsh' running under 'mlterm' via:
                >
                > print $terminfo[smkx] ; cat > /dev/null ; print $terminfo[rmkx]

                But, I could just as well have read Gary's suggestion more closely and
                typed *Ctrl-V followed by* the keys in Vim insert mode. Oops. :-)

                --
                Best,
                Ben

                --
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
              • Benjamin R. Haskell
                ... But, I could just as well have read Gary s suggestion more closely and typed *Ctrl-V followed by* the keys in Vim insert mode. Oops. :-) -- Best, Ben --
                Message 7 of 9 , Jan 31, 2010
                  On Sun, 31 Jan 2010, Benjamin R. Haskell wrote:

                  > On Sun, 31 Jan 2010, Gary Johnson wrote:
                  >
                  > > [...]
                  > >
                  > > That suggests to me that vim is properly configuring itself to
                  > > accept the escape sequences for those keys from both terminal types,
                  > > but that your mlterm is emitting different sequences from the ones
                  > > that vim expects from an mlterm. Try this. Open a new buffer and
                  > > enter insert mode. Then type Ctrl-V followed by Ctrl-Left. Type
                  > > Enter, then Ctrl-V followed by Ctrl-Right. What do you see?
                  > >
                  >
                  > [...]
                  >
                  > I found those by using 'zsh' running under 'mlterm' via:
                  >
                  > print $terminfo[smkx] ; cat > /dev/null ; print $terminfo[rmkx]

                  But, I could just as well have read Gary's suggestion more closely and
                  typed *Ctrl-V followed by* the keys in Vim insert mode. Oops. :-)

                  --
                  Best,
                  Ben

                  --
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                • Gary Johnson
                  ... That would explain this from the original post, too: In gvim, when at vim s command line, I can do c- and c- to move the cursor to the
                  Message 8 of 9 , Feb 1, 2010
                    On 2010-01-31, Benjamin R. Haskell wrote:

                    > There was a similar thread recently on the Zsh list about the 'Home' and
                    > 'End' keys. If I'm not mistaken, Vim puts terminals into 'application'
                    > mode, where, in mlterm, the sequences are:
                    >
                    > (bare) (Ctrl+)
                    > Up ^[OA ^[O1;5A
                    > Down ^[OB ^[O1;5B
                    > Right ^[OC ^[O1;5C
                    > Left ^[OD ^[O1;5D
                    > O = capital o, not zero

                    That would explain this from the original post, too:

                    In gvim, when at vim's command line, I can do c-<left> and
                    c-<right> to move the cursor to the previous/next word boundary.
                    In normal vim, I cannot do this. It tries to enter the control
                    code text "1;5D" into the document instead (and I lose the
                    command that I was composing).

                    which I couldn't reconcile with the escape sequences I was seeing.

                    Regards,
                    Gary


                    --
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                  • Paul
                    ... Yes, sorry. ... Yay! I tried Gary s ctrl-v suggestion and it put ^[O1;5D in the buffer, but it didn t work until I tried the above - cmap without the [
                    Message 9 of 9 , Feb 6, 2010
                      On Sun, Jan 31, 2010 at 01:33:16PM -0500, Benjamin R. Haskell wrote:
                      >> > I'm using mlterm, but XTERM is set to 'xterm'. When I set it to
                      >> > 'mlterm', I get the same behaviour. It works when I run vim from
                      >> > xterm, though, both when TERM is 'xterm' and 'mlterm'.
                      >>
                      >> I assume that "XTERM" is a typo and that you meant "TERM".

                      Yes, sorry.

                      >The upshot is that the Vim mappings the OP is looking for are:
                      >
                      >:cmap <Esc>O1;5A <C-Up>
                      >:cmap <Esc>O1;5B <C-Down>
                      >:cmap <Esc>O1;5C <C-Right>
                      >:cmap <Esc>O1;5D <C-Left>

                      Yay! I tried Gary's ctrl-v suggestion and it put ^[O1;5D in the buffer, but it didn't work until I tried the above - cmap without the [ character!

                      >It may or may not matter, but I was using the correct TERM value
                      >(TERM=mlterm).

                      It doesn't matter.

                      Thanks, guys!


                      --

                      .

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