Fix SSH + VIM issues on mac to windows box running cygwin


Recently I ran into some vim issues while ssh’ing onto a windows server running cygwin… the process of getting things to work right was painful enough for me to do a write up.

To be more explicit, this was my situation : I was working on a mac laptop ssh’ing onto a windows machine running cygwin and using vim to edit files.

Here were the list of issues that I ran into and how I was able to address them :

SSH terminal window had a grayish color surrounding all text

To fix this I had to explicitly set the terminal type. I am not an expert on terminal types, and not really interested in becoming one, so all I can offer in this post is what worked for me, and that setting it to vt100.

If you are unclear on how to set the terminal type, it is an environment variable that be set in either your .profile or manually in the mac terminal by using the following command :


export TERM=vt100

Or open up the mac terminal preferences -> Settings -> Advanced -> under “Emulation” select vt100

Here is a decent article explaining terminal types

VIM issue with Delete not working outputting “^_”

What was happening here was that mac sends a different command for backspace than windows uses. This was took a few google searches but was able to track down the fixes for this issue.

1. Edit Terminal Preferences : Open up the mac terminal preferences -> Settings -> Advanced -> check “Delete sends Ctrl-H”

2. ssh onto the windows machine running cygwin and add the following to the .vimrc file in your home directory :


set backspace=indent,eol,start

These two things made vim work as expected while ssh’ing onto windows machine running cygwin.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s