Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bash

vim

cygwin

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
like image 332
arenaq Avatar asked Aug 03 '15 08:08

arenaq


People also ask

What does G mean in Vim?

In vim's normal mode, the g prefix is used for a number of commands. Some commands go somewhere in the document, but other commands deal with file encodings and swapping upper/lower case letters. ga - show character encoding.

How do I go to the beginning of a file in Vim?

Type "gg" in command mode. This brings the cursor to the first line.

How do I save a file in vim as a new name?

It's time to open up the command mode of Vim by pressing the “:” key. Now, press the “w” key from the keyword followed by the space key and the new name of a file. Tap “Enter” to execute this command on Vim. Now, the exact copy of the same file has been created in the home folder with a new filename.

What Vim command allows you to move to the first line in the current file?

Press ^ to move the cursor to the start of the current line. Press $ to move the cursor to the end of the current line.


3 Answers

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.

like image 54
MrEtArn Avatar answered Oct 21 '22 15:10

MrEtArn


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
like image 10
bearvarine Avatar answered Oct 21 '22 16:10

bearvarine


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

syntax on   
set background=dark

The 2nd option disable the bug.

like image 7
Zinyth Avatar answered Oct 21 '22 15:10

Zinyth