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?
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).