Vim $VIMRC no longer being read; $HOME shows "%USERPROFILES%" - vim

In setting up my machine for an EdX class today, my VIM _vimrc is no longer being read.
The changes I made were to install Visual Studio Code and to run a pip command in the Anaconda prompt (pip install -q datascience okpy).
Now when I open a vim file, it loads a tiny window with text in 4 point Fixedsys font.
:echo $MYVIMRC shows:
C:\Program Files (x86)\Vim\_vimrc
:version shows:
system vimrc file: "$VIM\vimrc"
user vimrc file: "$HOME\_vimrc"
:echo $HOME gives:
%USERPROFILES%
The vimrc in my home directory (Users/myname/_vimrc) is not being seen.
I tried uninstalling and reinstalling vim, thinking that the Anaconda pip and VS Code installation might have knocked something awry, but that did not help.
How can I get my Vim functionality back?

I solved this by setting a Windows environmental variable of
Home = Users/myname
I still don't understand how this all happened to begin with, but now all is well.

Related

How to recover or reinstall .vim_runtime directory and contents

I downloaded this vim config but decided later I wanted to work using vanilla vim (because i'm still not used to it).
So I followed the instructions at the bottom of the README:
How to uninstall
Just do following:
Remove ~/.vim_runtime
Remove any lines that reference .vim_runtime in
your ~/.vimrc
I deleted the hidden vim_runtime directory located in :home/user/ on Ubuntu 16.04, using
rm -rf ~/.vim_runtime/
then realized this was a mistake. I now can't open vim without getting:
Error detected while processing /home/user/.vimrc:
line 3:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/basic.vim
line 4:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/filetypes.vim
line 5:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/plugins_config.vim
line 6:
E484: Cannot open file /home/user/.vim_runtime/vimrcs/extended.vim
Press ENTER or type command to continue
I don't know what to do from here, It would be great if I could just purge it all and have vim as it was when you first install the OS, I've tried:
sudo apt-get purge vim && sudo apt-get install vim
but still get the same error detection when opening vim after the command has completed.
If you had no personal configuration other than that Vim distribution, just rm /home/user/.vimrc and start anew. You can also remove /home/user/.vim/ if it exists. That gives you a clean slate. There's no need to reinstall Vim; that distribution presumably was just user configuration (i.e. you didn't need sudo to install it), whereas Vim is installed system-wide (via apt). If there's something inside .vimrc that you want to save (and you have no other editor installed), you can launch Vim with vim -N -u NONE.
soapbox
Vim "distributions" like spf-13 and Janus lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult). Vim is incredibly customizable, using someone else's customization makes no sense.
new config
I would base your personal configuration on the example that ships with Vim. You can install it like this:
$ vim
:edit $VIMRUNTIME/vimrc_example
:saveas $MYVIMRC
:quit
Also see :help defaults.vim.

MacVim unable to load settings from custom gvimrc or vimrc files

Ok so I'm setting up MacVim on my new macbook with Yosemite, using a homebrew installation.
To start off with I have no ~/.vimrc or ~/.gvimrc files setup at all.
Also I'm already familiar with links on stackoverflow which have explained that the .gvimrc file settings are usually applied after the .vimrc settings
When I execute the following command directly in MacVim my color scheme is applied fine
:colorscheme twilight
However, when I add the following line to a newly created ~/.gvimrc file the colour scheme does not load when I restart MacVim
colorscheme twilight
Keep in mind that I have nothing else apart from this line in my .gvimrc file and I have not setup a .vimrc file. If I execute the following command in MacVim
:scriptnames
I get the following output (not all lines included for clarity):
1: /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/vimrc
...
14: /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/gvimrc
...
20: ~/.gvimrc
You will noticed that MacVim thinks it has loaded the .gvimrc file. Anyone got any ideas why the color scheme won't load?
Ok so it looks like I've figured out what the problem is. The gvimrc and vimrc files were setup fine in the end, the problem is to do with what command you're supposed to execute to run MacVim
I came across the following link:
https://code.google.com/p/macvim/issues/detail?id=138
It was post #6 which made me realise that I was possibly running MacVim in the wrong way. I'm figuring that initially I probably mistakenly ran the MacVim binary directly which according to that post is the incorrect way to do it. Of course because I was running MacVim from spotlight it was repeatedly rerunning the incorrect command.
Anyway, I ran the command Vim -g from the command line instead and it worked fine.

Cannot load CoqIDE plugin for vim

I'm trying to use the CoqIDE for vim plugin I found on this page.
I put the coq_IDE.vim file in ~/.vim/ftplugin folder. My current .vimrc file is:
set showcmd
set number
imap hl <Esc>
filetype plugin on
But when I start vim CoqIDE doesn't load automatically (I see no change whatsoever compared to normal vim, so I don't think it did). And when I try to load it manually by the command :source coq_IDE.vim, I get the following error message:
E484: Can't open file coq_IDE.vim
What could be the source of this error?
Here are some additional information that might be relevant:
1) I am running Ubuntu 14.04.
2) I checked that :version in vim shows +perl.
2) I am running vim from terminal, not gvim.
3) I tried removing and reinstalling different versions of vim (vim, vim-gtk, vim-gnome)
4) The CoqIDE installation guide says that coqtop.opt should be accessible via the PATH variable. Since I'm not even sure what this means, this might be the problem here, but that seems unlikely. From what I understand vim is getting errors when trying to read coq_IDE.vim, so it's not even getting to the part where it's looking for coqtop.opt.
5) I have CoqIDE installed from Ubuntu Software Center.
6) With :echo &runtimepath I get: ~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
The instructions are bad.
Put the file in ~/.vim/plugin not ~/.vim/ftplugin
The file layout should look exactly like the file layout found in this mirror for the plugin. https://github.com/vim-scripts/CoqIDE. (Maybe take a look at pathogen or vundle,).
The reason the :source coq_IDE.vim fails is vim is looking for the file coq_IDE.vim in the current directory and it isn't there. Use the full path to file if you are going to source it manually. (You shouldn't need to though.)

Unable to use fugitive.vim on gVim on Windows 7

I am using gVim on Windows 7 and I have tried installing fugitive.vim as described here.
As per the link , I have extracted fugitive.vim to
vim73/plugin folder which is in the runtime path for my gVim. But when I restart the gVim, I get "Not an editor command" message when I type in :Gedit , or :Git and also :h fugitive isn't giving a help page.
Also, I tried using the recommended pathogen.vim method as described here. I extracted pathogen.vim into my vim73/autoload folder and then created a bundle folder in gVim home directory(c:\Program Files\Vim). I extracted fugitive.vim into the bundle folder.
Updated the _vimrc file with the execute pathogen#infect() command and restarted gVim, but no luck..
Please help me understand where I am going wrong.
I have found it difficult to get fugitive working on Windows.
I do have a few things for you to try, found using :h plugin.
:echo has("eval")
If this returns 0, your build of vim/gvim does not support plugins.
:echo g:loaded_fugitive
If this returns an error, vim did not spot your plugin during start, check :h plugin for correct directories to install to.
If this returns 1, as mine did and it still did not work, try adding set shellslash to your .vimrc file. This got mine working.

Problem installing MRU.vim

I downloaded the MRU.vim file and put it in my /.vim folder (along with my other working plugins).
When I try to use
:MRU
i get
"E492: Not an editor command: MRU"
I'm using VIM v7.0 on Mac OSX Snow.
Any thoughts?
update
I installed MacVim which has an option to "Choose a vim script to run". When i load MRU from there MRU starts working.
I've added mru.vim to the autoload folder yet still no joy.
Did you copy it to the .vim/plugin folder?
probably file is in dos format
you can see this by writing
:set ff?
if result is dos
than try using:
:set ff=unix

Resources