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

Re: keymapping problem

Expand Messages
  • A.J.Mechelynck
    ... Oops... I should have added: step 1 bis: hit i or a to get into Insert mode. Ctrl-V in Normal mode should put you into Block-visual. ... In my experience,
    Message 1 of 3 , Sep 5, 2006
      Bob Self wrote:
      > On Tue, Sep 05, 2006 at 10:51:07PM +0200, A.J.Mechelynck wrote:
      >> Depending on your termcap and/or on your windowmanager, some special key
      >> may not reach Vim. To check if Vim perceives Shift-Insert and
      >> Ctrl-Insert, do the following:
      >> 1. Open an empty buffer, e.g. with ":new"
      >> 2. Hit Ctrl-V followed by Shift-Insert
      >> 3. (Optional) Hit Enter to move to the next line
      >> 4. Hit Ctrl-V followed by Ctrl-Insert
      >> The above assumes that you don't use mswin.vim. If you do, then ctrl-V
      >> means "paste from clipboard" and you should use ctrl-Q instead at steps
      >> 2 and 4 above.
      >> Check what (if anything) is inserted into the buffer at steps 2 and 4.
      >> In gvim, you should see <S-Insert> and <C-Insert> respectively. In
      >> console Vim, it should look like a few characters of gibberish. However,
      >> if your window manager or terminal intercepts the key combo, then you
      >> may either get nothing, or more than just a few bytes. For instance, in
      >> konsole, when I hit Ctrl-V followed by Shift-Insert, it pastes the whole
      >> contents of the clipboard (without <S-Insert> being mapped), setting
      >> several undo points in the process (which seems to indicate that my
      >> mappings are active; and indeed I hadn't set 'paste'). In gvim OTOH I
      >> get the expected values.
      > In both vim and gvim I see nothing. Ctrl-V puts me in insert mode (is that right?).
      > I'm running Ubuntu / gnome / xterm.

      Oops... I should have added: step 1 bis: hit i or a to get into Insert
      mode. Ctrl-V in Normal mode should put you into Block-visual.

      >> There are several solutions, depending on what you see:
      >> - Tweak your 'timeout', 'timeoutlen' and 'ttimeoutlen' settings, if it
      >> looks like Vim might confuse the special key with an actual Escape
      >> followed by something. 'ttimeoutlen' should be faster than the fastest
      >> rate at which you yourself hit the keyboard (not including auto-repeat),
      >> but slower than the rate at which your keyboard interface pushes the
      >> successive bytes of a single special key into the keyboard typeahead
      >> buffer; and 'timeoutlen' should be slower than the slowest rate at which
      >> you yourself expect to be hitting the successive keys of a multibyte
      >> mapping, |i_CTRL-V| or |i_CTRL-V_digit| key sequence, or digraph. For
      >> instance, ":set timeout timeoutlen=5000 ttimeoutlen=333" will make
      >> special keys time out after one-third of a second and mappings after
      >> five seconds.
      >> - Check your ":set termcap" settings, if it seems that console Vim might
      >> be misundertanding what you type. The "few bytes of gibberish" seen in
      >> console Vim at steps 2 and 4 above should be identical with the
      >> corresponding termcap entries.
      > I typed ":set termcap" but I did not see <S-Insert> there.
      >> - Use gvim rather than console Vim, if gvim does not exhibit the problem
      >> - Use a different terminal emulator
      >> - Change window managers, if both vim-in-xterm and gvim exhibit the
      >> problem. But if it's not the window manager but the X11 server this
      >> approach won't work; and since you want to access the X clipboard you
      >> can't use the /dev/tty (non-X pure-text) console.
      >> - Map a different key, such as some Fn key or key combo. If you want
      >> uniformity with W32 you can map the same Fn key in W32 too.
      >> Best regards,
      >> Tony.
      > I guess the conclusion is that <S-Insert> is not getting to vim. I don't want to
      > change from linux / Ubuntu / gnome / xterm, so am I stuck? <F7> and <F8> work, so I
      > could switch to those keys on win32 if there is no solution.
      > thanks,
      > Bob

      In my experience, <F1> to <F12> (except F1 for Help and maybe F10 for
      Menu) and <S-F1> to <S-F12> are the "most portable" keys to map; AFAIK,
      they are seen by all flavours of vim and gvim, and aren't already in use
      for built-in commands.

      Best regards,
    Your message has been successfully submitted and would be delivered to recipients shortly.