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

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

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.

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

Strange enough, but it works for me. I created a ~/.vimrc file:
syntax on
set background=dark
The 2nd option disable the bug.

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)

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

make sure you dont set the visual bell in your .vimrc
set visualbell
in case you have it then just delete it :)

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.

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.

Related

Unknown function: htmlcomplete#DetectOmniFlavor

When I use vim to open one markdown file. i meet the following issue.
My Vim version is 7.4 and i use it on MacBook Pro with OS X Yosemite.
The following are the vim plugins i installed:
Anybody can help on this? many thanks:-)
Adding runtimepath
I got this error after I installed the Vim plugin YouCompleteMe. After I updated my html5.vim Vim plugin the issue disappeared for me.
You're missing the $VIMRUNTIME/autoload/htmlcomplete.vim script; in your case, it should be at /usr/local/Cellar/vim/7.4.488/share/vim/vim74/autoload/htmlcomplete.vim. If it really isn't there, try reinstalling Vim. Else, it might be a problem with your 'runtimepath'.
Edit: It is the latter; your 'runtimepath' has ~/.vim twice, at the beginning and end, no after directories, and not the .../share/vim/vim74 global one. Find our what messed up your 'runtimepath'.

Vim Syntax Highlighting does not work

I've installed a fresh Arch Linux system on my laptop and downloaded the vim package.
I haven't altered the .vimrc file, but the syntax highlighting doesn't seem to work with any of the languages I tried (Python, Ruby, CSharp, C...).
Auto formatting (gg, =, G) also fails.
Until now when playing with vim (because I can't really say I've extensively used it) in other OSs (Ubuntu, Fedora), the syntax highlighting came on automatically.
Is there something I am missing here?
You need to have following settings in .vimrc file as per arch linux documentation
filetype plugin on
syntax on
This is the absolute minimum you need to put in your ~/.vimrc if you intend to use vim as your primary editor:
" activates filetype detection
filetype plugin indent on
" activates syntax highlighting among other things
syntax on
" allows you to deal with multiple unsaved
" buffers simultaneously without resorting
" to misusing tabs
set hidden
" just hit backspace without this one and
" see for yourself
set backspace=indent,eol,start
Anything else depends on your taste, workflow and needs.
vi /etc/profile
alias vi=vim
maybe you use vi instead of vim
I had this problem in Opensuse Leap 42.2 cloud. And solved it by installing vim-data
sudo zypper install vim-data
or just re-installing vim will include vim-data automatically.
sudo zypper remove vim
sudo zypper install vim
Type
:syntax on
to get it to work. It is not a default option for vim. Probably in the other systems, it was set to on in the system default vimrc
Or put
syntax on
in ~/.vimrc
Another reason syntax highlighting won't work is you might have a theme/colorscheme set that VIM cannot find.
colorscheme darkblue
Either delete the line or comment it out:
"colorscheme darkblue
I had a similar problem. I could not have syntax highlighting on. I also found that gvim launched without pulldown menus or toolbar icons. It turned out I did not have the vim-runtime package properly installed. In my case I was on debian jessie with a large set of files missing under /usr/share/vim/vim74/ directory.
$ ls /usr/share/vim/vim74/
debian.vim doc/ rgb.txt
The solution was to run:
$ sudo aptitude reinstall vim-runtime
That fixed the problem for me, for syntax highlighting and for missing menus/icons in gvim. I'm not sure why my system was in this state, but the reinstall of the above package solved both issues.
in my case , I changed the term(terminal type) from vt100 to xterm. And it works.
To change the terminal type:
in bash:
export TERM=xterm
in bourne shell or ksh:
TERM=xterm
export TERM
in csh or tcsh:
setenv TERM xterm
On my Ubuntu 18.04 system i.e. c-highlighting works but Icinga2 config file highlighting being provided by the vim-icinga2 package does not. Quote from https://packages.debian.org/sid/vim-icinga2:
As per the Debian vim policy, installed addons are not activated automatically, but the "vim-addon-manager" tool can be used for this purpose.
Executing vim-addon-manager -w install icinga2 following a regular vim-icinga2 package installation solved the issue. The -w option forces a system wide rather than a just per current user activation. Notice that executing vim-addon-manager without arguments yields a list of 39 modes being disabled by default:
> vim-addon-manager
# Name User Status System Status
align removed removed
alternate removed removed
...
icinga2 removed installed # Due to above command
...
If you do miss highlighting chances are your mode is among this list.
NB: Ubuntu 18.04 seemingly inherits Debian's policy. None of the above answers solved my issue. No ~/.vimrc configuration or manual activation was being required after the above described activation.

Vim74: E149 Sorry no help for help.txt

I just downloaded and installed vim74 on to my linux box. I'm only installing locally, for the user. When I go into vim, and do :help, I get the error.
I tried adding:
let $VIM='home/myuser/vim74'
let $VIMRUNTIME='home/myuser/vim74/runtime'
to my .vimrc but it didn't help. How can I fix this?
When building vim yourself and installing locally it seems that you need to generate the helptags manually from within vim since the build process doesn't seem to do it. I ran into this very same issue when building the latest vim version 8.0.311. I followed the link in Ben Klein's comment above, but both my &helpfile and &runtimepath were correct, yet I still received the E149 error when doing :help which I assume is your situation as well postelrich.
I found the helptags solution here:
https://github.com/Homebrew/homebrew-core/issues/1087
Even though I was installing vim locally on a centos system and not a mac, the issue seems to be universal. I just replaced $VIMRUNTIME with the path to the local vim runtime installed from make install, which in your case may be something like /home/myuser/vim74/runtime
Specifically I ran this from within vim:
:helptags ~/share/vim/vim80/doc
In your case you will probably run something like:
:helptags ~/vim74/runtime/doc
Once done, :help should immediately start working again without having to restart vim.
You can get the same “E149 Sorry no help for help.txt” error if you have a long-running Vim session and the Vim program files were upgraded in the meantime.
This happened to me: I had started an editing session in a GNU screen window on my Debian testing system using Vim 8.1. Some time later, unattenttended-upgrades upgraded Vim 8.1 to 8.2 with the result that the run-time paths were now no longer valid. I could have saved the session and restarted Vim, but it was simpler/easier to run the following command (specific to 8.2):
:set helpfile=/usr/share/vim/vim82/doc/help.txt

fresh installation of gvim on ubuntu. where should I put my plugins?

I just installed gvim on fresh installation of ubuntu lucid. I've messed this up before that's why I want to start on the correct step here.
Where should I keep all my plugins and my .vimrc??
my current runtimepath on gvim is:
runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
one thing that i've never been able to get working on gvim is snipMate. Anyone has pointers on having that work with gvim?
I use pathogen with ~/.vimrc and plugins in ~/.vim/bundle, more details here. You can see an example here.
Plugin folder is always under ~home/.vim or ~home/vimfiles your vim configuration file or .vimrc always in your ~home/ as for example: ~home/.vimrc
Snipmate fully works for me under Ubuntu. unzip it correclty and it should work right. BTW a great great plugin.

Macvim and rails.vim on rails 3 rc - Uninitialized constant Bundler (NameError)

Configured vim and gvim on Windows, as well as vim and macvim on OSX. Intend to learn rails 3, so installed rails 3 rc on both OS'ses. So far, so good.
When using macvim, each and every script execution offered by rails.vim gives me errors "Uninitialized constant Bundler (NameError)". Tried :Rserver, :Rgenerate, .... However, staying on OSX, when firing up vim from a terminal window, rails.vim runs just fine, as well as execution of the rails script from the terminal directly.
So somewhere, somehow my macvim configuration seems to mess things up. However, unless I'm mistaken, it simply uses the settings from the .vimrc and .gvimrc files. Now, the .gvimrc is really minimalistic, so I might just as well add it here:
set guifont=Inconsolata:h17 " Font family and font size.
set antialias " MacVim: smooth fonts.
set encoding=utf-8 " Use UTF-8 everywhere.
set guioptions-=T " Hide toolbar.
" set background=light " Background.
set lines=40 columns=100 " Window dimensions.
set guioptions-=r " Don't show right scrollbar
Any suggestion on how to solve this would be appreciated.
Your $PATH may not be set correctly in MacVim, or perhaps something else is missing from your environment?
Try starting a shell from MacVim using :shell and run the ruby commands manually to see if you get the same error. You could also try comparing environment variables between MacVim and Terminal vim using :new | read !env in each.
Version 7.3 of Vim was released yesterday. Checked, and a new version of MacVim was already built, based on this latest Vim release. Downloaded and tested, and rails.vim scripts work the way they are supposed to now! So issue solved.

Resources