arenaq
arenaq

Reputation: 2380

Why vim is changing first letter to g after opening a file

When I open a file, eg vim .bashrc, vim opens the file and change the first letter to g. What I see is the following:

g To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
...

I change g back to #, but after loading the file its again changed. Happens with multiple files.

Last things I have done was: installig gcc and make.

Why is this happening?

EDIT: My .vimrc file:

set nocompatible
set backspace=indent,eol,start
set number
set tabstop=4
syntax on

Upvotes: 28

Views: 11148

Answers (8)

bearvarine
bearvarine

Reputation: 671

I am using vim on Ubuntu Linux 16.04 via MobaXterm version 7.7. This is an older version of MobaXterm that supports command-line-settable terminal background colors.

The following change to my .bash_profile solved this problem for me:

# Fix for Vim 8.0 bug that stomps on line 1 char 1:
export TERM=linux

Upvotes: 12

sDoky
sDoky

Reputation: 368

I am on ArchLinux. vim 8.0.0987-1 always decreases a number upon opening a file (as if xtrl+x pressed). Downgrade to 8.0.0722-1 fixed the issue.

Upvotes: 0

Zinyth
Zinyth

Reputation: 89

Strange enough, but it works for me. I created a ~/.vimrc file:

syntax on   
set background=dark

The 2nd option disable the bug.

Upvotes: 8

NirIzr
NirIzr

Reputation: 3420

For me, I traced the issue down to the following line:

set nocompatible

It is found in /usr/share/vim/vim74/debian.vim, which is included from /etc/vim/vimrc with the line runtime! debian.vim

Upvotes: 5

MrEtArn
MrEtArn

Reputation: 325

I had the exact same problem

I found out it was a bug in my ssh client (mobaXterm).

Updating (to mobaXterm 'personal edition v9.1') resolved the issue.

Upvotes: 18

Mohammad Salem
Mohammad Salem

Reputation: 1143

make sure you dont set the visual bell in your .vimrc

set visualbell

in case you have it then just delete it :)

Upvotes: 1

kgeter
kgeter

Reputation: 111

The exact same thing was happening to me! It wasn't occurring in gvim, so I thought maybe something was going on in my .vimrc. I zeroed-out my .vimrc but it was still happening. Only when I completely deleted my .vimrc did this behavior stop. As suggested,I rolled back to an older version (7.3.1152-1) with cygwin setup and that fixed it. I did not have to change any terminal settings, however. It makes sense because I updated cygwin yesterday, when I started seeing the errant g's.

Upvotes: 0

arenaq
arenaq

Reputation: 2380

So it appers to be a vim issue. So far I gathered only two solutions:

  • Reinstall to older version of vim. i reinstalled to 7.4.752-1 and bug is gone.
  • Change cygwin terminal to anyone but "xterm*" (right-click on title bar -> Options... -> Terminal -> Type)

Upvotes: 6

Related Questions