vim - _vimrc file on Windows 8 not working - vim

I found this question but it didn't help. The solution in this is what I tried but it didn't work.
I am trying to create an _vimrc file on my Windows 8 computer so that the syntax of my code in vim is 1) highlighted by default and 2) maintains indents.
I entered
echo %UserProfile%
into the command prompt and it gave me C:\Users\Username.
I used vim to create a _vimrc file in C:\Users\Username and added
set autoindent
syntax on
to it. However, these changes do not register in vim.
Most questions I could find online are for Unix where the home directory is ~. The questions that did apply to Windows said to create the file in the C:\Users\Username directory which is what I'm doing.
I tried closing and reopening my command prompt but it didn't help.
Sorry if this is a really simple question; I don't use user variables that often.

The presence of /usr/share/vim/vimrc in the output of :scriptnames indicates that you are using a version of Vim provided by some unix-like compatibility layer like cygwin instead of a regular Windows build.
From the user's perspective, the cygwin environment is completely segregated from the Windows environment and you are expected to use/customize it like you would on an actual unix-like system. Mixing Windows and "Linux" (huge quotes, here) concerns is not a very good idea in such a context.
In Vim, :echo $HOME should tell you what your $HOME is from Vim's POV.
If you are indeed using cygwin, cygwin's $HOME is usually located here from Windows' POV:
C\cygwin\home\username
while Windows' $HOME is usually located here from cygwin's POV:
/cygdrive/c/Users/username
In short…
if your Vim is a regular Windows program, the standard location for your config is:
C\Users\username\_vimrc
C\Users\username\vimfiles\
You can use both the console and the explorer to deal with those files and directories.
if your Vim is provided by cygwin, the standard location for your config is:
/home/username/.vimrc
/home/username/.vim/
You are pretty much forced to use the "Cygwin Terminal" to deal with those files and directories unless you get how those are mapped to Windows paths.
Avoid thinking in Windows terms.

I ran into a similar problem on Windows 7 and 10. VIM's installer created a default vimrc file in the installation directory (in my case c:\Program Files (x86)\Vim).
After deleting this file, VIM looks in my home directory.

Related

Specifying coqtop path for CoqIDE Vim plugin on Windows 8.1

I am trying to make the CoqIDE Vim plugin work on Windows 8.1. When I source the plugin from Vim, I get this error message:
coqtop.opt: command not found.
So I looked up the plugin documentation, and found the part that seems relevent:
"coqtop" should be accessible on PATH. If "coqtop" is not in your PATH, add 'let CoqIDE_coqtop = "/path/to/coqtop"' in your "~/.vimrc".
I'm not sure what this means, but I'm guessing that there is some file or directory named coqtop that must be made visible to vim. So I opened my Coq installation directory and searched for coqtop. The search hits are:
coqtop
coqtop.cmi
coqtop.1
coqtop.byte.1
coqtop.opt.1
The obvious first candidate here is coqtop. When I click it, it opens an interactive Coq console. But when I use the let CoqIDE_coqtop command to link this file to Vim and load the plugin again, I get:
C:Program Files (x86)Coq^Hincoqtop.exe: command not found.
Another thing that looks problematic is the file type. As you can see from the error message above, the coqtop file has an .exe extension, which is specific to MS-DOS and Windows. But I don't think the plugin was written to work with .exe files...
I also tried using all the other search hits as coqtop, to no avail.
Does this mean that the plugin is useless on Windows? If someone can confirm that I'll just give up and use other IDEs. But if possible I'd really, really like to keep using Vim.

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.)

Opening files from cygwin home in windows applications

I remember that when I first installed cygwin I could open files form my home directory using Windows applications. For example, I had Emacs installed in Windows and I could just do runemacs ~/some_file.txt. I had run out of space and had to move my cygwin installation to a different drive. Ever since then, I seem to have mucked up my installation and I can't use Windows applications like this anymore.
I have removed cygwin completely and re-installed it in C:\cygwin as before, but the problem remains.
I see that for some reason ~ gets expanded to C:\home\Tudor instead of C:\cygwin\home\Tudor.
Does anyone know how I could get this to work again?
Non-Cygwin Windows applications are not aware of your Cygwin root or home directory.
Emacs is a special case. It was originally developed on UNIX, and it uses UNIX-like syntax for some things.
According to your latest comment, Emacs expands ~ to C:\Users\Tudor. That's your Windows home directory, not your Cygwin home directory.
You can also install a Cygwin version of Emacs, which, like any Cygwin application, will expand ~ to your Cygwin home directory.
If you invoke a Windows application from a Cygwin shell, then the shell, not the Windows application, will expand ~ to your Cygwin home directory, expressed in Cgywin syntax. For example, assuming runemacs is a non-Cygwin application, if I run:
bash$ runemacs ~
then the shell expands the ~, so it's equivalent to (assuming my user name is Tudor):
bash$ runemacs /home/Tudor
runemacs will probably treat /home/Tudor as equivalent to \home\Tudor, which would be equivalent to C:\home\Tudor if the current drive is C:.
If you type Ctrl-X Ctrl-F from within Emacs to open a file, then Emacs will interpret ~ according to whatever rules it follows internally; those rules aren't likely to recognize Cygwin unless you're running a Cygwin version of Emacs or Emacs itself has some special-case code to handle Cygwin paths.

Vimball error, unrecognized character in path

I have a problem with installing SuperTab from vimball. I get an error:
E739: Cannot create directory: C:\Users\Pawe<b3>\vimfiles
I guess the problem is the directory name which is C:\Users\Paweł\vimfiles. Is there a way to solve it without changing directory name? Btw: I have set encoding=UTF-8 in my vimrc.
Edit:
The way I install it is so: download .vmb file, open it with vim (using context menu: 'edit with vim') and then I write :so %. And the error occurs.
Using :set verbose=20 I get http://pastebin.com/BLaeLzuU (those are things I found interesting).
And here's the wider story. I was trying to install plugins using vimballs, because I failed running plugins with pathogen (identical case as here: https://github.com/tpope/vim-pathogen/issues/110. In fact my output of :scritpnames is here: http://pastebin.com/YBTBvsvz). To tell you the truth I even tried to copy folder plugin form plugins git repo to my ~\vimfiles. With no success (they are not mentioned in scriptnames). And so I don't have any clue what is going on. Only that output from vimball tells me that it could be the path name. Other then that, I'm hopeless.
Btw: using Windows 8 if that's a deal breaker.
Eventually I have renamed the user name and user folder because the directory name was a problem for other aplications too. Here are the instructions: https://superuser.com/questions/495290/how-to-rename-user-folder-in-windows-8

How to customize which Windows $PATH environment variables are imported into Cygwin?

I would like to customize the $PATH variables included in the Cygwin environment, how can I do this? One solution I know of is to add the following line to the end of the Cygwin.bat file:
PATH="/usr/local/bin:/usr/bin:/bin"
By default the shortcut starts bin/mintty.exe, how can I change that default behavior?
All Windows environment variables are included in your Cygwin environment automatically on startup. If you'd like to customize what they are, you can overwrite the whole $PATH variable using a line similar to what you already mentioned in your Cygwin.bat file:
PATH="colon:separated:list:of:all:paths"
Also if you'd like to change which terminal is used by Cygwin, one alternative is rxvt.
Another popular solution seems to be using PuttyCyg to putty directly into your Cygwin installation to get the benefits of the Putty terminal. See the effective-cygwin
GitHub page for setup instructions and more.
See this stackoverflow post for a full list of suggested alternatives to the default Cygwin terminal.

Resources