Fixing backspace in VIM for OSX

November 11th, 2009

Finally, I figured this out! It’s been driving me nuts for months. On my MacBook, in VIM, the default backspace (actually labeled delete) key has deleted the letter the cursor was on. I’ve always wanted this to behave as a regular backspace button, where it deletes the character to the left of the cursor. Well my friends, thanks to this article, I’ve finally figured it out. Check out the instructions below for how to set this up.

Create and/or find your VIM settings file

On the root of your server, create (if there isn’t one already) a file called vimrc. To see if you already have this setup, input the following command vim ~/.vimrc. If you see a page with a number of options you’re there, if it’s blank just add the below code and save it – which will also create the file.

Save is :w if you’re new to VIM.

The code to fix backspace

Insert the following code in your vimrc file.

set backspace=indent,eol,start
” note that the following “ctrl-vBACKSPACE” is made by hitting ctrl-v and then backspace…
set t_kb=ctrl-vBACKSPACE
fixdel

Save your vimrc file, open another file and test it out. Your cursor should now be deleting the character to the left of it. YES!

Share this post

  • Twitter
  • Facebook
  • Delicious

Comments