Wikia

Vim Tips Wiki

Changes: Vim On Vista

Edit

Back to page

(Created page)
 
(Change <tt> to <code>, perhaps also minor tweak.)
 
(36 intermediate revisions by 12 users not shown)
Line 1: Line 1:
<!-- [[Category:Windows]] -->
+
{{TipNew
Ok, so I wasted a good part of thanksgiving day trying to get vim working again on Vista. I am not sure what happened, but it went nuts. It may have been the recent windows updates or the face that I installed .NET 3.5, but it was unusable. None of the plugins/syntax highlighting/menus that I have grown to love. I need vim with Ruby/Python/Ctags/and a ton-o-plugins. So here is what I did:
+
|id=1542
  +
|previous=1540
  +
|next=1543
  +
|created=2007
  +
|complexity=basic
  +
|author=Fuzzymonk
  +
|version=7.0
  +
|subpage=/200712
  +
|category1=Windows
  +
|category2=
  +
}}
  +
Running Vim on Vista is no problem if you install Vim 7.2 or later.
   
= Vim on Vista =
+
To get an "Edit with Vim" context menu for 32-bit Vista:
  +
*Download the latest version of [[Download|''Vim without Cream'']].
  +
*Run the installer and accept the license agreement.
  +
*On the Choose Components window, expand "Icons, menus and shortcuts".
  +
*Check the box for "Add Contextual Menu".
  +
*Finish the install.
   
== Download and Install ==
+
----
  +
Vista 64:
   
Download and Install gvim71-2.exe (I used the one from [http://hasno.info/2007/5/18/windows-vim-7-1-2 hasno.info])
+
Install gvim72.exe from [http://nkcorner.com/gvim72.exe]
  +
See building instructions at [http://ionipti.blogspot.com/2010/04/build-gvim-72-x64-and-create-installer.html]
  +
  +
This version is a 64-bit compiled version with patches up to 7.2.411. This version installs graphically, supports printing and the context menus, and is installed to "Program Files" as opposed to "Program Files (x86)".
  +
  +
Alternate 64-bit binaries can be found here: [http://code.google.com/p/vim-win3264/wiki/Win64Binaries].
  +
  +
To add edit menu for Vim manually, follow these directions:
  +
  +
After installing Vim 7.2 I found I still didn't have the "Edit with Vim" option on my contextual menu. After some rooting around online and in the registry here is what I used to resolve the issue manually. This will allow you to edit any file you right click on with Vim, which I find useful. <font color=red>If you are uncomfortable editing your registry, please do not try using this method!</font>
  +
  +
#Open regedit
  +
#Navigate to and expand: '''Computer\HKEY_CLASSES_ROOT\*\shell''' <font color=red>'''Note: Literally a * ; should be first in list'''</font>
  +
##Right click on '''shell'''
  +
###Select '''New''' -> '''Key'''
  +
##Right Click on the new key, and rename it to: '''Open with gVIm'''
  +
##Left click on '''Open with gVIm'''
  +
###In the right hand side, Right Click on '''(Default)''' and select '''Modify'''
  +
####In the '''Value Data''' field type: '''Edit with Vim'''
  +
##Right Click on '''Open with gVIm'''
  +
###Select '''New''' -> '''Key'''
  +
##Right Click on the new key, and rename it to '''Command'''
  +
##Left click on '''Command'''
  +
###In the right hand side, Right Click on '''(Default)''' and select '''Modify'''
  +
####In the '''Value Data''' field type: '''"C:\Program Files (x86)\Vim\vim72\gvim.exe" "%1"''' <font color=red>'''Note: quotes (") are important!'''</font>
  +
  +
Yes, this is for the 32-bit binaries on 64-bit vista. (it's what available from vim.org)
  +
[[User:Snigdinna|Snigdinna]] 19:26, 30 December 2008 (UTC)
  +
  +
It seems that at least with Win7, you need '''C:\Program Files (x86)\Vim\vim72\gvim.exe "%1"''' (different quoting). You can also import the following registry file:
  +
  +
<pre>
  +
Windows Registry Editor Version 5.00
  +
  +
[HKEY_CLASSES_ROOT\*\shell\Open with gvim]
  +
@="Edit with gVim"
  +
  +
[HKEY_CLASSES_ROOT\*\shell\Open with gvim\Command]
  +
@="C:\\Program Files (x86)\\Vim\\vim72\\gvim.exe \"%1\""
  +
</pre>
  +
  +
===Can't make Vim the Default Program for editing files?===
  +
If you have previously installed Vim to a different location then changed that location (e.g. upgraded) you won't be able to associate files with the new location. You will see this problem when you try right-clicking on a file, choosing Open With | Choose Default Program... and then select Vim as the application - it is not presented in the available list, and if you browse to it and press OK it doesn't work (nothing changes). To fix this edit the registry using regedit, go to:
  +
  +
<pre>
  +
HKEY_CLASSES_ROOT\Applications\gvim.exe
  +
</pre>
  +
  +
Make sure the edit\command and open\command Keys (they might not both exist) have the following default value:
  +
  +
<pre>
  +
C:\vim\vim72\gvim.exe "%1"
  +
(or where ever your executable actually resides)
  +
</pre>
  +
  +
----
  +
<big>'''AND IGNORE THE STUFF BELOW'''</big>
  +
----
  +
__NOTOC__
  +
  +
==Download and Install==
  +
Download and Install gVim 7.1(I used the one from [https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721])
 
* changed the install dir to C:\vim to get around some odd things with UAC.
 
* changed the install dir to C:\vim to get around some odd things with UAC.
 
* I prefer to have my vimfiles in my home directory, so I choose that option from the installer.
 
* I prefer to have my vimfiles in my home directory, so I choose that option from the installer.
Line 15: Line 15:
 
* iconv.dll (from [http://sourceforge.net/projects/gettext here] You can find the dll file in the bin directory of the "libiconv-win32" archive.)
 
* iconv.dll (from [http://sourceforge.net/projects/gettext here] You can find the dll file in the bin directory of the "libiconv-win32" archive.)
 
* libintl.dll (from [http://sourceforge.net/projects/gettext here] Get "intl.dll" from the bin directory in the gettext-win32 archive and store it as "libintl.dll" in the same directory as gvim.exe, overwriting the file that may already be there.)
 
* libintl.dll (from [http://sourceforge.net/projects/gettext here] Get "intl.dll" from the bin directory in the gettext-win32 archive and store it as "libintl.dll" in the same directory as gvim.exe, overwriting the file that may already be there.)
* gvimext.dll (from [http://www.vim.org/scripts/script.php?script_id=1720 here])
+
* gvimext.dll (from {{script|id=1720}})
   
== Configure around Vista ==
+
==Configure around Vista==
Here is the thing that stuck me for hours, if you had previously installed vim
+
If you want the "Edit with vim" Shell Extension in Windows Explorer:
to the recommended location of C:\Program Files you won't be able to associate
+
* Run C:\vim\vim71\install.exe
files with the new location until you edit the registry. Go to:
+
* Choose no when asked if you want to uninstall, then enter "d 14"
   
HKEY_CLASSES_ROOT\Applications\gvim.exe
+
==Troubleshooting==
  +
===Shell Extension===
  +
If you get a gvim not in your path error with the "Edit with vim" shell ext, make sure you '''do not''' have gvim.exe set to run as Administrator, as that will break it. To check this, right-click on gvim.exe, select 'Properties', then the 'Compatibility' tab. Make sure 'Run this program as administrator' is unchecked, then click on 'Show settings for all users' and again make sure 'Run this program as administrator' is unchecked.
   
Make sure the edit\command and open\command Keys have the following default value:
+
==VirtualStore==
C:\vim\vim71\gvim.exe "%1"
+
Windows Vista and newer creates a VirtualStore under %USERPROFILE% (often ~ in Vim) to support applications that attempt to open protected files for writing when the user doesn't have permissions. Under User Account Control (UAC), this even applies to administrators who are not running from an elevated shell.
   
If you want the "Edit with vim" Shell Extension in Windows Explorer:
+
This can lead to problems when you make any modifications under $VIM that might be installed to a protected location, such as %ProgramFiles% as it is by default. To make sure Vim doesn't keep using any files written to the VirtualStore after making modifications under $VIM, delete the VirtualStore for Vim by doing the following from a console shell.
   
* Run C:\vim\vim71\install.exe
+
<pre>
* Choose no when asked if you want to uninstall, then enter "d 14"
+
rmdir /q /s "%USERPROFILE%\AppData\Local\VirtualStore\Program Files\Vim"
  +
</pre>
  +
  +
Restart Vim.
  +
  +
'''Notes''' No explanation has been provided for why the above suggestion about deleting a directory tree would be desirable or safe. Also, no example of a problem that can occur is available. It would be useful to document how modifications under $VIM may occur, and the effect of deleting the VirtualStore files.
  +
  +
==Comments==
  +
{{Todo}}
  +
Several people have reported that they had no problem installing and using Vim on Vista. The users concerned did not perform any of the steps from this tip.
  +
  +
Consequently, it may be better to delete this tip unless some further explanations are available as to why the recommended procedures would be helpful.
  +
  +
There is '''no known reason''' to take the steps recommended in the "Download and Install" section of this tip. It is always dodgy to mix files from various sources, particularly if no reason for doing so is given.
  +
  +
In the [http://vim.wikia.com/index.php?title=Vim_On_Vista&oldid=13304 original tip], the author stated that the version of Vim was downloaded from [http://hasno.info/2007/5/18/windows-vim-7-1-2 hasno.info]. It is always possible that the particular build of Vim had a problem. In that case, the problems presented in this tip would not be applicable to other users, and in fact might be dangerous because some fairly radical manipulations are recommended.
  +
  +
Please add any comments below (after a line consisting of <code>----</code> to create a horizontal rule).
  +
  +
----
  +
''From the [[Vim_Tips_Wiki:New_tips/200712#Vim_On_Vista|new tips discussion]]:''
  +
  +
I didn't realize that everything was working that well on other machines. I do think there is value in keeping two of the sections:
  +
* The information on how to fix the shell extension if Vista thinks Vim needs to be run as administrator.
  +
* The file association fix.
  +
  +
Where would you recommend putting these? Or are they too edge case for the wiki?
  +
  +
--Fuzzymonk 16:27, 14 January 2008 (UTC)
  +
  +
:Sorry to have not responded sooner &ndash; there has been a lot going on. I decided to just put a "to do" comment where required in the new tips, and leave it for sorting out later. If you want to pursue your suggestion, please just edit the tip here. I think any information regarding Vim on Vista should be in this tip. I don't know what to keep (Vista is outside my experience). I'm hoping to attract comments from Vista users. --[[User:JohnBeckett|JohnBeckett]] 04:02, 19 February 2008 (UTC)
   
== Trouble Shooting ==
+
----
=== Shell Extension ===
+
The problem I was having was that it couldn't copy the .bat files to the Windows directory. Running install.exe as Administrator solved this problem.
If you get a gvim not in your path error with the "Edit with vim" shell ext, make sure you '''do not''' have gvim.exe set to run as Administrator, as that will break it.
 
   
  +
I tried a few methods on this page to no avail.
   
  +
----
  +
The context menu stuff is not working. Tried with gvim-7-2-68.exe under Vista Home Premium 64 as Administrator.
   
== Comments ==
+
----
<!-- comments on the content of the tip go here, comments on the article itself can go to the discussion page -->
+
{{Todo}}
<!-- sign your comments with ~~~~ and separate them with ---- -->
+
*We really need to delete the dodgy stuff from this page. Please add any comments below.
  +
*Is there any useful information below the "AND IGNORE THE STUFF BELOW" line?
  +
**The tip about fixing the ability to make vim the default application for file associations after upgrading was useful to me, and I think Snigdinna thought it useful as well, so I have expanded it a bit and moved it above the IGNORE line. It wasn't covered by what was already there. [[User:Lessthanideal|Lessthanideal]] 14:44, June 30, 2011 (UTC)
  +
*[http://vim.wikia.com/index.php?title=Vim_On_Vista&diff=21352&oldid=17966 Edit on 2008-11-24] added the "IGNORE" line, and the material at the top of the tip.
  +
*[http://vim.wikia.com/index.php?title=Vim_On_Vista&diff=21618&oldid=21546 Edit on 2008-12-30] added the "Vista 64" section, also above the "IGNORE" line.
  +
*See discussion on [[User_talk:Snigdinna|Snigdinna's talk page]].
  +
--[[User:JohnBeckett|JohnBeckett]] 01:38, 3 January 2009 (UTC)
  +
----

Latest revision as of 06:31, July 13, 2012

Tip 1542 Printable Monobook Previous Next

created 2007 · complexity basic · author Fuzzymonk · version 7.0


Running Vim on Vista is no problem if you install Vim 7.2 or later.

To get an "Edit with Vim" context menu for 32-bit Vista:

  • Download the latest version of Vim without Cream.
  • Run the installer and accept the license agreement.
  • On the Choose Components window, expand "Icons, menus and shortcuts".
  • Check the box for "Add Contextual Menu".
  • Finish the install.

Vista 64:

Install gvim72.exe from [1] See building instructions at [2]

This version is a 64-bit compiled version with patches up to 7.2.411. This version installs graphically, supports printing and the context menus, and is installed to "Program Files" as opposed to "Program Files (x86)".

Alternate 64-bit binaries can be found here: [3].

To add edit menu for Vim manually, follow these directions:

After installing Vim 7.2 I found I still didn't have the "Edit with Vim" option on my contextual menu. After some rooting around online and in the registry here is what I used to resolve the issue manually. This will allow you to edit any file you right click on with Vim, which I find useful. If you are uncomfortable editing your registry, please do not try using this method!

  1. Open regedit
  2. Navigate to and expand: Computer\HKEY_CLASSES_ROOT\*\shell Note: Literally a * ; should be first in list
    1. Right click on shell
      1. Select New -> Key
    2. Right Click on the new key, and rename it to: Open with gVIm
    3. Left click on Open with gVIm
      1. In the right hand side, Right Click on (Default) and select Modify
        1. In the Value Data field type: Edit with Vim
    4. Right Click on Open with gVIm
      1. Select New -> Key
    5. Right Click on the new key, and rename it to Command
    6. Left click on Command
      1. In the right hand side, Right Click on (Default) and select Modify
        1. In the Value Data field type: "C:\Program Files (x86)\Vim\vim72\gvim.exe" "%1" Note: quotes (") are important!

Yes, this is for the 32-bit binaries on 64-bit vista. (it's what available from vim.org) Snigdinna 19:26, 30 December 2008 (UTC)

It seems that at least with Win7, you need C:\Program Files (x86)\Vim\vim72\gvim.exe "%1" (different quoting). You can also import the following registry file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open with gvim]
@="Edit with gVim"

[HKEY_CLASSES_ROOT\*\shell\Open with gvim\Command]
@="C:\\Program Files (x86)\\Vim\\vim72\\gvim.exe \"%1\""

Can't make Vim the Default Program for editing files?Edit

If you have previously installed Vim to a different location then changed that location (e.g. upgraded) you won't be able to associate files with the new location. You will see this problem when you try right-clicking on a file, choosing Open With | Choose Default Program... and then select Vim as the application - it is not presented in the available list, and if you browse to it and press OK it doesn't work (nothing changes). To fix this edit the registry using regedit, go to:

HKEY_CLASSES_ROOT\Applications\gvim.exe

Make sure the edit\command and open\command Keys (they might not both exist) have the following default value:

C:\vim\vim72\gvim.exe "%1"
(or where ever your executable actually resides)

AND IGNORE THE STUFF BELOW



Download and InstallEdit

Download and Install gVim 7.1(I used the one from [4])

  • changed the install dir to C:\vim to get around some odd things with UAC.
  • I prefer to have my vimfiles in my home directory, so I choose that option from the installer.
    • I also recommend setting the hidden attribute on the vimfiles folder so it does not visually clutter up the my home directory (Right click -> properties -> General Tab -> Check Hidden).

Copy the following files into C:\vim\vim71\

  • iconv.dll (from here You can find the dll file in the bin directory of the "libiconv-win32" archive.)
  • libintl.dll (from here Get "intl.dll" from the bin directory in the gettext-win32 archive and store it as "libintl.dll" in the same directory as gvim.exe, overwriting the file that may already be there.)
  • gvimext.dll (from script#1720)

Configure around VistaEdit

If you want the "Edit with vim" Shell Extension in Windows Explorer:

  • Run C:\vim\vim71\install.exe
  • Choose no when asked if you want to uninstall, then enter "d 14"

TroubleshootingEdit

Shell ExtensionEdit

If you get a gvim not in your path error with the "Edit with vim" shell ext, make sure you do not have gvim.exe set to run as Administrator, as that will break it. To check this, right-click on gvim.exe, select 'Properties', then the 'Compatibility' tab. Make sure 'Run this program as administrator' is unchecked, then click on 'Show settings for all users' and again make sure 'Run this program as administrator' is unchecked.

VirtualStoreEdit

Windows Vista and newer creates a VirtualStore under %USERPROFILE% (often ~ in Vim) to support applications that attempt to open protected files for writing when the user doesn't have permissions. Under User Account Control (UAC), this even applies to administrators who are not running from an elevated shell.

This can lead to problems when you make any modifications under $VIM that might be installed to a protected location, such as %ProgramFiles% as it is by default. To make sure Vim doesn't keep using any files written to the VirtualStore after making modifications under $VIM, delete the VirtualStore for Vim by doing the following from a console shell.

rmdir /q /s "%USERPROFILE%\AppData\Local\VirtualStore\Program Files\Vim"

Restart Vim.

Notes No explanation has been provided for why the above suggestion about deleting a directory tree would be desirable or safe. Also, no example of a problem that can occur is available. It would be useful to document how modifications under $VIM may occur, and the effect of deleting the VirtualStore files.

CommentsEdit

 TO DO 
Several people have reported that they had no problem installing and using Vim on Vista. The users concerned did not perform any of the steps from this tip.

Consequently, it may be better to delete this tip unless some further explanations are available as to why the recommended procedures would be helpful.

There is no known reason to take the steps recommended in the "Download and Install" section of this tip. It is always dodgy to mix files from various sources, particularly if no reason for doing so is given.

In the original tip, the author stated that the version of Vim was downloaded from hasno.info. It is always possible that the particular build of Vim had a problem. In that case, the problems presented in this tip would not be applicable to other users, and in fact might be dangerous because some fairly radical manipulations are recommended.

Please add any comments below (after a line consisting of ---- to create a horizontal rule).


From the new tips discussion:

I didn't realize that everything was working that well on other machines. I do think there is value in keeping two of the sections:

  • The information on how to fix the shell extension if Vista thinks Vim needs to be run as administrator.
  • The file association fix.

Where would you recommend putting these? Or are they too edge case for the wiki?

--Fuzzymonk 16:27, 14 January 2008 (UTC)

Sorry to have not responded sooner – there has been a lot going on. I decided to just put a "to do" comment where required in the new tips, and leave it for sorting out later. If you want to pursue your suggestion, please just edit the tip here. I think any information regarding Vim on Vista should be in this tip. I don't know what to keep (Vista is outside my experience). I'm hoping to attract comments from Vista users. --JohnBeckett 04:02, 19 February 2008 (UTC)

The problem I was having was that it couldn't copy the .bat files to the Windows directory. Running install.exe as Administrator solved this problem.

I tried a few methods on this page to no avail.


The context menu stuff is not working. Tried with gvim-7-2-68.exe under Vista Home Premium 64 as Administrator.


 TO DO 

  • We really need to delete the dodgy stuff from this page. Please add any comments below.
  • Is there any useful information below the "AND IGNORE THE STUFF BELOW" line?
    • The tip about fixing the ability to make vim the default application for file associations after upgrading was useful to me, and I think Snigdinna thought it useful as well, so I have expanded it a bit and moved it above the IGNORE line. It wasn't covered by what was already there. Lessthanideal 14:44, June 30, 2011 (UTC)
  • Edit on 2008-11-24 added the "IGNORE" line, and the material at the top of the tip.
  • Edit on 2008-12-30 added the "Vista 64" section, also above the "IGNORE" line.
  • See discussion on Snigdinna's talk page.

--JohnBeckett 01:38, 3 January 2009 (UTC)


Around Wikia's network

Random Wiki