When using PuTTY to SSH to a Linux server and edit files, I’ve encountered on several occasions where navigating in vim using the cursor (arrow) keys on the keyboard while in insert mode results in control characters and/or new lines being inserted. Here are a couple of ways to rectify the situation.
- Check if the vim command is pointing to the full version of vim or vim tiny.
$ which vim
Some Linux distros link vim to vim tiny. If it’s pointing to the normal vim, skip to step 4, below.
- If you’re using vim tiny and want to continue to do so, then edit /etc/vim/vimrc.tiny and add the command set nocompatible to turn off compatibility mode.
- If you’d rather have the normal vim editor, then install it. After installation, confirm that the vim command points to the correct version and continue with step 4, below.
- Check that /etc/vim/vimrc (or ~/.vimrc) contains the command, set no compatible, to turn off compatibility mode.
That should do it. If you still have trouble, be sure that your terminal is set correctly in PuTTY and on the remote system.
Have another way to fix this issue? Post it in the comments.
If you’re using Synergy, all of your keystrokes are sent over the network as cleartext because Synergy does not provide any encryption. In other words, unless you’re using a private network to connect your computers, anyone can sniff the data to see what you’re typing to client computers including passwords, credit card numbers and other sensitive information.
The good news is that it’s not too difficult to prevent snooping by using OpenSSH. The Synergy Network Security Guide shows you how to do this on Linux/Unix-based systems (which should work similarly on Mac OS X).
The bad news is that if your Synergy server or client is on Windows, setting up OpenSSH isn’t as straightforward. I was in this situation for quite a while and, after several unsuccessful tries, I put it on the shelf for a while. Well, tonight I found a very good resource to get OpenSSH working on Windows. I successfully set up a Synergy/OpenSSH server on a Windows XP laptop and connected a Linux client to it.
Note that if you’re using QuickSynergy to set up a client on Linux or Mac OS X, you can simply enter localhost as the server name in the QuickSynergy dialog instead of running synergyc -f localhost as described in the last step of the Synergy Network Security Guide.