MacOS – Odd problems with vim over ssh to remote linux machine

macossshterminal

I'm having some strange issues working with vim editing files in an ssh session on a remote linux (Ubuntu 13.04 ) server. On the client side, I'm on a mac running OS 10.8.4 (late 2012 mac mini). I've googled around extensively on this and came up empty handed. I've used vim for years, and I've never seen problems like this before.

The issues all present themselves when I first load the file in vim. I've experienced the following issues:

  1. The top couple of lines are missing. Using arrow keys or the top of file shortcut, I can simply not get to these lines.

  2. Sometimes, when attempting to delete a character, an entire word or words will be deleted.

  3. The result of yank and put is inconsistent. Sometimes the line appears correctly, other times all I get is a jarbled mess.

Am I using the wrong version of vim remotely or some terminal problem specific to Mac OS?

Best Answer

I would recommend changing from x-term256color to xterm for your TERM variable as that seems to have resolved my similar issues.

The things I saw (in addition to the question's symptoms) are often to have line over-flow issues within the vi session. That is if I type beyond a certain number of columns then the rest of the text is put onto the next line (i.e. with a new line \n character in place). This overflowed text is not displayed in the current vi session but I will see it after reopening.

Another problem is occasionally the cursor is displayed on one line but I will start editing the next line down..... a real pain when you are writing code!