Vim, GNU Screen and arrow keys

Here’s a typcial scenario: I use Putty SSH into my University’s unix system, bring up screen and then proceed to do whatever work I have to do. Often this involves using Vim to write code or edit documents. Over the summer the CS department upgraded a bunch of their software - including upgrading Vim to Vim 7. Starting classes again I went to do my usual routine and found that the Arrow Keys in Vim under Screen would insert characters instead of moving the cursor. A solution was harder to find than I thought it should, so I’m posting it here:

Problem: Log into your unix/linux/solaris/whatever account and bring up screen.  Launch Vim and in insert mode use the arrow keys to move your cursor. Up arrow inserts 0A or A, Down arrow inserts B, etc.

Solution: The best solution I found was this one which instructs you to use:

:set term=builtin_ansi

which I dropped into my .vimrc file. There are more solutions involving remapping keys, setting macros and tons of other over-the-top kind of stuff. Why its only problem in Putty using Screen (I’ve tested some other permutations) is beyond me.

While on the topic of Vim, if you’re using Windows you might want to check out intellisense for Vim, two of my favorite things.

 

**EDIT**

Ok, that doesn’t really solve the problem AND it disables syntax coloring. The problem, I’ve discovered, is that Vim is reading it’s terminal setting from Screen and using ’screen’ as it’s terminal type.  Instead you’ll want to set it to xterm. I recommend adding:

set term=xterm 

to your .vimrc

Google the Google

I was searching for an answer the other day at work so I went to my favorite search engine and typed in my query. Page after page after page of results came back and they all said: “Q: How do I solve this problem? A: Have you tried googling it?”

Several pages deep I found the solution to my problem and a very interesting comment that spurred me to this post. They predicted that the death of google would be google itself - trillions of pages indexed saying: “just google it.” I wish I could remember what the question was I was searching for or who the poster was, but I cannot. Whoever you are, astute commenter, I salute you!

Back to school

School starting again and its back to the grindstone for me. I’m really excited about the classes I’m taking this semester: Operating Systems, Intro to Algorithms, Software Design, Computer Ethics and Scientific Presentations.  I usually have high opinions of my classes when they start and through the semester those good feelings begin to erode. I’m holding out for this one though, with two semesters left I’ve got to enjoy ‘em while I’ve got ‘em.