Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

having a .vimrc file in my home directory causes vim-go to not load #1509

Closed
jhford opened this issue Oct 12, 2017 · 5 comments

Comments

@jhford
Copy link

commented Oct 12, 2017

Behavior

I've been trying to get vim-go to work for a while. I could always get the :GoInstallBinaries, :GoPath and :GoUpdateBinaries commands to work, but all the other features weren't working.

I tried reducing the problem as much as I could, but it seems that merely having ~/.vimrc in my user profile is enough to break vim-go on my system. I removed literally everything else in my .vim directory, but having a .vimrc of 0 bytes is enough to break vim-go

Steps to reproduce:

Please create a reproducible case of your problem. If this step is
not provided, the issue will be closed

Re produce it with a minimal vimrc with all plugins disabled and
only vim-go enabled:

  1. rm -rf ~/.vimrc ~/.vim && git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
  2. Launch vim
  3. run :GoBuild -- notice it works
  4. touch ~/.vimrc
  5. launch vim
    22: run :GoBuild and see E492: Not an editor command: GoBuild

Configuration

Add here your current configuration and additional information that might be
useful, such as:

  • vimrc you used to reproduce -- the issue is that a .vimrc of 0 bytes triggers the issue. Existence of this file is enough
  • vim version:
macvim: stable 8.0-138 (bottled), HEAD
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct  5 2017 04:42:50)
MacOS X (unix) version
Included patches: 1-1175
Compiled by travis@Traviss-Mac-592.local
  • vim-go version: checked out master and v1.15
  • go version: go version go1.8.3 darwin/amd64
@arp242

This comment has been minimized.

Copy link
Contributor

commented Oct 12, 2017

When there is no vimrc, Vim will load $VIMRUNTIME/defaults.vim, which sets some more modern defaults. But when there's a vimrc present (empty or otherwise) it will use the old vi-compatible settings. Specifically, filetype detection won't be enabled. Adding filetype plugin indent on should fix that.

It's kinda confusing how this works :-/ See :help defaults.vim for more info.

@jhford

This comment has been minimized.

Copy link
Author

commented Oct 12, 2017

Yep, that fixes it. Maybe a line in the README.md saying "If you have a .vimrc file, ensure it has filetype plugin indent on".

@arp242

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2017

It's more of a general Vim caveat, lots of stuff will break if you add an empty ~/.vimrc file, not just vim-go. Frankly, this feature is not very well thought out IMHO, and it seems I'm not the only one who thinks so.

@arp242 arp242 closed this Oct 13, 2017

@jhford

This comment has been minimized.

Copy link
Author

commented Oct 13, 2017

Agreed that it's a general vim caveat, but that makes it even more useful to highlight the strange behaviour. It might be worth mentioning on the README.md a quick one line note.

@petemoore

This comment has been minimized.

Copy link

commented Oct 19, 2017

@Carpetsmoker I agree with @jhford, it is worth adding the one line - a lot of people are going to get bitten by this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.