c vim garbles 1st character of file when using via mobaxterm

1

this thing drives me crazy, and I am unable to find a solution...

I am logging in to a FreeBSD machine via ssh using MobaXterm. Every time I open a text file with vim, it replaces the first character of the file with 'g'. It is not just garbling the display, when I try to quit vim, it warns me that the file has been changed, and after writing the file the 'g' is in there of course.

The only thing I was able to figure out that this only happens when TERM is set to an xterm variant (xterm, xterm-color, etc.). It does not happen when using other editors (nano or vi).

Could anyone suggest a solution or point me to the right direction what should I check or reconfigure?

Update:

The output of :scriptnames

  1: /usr/local/etc/vim/vimrc
  2: /usr/local/share/vim/vim74/syntax/syntax.vim
  3: /usr/local/share/vim/vim74/syntax/synload.vim
  4: /usr/local/share/vim/vim74/syntax/syncolor.vim
  5: /usr/local/share/vim/vim74/filetype.vim
  6: /usr/local/share/vim/vim74/plugin/getscriptPlugin.vim
  7: /usr/local/share/vim/vim74/plugin/gzip.vim
  8: /usr/local/share/vim/vim74/plugin/logiPat.vim
  9: /usr/local/share/vim/vim74/plugin/matchparen.vim
 10: /usr/local/share/vim/vim74/plugin/netrwPlugin.vim
 11: /usr/local/share/vim/vim74/plugin/rrhelper.vim
 12: /usr/local/share/vim/vim74/plugin/spellfile.vim
 13: /usr/local/share/vim/vim74/plugin/tarPlugin.vim
 14: /usr/local/share/vim/vim74/plugin/tohtml.vim
 15: /usr/local/share/vim/vim74/plugin/vimballPlugin.vim
 16: /usr/local/share/vim/vim74/plugin/zipPlugin.vim

I don't have a .vimrc file in my home directory, the one in /usr/local/etc/vim is the unmodified default file that came with the vim package:

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
        set fileencodings=ucs-bom,utf-8,latin1
endif

let g:is_posix = 1
set nocompatible
set bs=indent,eol,start
set history=50
set ruler

if &t_Co > 2 || has("gui_running")
        syntax on
        set hlsearch
endif

if has("autocmd")
        augroup freebsd
        autocmd!
        if $PORTSDIR != ""
                autocmd BufNewFile $PORTSDIR/*/*/Makefile 0r $PORTSDIR/Templates/Makefile
        else
                autocmd BufNewFile /usr/ports/*/*/Makefile 0r /usr/ports/Templates/Makefile
        endif
endif

It happens when opening text or binary files. The issue seems to be related to MobaXterm however; it happens only when I connect with MobaXterm. Vim works normally when I use putty or the physical console ($TERM is xterm in both cases).

LittlePilgrim

Posted 2015-08-27T12:15:02.613

Reputation: 13

Does that happen with all file types you open with vim? Please post your vimrc and which plugins you load on start. – ap0 – 2015-08-27T12:19:18.190

Which version of Vim are you using? – Ƭᴇcʜιᴇ007 – 2015-08-27T18:49:48.753

Sorry for the missing version number, it was 7.4.752. Since then I have upgraded to 7.4.826, but it did not fix the issue. 826 is the latest FreeBSD port available, but I haven't seen any fixes related to this in the README between 826 and the current version (841). As this seems to be an issue with MobaXterm and not with vim, I think I'll stick with putty for the moment. Anyway, thanks for the respnonses! – LittlePilgrim – 2015-08-27T19:11:11.567

Answers

1

I believe this is a bug, that has recently been fixed. Please update your Vim.

Oh and in case of the mobaxterm, this also seems to be a bug of the mobaxterm

Christian Brabandt

Posted 2015-08-27T12:15:02.613

Reputation: 1 196

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Ƭᴇcʜιᴇ007 – 2015-08-27T18:34:31.300

As there were no specific version information, I couldn't be more precise. Also this is more suited for vim-dev ml rather then superuser. – Christian Brabandt – 2015-08-27T18:46:50.907

@ChristianBrabandt - You should seek the clarification from the author then before you submit an answer. You believe this to be a bug, prove it was a bug, and show when it was fixed. The current revision isn't all that helpful. – Ramhound – 2015-08-27T19:02:20.240

@Ramhound. Thanks. I provide enough patches that I know. Thanks for telling me – Christian Brabandt – 2015-08-27T19:09:47.413

See my comment under the question about version numbers. I could not figure out where the root cause of this could be: a vim issue, a bug in mobaxterm or a freebsd configuration problem. I'll test the issue on a linux box tomorrow. I'll send feedback to the vim-dev list if I find out something vim-related. Thanks for trying to help! – LittlePilgrim – 2015-08-27T19:19:34.563

see update. looks like a bug of mobaxterm. – Christian Brabandt – 2015-08-27T19:24:14.613

I can confirm, this is the same issue as mentioned in the link in your edit. Thanks a lot for your efforts!

Update: seems it has been fixed in mobaxterm 8.1. – LittlePilgrim – 2015-08-27T19:47:35.167

1

Add this to your ~/.vimrc file:

set background=dark

J Doe

Posted 2015-08-27T12:15:02.613

Reputation: 11

0

I meet the same problem. I don't have the solution to fix it. But I do have a workaround to avoid it.

You can install 'tmux' and use vim on tmux, the 'g' issue would be gone.

terry

Posted 2015-08-27T12:15:02.613

Reputation: 1