Muffinresearch Labs by Stuart Colville

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

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

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

  • http://www.isolani.co.uk/blog/ Isofarro

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

  • http://muffinresearch.co.uk Stuart Colville

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

  • Jonathan

    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

  • Chris

    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.

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|(3)

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