Vim Tips Wiki
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Vim Tips Wiki
1,649
pages
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
Editing
Use the same runtime files for native-Windows Vim and cygwin Vim
Back to page
Edit
Edit source
View history
Talk (0)
Edit Page
Use the same runtime files for native-Windows Vim and cygwin Vim
We recommend that you
log in
before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your
Watchlist
.
Creating an account
is quick and free.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
{{TipImported |id=973 |previous=972 |next=974 |created=August 15, 2005 |complexity=basic |author=[[User:Tonymec|Tony Mechelynck]] |version=5.7 |rating=13/6 |category1=Cygwin |category2= }} It is possible to keep native-Windows and Cygwin versions of Vim on a same machine with common runtime files (I have done it; but see [[Run native-Windows Vim from cygwin without a wrapper]] for an alternative solution). Here is what you need to do for that: '''1.''' Install the full Windows distribution in C:\Program Files\vim\vim## where ## is the version (e.g. 63 for Vim 6.3, or 70aa for Vim 7.00aa ALPHA). '''2.''' Install the cygwin executables (of the same version and sub-version; the patchlevel may be different), in /bin; don't install the "cygwin runtime files". Repeat either step 1 or step 2 at each upgrade. '''3.''' Set VIM (in the Windows environment) to C:\Program Files\vim and HOME to your home directory '''4.''' In the cygwin startup files (e.g. ~/.bash_profile) add the following lines: <pre> export VIM=`cygpath -u $VIM` export HOME=`cygpath -u $HOME` </pre> '''5.''' All runtime files must be in Unix format. If they aren't, do the following in vim (version 7 or later) for native-Windows (it takes some time but it's fairly automatic). (On version 6 it's possible but since ** wildcards are not recognised it is more work.) (See also [[Installing several releases in parallel, even with matchit]] about how to install several _different_ versions in parallel.) <pre> :set nomore :args $VIM/**/*.vim :argdo setl ff=unix :args $VIM/**/*.txt :argdo setl modifiable noro ff=unix :set more </pre> '''6.''' Directories $HOME/vimfiles and $HOME/.vim must be made identical. This can be done in Cygwin bash with the following command: <pre> cd ~ ln -s vimfiles .vim </pre> Steps 3 to 6 need be done only once, they remain valid even if you later install a different version. ==Comments== Note: Cygwin is a "Unix-like" OS, Windows is a "Dos-like" OS. With the above tip, you will use a common _vimrc (and common user plugins) for both. Any differences can be resolved by using <pre> if has("unix") " cygwin-specific code else " native-windows-specific code endif </pre> or even (e.g. if, in addition to this, you use dual-boot) <pre> if has("unix") " code common to Cygwin and Linux if has("win32unix") " code for Cygwin but not Linux else " code for Linux but not Cygwin endif elseif has("win32") " code for windows-native Vim else echoerr "Unknown OS" endif </pre> See {{help|has()}} and {{help|feature-list}} for more examples. ----
Summary:
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Help
(
view source
)
Template:Navigation
(
view source
)
Template:TipImported
(
view source
)
Follow on IG
TikTok
Join Fan Lab