Muffinresearch Labs by Stuart Colville

vim tip: Fix the cursor keys echoing characters in insert mode | Comments (4)

Posted in Linux/Unix on 15th October 2006, 2:01 pm by Stuart

Occasionally you’ll log into a remote server and find that the cursor keys echo characters when you are in insert mode using vim. Here’s how to resolve it by modifying your vimrc configuration file:

  1. vim ~/.vimrc
  2. i (Enter insert mode)
  3. set t_ku= (now type Ctrl-V and press cursor up)
  4. set t_kd= (now type Ctrl-V and press cursor down)
  5. set t_kr= (now type Ctrl-V and press cursor right)
  6. set t_kl= (now type Ctrl-V and press cursor left)
  7. Press escape to exit insert mode
  8. Ctrl-zz (Saves the file and exits vim)

Post Tools

Comments: Add yours

1. On November 1st, 2006 at 3:37 pm Isofarro said:

After step 6, press Esc to get into command mode (beep mode) first, and then do Ctrl-zz to save and exit.

2. On November 1st, 2006 at 3:40 pm Stuart Colville said:

Well spotted Mike, I’ve amended the instructions. Thanks.

3. On October 23rd, 2008 at 8:00 pm Jonathan said:

I’ve seen a lot of times that this is caused by vim running in compatible mode. You can fix this by editing ~/.vimrc and adding the following line:

set nocompatible

4. On May 29th, 2009 at 5:25 pm Chris said:

Jonathan is correct this is definitively fixed with adding

set nocompatible

to your ~/.vimrc file or even adding:

:set nocompatible

to your /usr/local/share/vim/vimrc file (this is the default file for system wide configuration. Thanks Jonathan, it worked great for me.







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(2)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.708s.