Find the answer to your Linux question:
Results 1 to 7 of 7
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Vim annoyance; possible bug

    I am experiencing (and have been for quite a while now) a VERY annoying problem in vim. Whenever I try to retrieve my last search history by using /<Up Arrow>, vim snaps into Insert mode and inserts the letter A (likewise, the right, down and left arrows produce C, B, and D, respectively). Pressing :<Up Arrow> shows me my command history like it's supposed to, but the search history refuses to work normally.

    This problem occurs only with graphical terminal emulators such as gnome-terminal and konsole. Gvim works fine, while the tty consoles will beep when I press /<Up Arrow>. It occurs both as root and as a normal user.

    Deleting my .vimrc (read: renaming it to something vim won't look for) does NOT change anything.

    This problem only occurs on my current system (specs below); my other system, which has the exact same version of vim compiled in exactly the same manner. Global configuration files are identical as far as I know since I haven't altered them on either system.

    System specs: Gentoo with kernel 2.6.18-gentoo-r6, 64-bit dual core processor with appropriate 64-bit setup. See for extensive specs.

    Vim versioning information:
    $ eix vim
    [I] app-editors/gvim 
         Available versions:  6.4 7.0.17 ~7.0.91 ~7.0.146 ~7.0.174
         Installed:           7.0.17(19:43:29 16/01/07)(-acl -aqua bash-completion -cscope gnome gpm gtk motif -mzscheme netbeans nextaw nls perl python ruby)
         Description:         GUI version of the Vim text editor
    [I] app-editors/vim 
         Available versions:  6.4 7.0.17 ~7.0.91 ~7.0.146 [m](~)7.0.174
         Installed:           7.0.17(17:11:22 16/01/07)(-acl bash-completion -cscope gpm -minimal -mzscheme nls perl python ruby -vim-pager -vim-with-x)
         Description:         Vim, an improved vi-style text editor
    [I] app-editors/vim-core 
         Available versions:  6.4 7.0.17 ~7.0.91 ~7.0.146 [m](~)7.0.174
         Installed:           7.0.17(17:09:32 16/01/07)(-acl bash-completion -livecd nls)
         Description:         vim and gvim shared files
    My other system is a 32-bit single-core one, also with Gentoo on it. Again, the configuration for vim is exactly the same USE-flag- and version-wise.

    This is all the relevant information I can think of for now, but please do tell me if you need more.

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    The "produce letter" thing happens in old versions of vi, which suggests to me that you may have somehow messed with the mapping of the arrow keys. I know that there are ways to change the behavior of the keys (I did it with backspace during my last summer job), and Gvim has a separate config file from Vim. So try looking up the key bindings and manually setting them in your vimrc.

  3. #3
    Hmm, thanks. I have now found out that <C-V>(Up Arrow) produces <Up> in gvim and ^[0A in vim, probably because Vim is running through a terminal. I've tried to just use :map ^[0A <Up>, but that didn't do a thing. How would I go about mapping it, and why does everything else work fine with ^[0A, while the search history does not?

  4. $spacer_open
  5. #4
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Traditionally, moving through vi was done with h is left j is down k is up and l is right. This is normal operation, unless /etc/vimrc or ~/.vimrc says otherwise.

  6. #5
    Quite possible, but the problem is, HOW do I configure .vimrc to do otherwise, and WHY does this only happen on the 64-bit system, but not for the other one, despite it being configured the exact same way for vim?

    Also, I know that having a .vimrc automatically sets nocp, and I thought that was supposed to take care of making the arrow keys work...

  7. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Possibly different vimrc installed with 64 bit rpm? If vim is even 64 bit I don't know, have you tried copying both /etc/vimrc and your home vimrc over to the system that doesn't work from the system that does?

  8. #7
    RPM? I use Gentoo, so portage built it from source.

    Both the global /etc/vimrc and the personal ~/.vimrc files are identical on both systems, so that couldn't be it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts