On Fri, Oct 14, 2011 at 2:50 PM, Alessandro Antonello
<[email protected]> wrote:
> > The problem with using .vim and .vimrc on Windows, is that the Windows
> > file explorer (as of Windows XP, I'm not sure about Vista or Windows
> > 7) will simply not allow you to create files or directories with names
> > which begin with a '.' character. Sure, you can create them from the
> > command-line, or from within Vim, but the average user doesn't want to
> > do that.
> >
> > The default Windows setting, to hide the extension for known file
> > types, will probably make matters worse. I expect, though I have not
> > confirmed, that if you were to have a file association for .vim files,
> > that a .vim folder may cause some strange behavior.
>
> Hi,
>
> I use VIM/GVIM in a common configuration between a Windows (XP) box,
> Cygwin (on that Windows) and a Mac. In my Mac I installed the MacVim
> version 7.3, in the Windows I have the GVim 7.0 and in the Cygwin
> (with GTK Vim to work with XWindow server) the 7.3 version. All these
> installations are using the same configuration files.
>
> The files are synchronized between Mac and Windows using Dropbox. So
> if I made some changes in one machine I will get the same changes in
> other. A tweak part was set the default font on startup. I love DejaVu
> so I installed it in all machines.
>
> Well, this is what I did:
>
> 1. In the Mac the configuration was strait forward. The files
> '.vimrc', '.gvimrc' and the directory '.vim' are in my home directory.
> All Vim scripts are in Unix format, that is important.
> 2. In the Windows box I set a '$HOME' environment variable to mimic
> the way Mac and Unix works. So I defined this variable to something
> like 'C:\users\Alessandro'.
> 3. In my new 'Windows user directory' I put the Vim files '.vimrc' and
> '.gvimrc' and the directory '.vim'. In '.vimrc' file I changed the
> 'runtimepath' so Vim can see the '.vim' directory. But only when it is
> loaded from Windows or a DOS box.
>
> When I start Vim/GVim from Cygwin or CygwinX all is perfectly normal.
> The '$HOME' environment variable is already there so 'Cygwin' will
> treat my directory as usual, also Vim.
>
> Why I did all that? Well, these days I work mostly in the Mac. But
> sometimes I need to do some work on Windows. But, I am so comfortable
> with the way *nix systems works that I can leave in a Windows system
> without cygwin. Well, there I did some apps for Windows Mobile using
> CeGCC.
>
> I almost forgot. I also have a MinGW installation, in my Windows, that
> has it's own version of Vim. It uses the same configuration files
> since the '$HOME' variable is also used by MSYS.
>
> What a mess!!

I share my Vim configuration and other dotfiles between Windows, Mac,
and Linux. It's stored in a private repository at GitHub. I create a
working copy at C:\gvr or ~/gvr. Inside there, I have several
directories, including dotfiles and vimfiles.

Here's a *partial* view from `tree`:

    /Users/georger/gvr/
    ├── _vimrc
    ├── dotfiles
    │   ├── bash_aliases
    │   ├── bash_logout
    │   ├── bashrc
    │   ├── emacs.d
    │   │   ├── init.el
    │   ├── gitconfig.mac
    │   ├── gitconfig.msys
    │   ├── makelinks
    │   ├── makelinks.cmd
    │   └── viper
    ├── vimfiles
    │   ├── after
    │   │   ├── ftplugin
    │   │   └── syntax
    │   ├── autoload
    │   ├── bundle
    │   │   ├── bufexplorer
    │   │   ├── dbext
    │   │   ├── fugitive
    │   ├── plugin

I use the makelinks scripts to symlink

Here's the Mac/Linux makelinks:

    #!/bin/bash
    ln -s -f ~/gvr/ctags.cnf ~/.ctags
    ln -s -f ~/gvr/_vimrc ~/.vimrc
    ln -s -f ~/gvr/vimfiles ~/.vim
    ln -s -f ~/gvr/dotfiles/gitconfig.mac ~/.gitconfig
    ln -s -f ~/gvr/dotfiles/emacs.d ~/.emacs.d
    for i in bashrc bash_aliases bash_profile bash_logout profile viper
    do
        ln -s -f ~/gvr/dotfiles/$i ~/.$i
    done

And the Windows one. Note %HOME% is set to C:\gvr:

    :: Vista or Win7 only. Must be run as Administrator from a cmd window
    pushd %~dp0
    for %%i in (bash* profile viper) do (mklink ..\.%%i dotfiles\%%i)
    mklink ..\.gitconfig dotfiles\gitconfig.msys
    mklink /d ..\.emacs.d dotfiles\emacs.d
    mklink /d ..\Dropbox "%USERPROFILE%\Dropbox"
    popd

This works fine with programs running in the regular Windows cmd window,
as well as the MsysGit Bash window.
--
/George V. Reilly  [email protected]  Twitter: @georgevreilly
http://www.georgevreilly.com/blog  http://blogs.cozi.com/tech

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to