Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cygwin filepaths and git (windows build) on Cygwin Vim #896

Closed
3 of 11 tasks
evandrocoan opened this issue Oct 19, 2019 · 52 comments
Closed
3 of 11 tasks

Cygwin filepaths and git (windows build) on Cygwin Vim #896

evandrocoan opened this issue Oct 19, 2019 · 52 comments

Comments

@evandrocoan
Copy link

evandrocoan commented Oct 19, 2019

After searching I found #556 fatal: destination path '/home/...' already exists and is not an empty

Now I see the message destination path already exists and is not an empty directory is probably coming from git. The git version on my system path is git version 2.21.0.windows.1, and it is the one I want to use. I do not see why it should break a vim package manager.

Installed Cygwin and vim. Now when I run :PlugInstall for the second time (after installing everything successfully first) it says destination path already exists and is not an empty directory. But it should say something like All up to date because everything is already installed and up-to-date:

  1 Updated. Elapsed time: 0.218449 sec.
  2 [xxx]
  3
  4 - Finishing ... Done!
  5 x vim-hug-neovim-rpc:
  6     fatal: destination path '/home/Professional/.vim/plugged/vim-hug-neovim-rpc' already exists and is not an empty directory.
  7 x deoplete.nvim:
  8     fatal: destination path '/home/Professional/.vim/plugged/deoplete.nvim' already exists and is not an empty directory.
  9 x nvim-yarp:
 10     fatal: destination path '/home/Professional/.vim/plugged/nvim-yarp' already exists and is not an empty directory.

image


.vimrc

" https://github.com/junegunn/vim-plug/wiki/tips
" https://github.com/junegunn/vim-plug/issues/894
if v:version >= 740

  if empty(glob('~/.vim/autoload/plug.vim'))
    let s:downloadurl = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
    let s:destinedirectory = $HOME . "/.vim/autoload/"
    let s:destinefile = s:destinedirectory . "plug.vim"

    if !isdirectory(s:destinedirectory)
      call mkdir(s:destinedirectory, "p")
    endif

    if executable("curl")
      silent execute '!curl --output ' . s:destinefile .
          \ ' --create-dirs --location --fail --silent ' . s:downloadurl

    else
      silent execute '!wget --output-document ' . s:destinefile .
          \ ' --no-host-directories --force-directories --quiet ' . s:downloadurl
    endif

    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  endif

  " https://github.com/junegunn/vim-plug
  "
  " Specify a directory for plugins
  " - For Neovim: stdpath('data') . '/plugged'
  " - Avoid using standard Vim directory names like 'plugin'
  call plug#begin('~/.vim/plugged')

  if v:version >= 800

    if has('nvim')
      Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    else
      Plug 'Shougo/deoplete.nvim'
      Plug 'roxma/nvim-yarp'
      Plug 'roxma/vim-hug-neovim-rpc'
    endif
    let g:deoplete#enable_at_startup = 1

  endif

  " Initialize plugin system
  call plug#end()

endif
  • Type:
    • Bug
    • Enhancement
    • Feature Request
    • Question
  • OS:
    • All/Other
    • Linux
    • OS X
    • Windows
  • Vim:
    • Terminal Vim
    • GVim
    • Neovim
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar  4 2018 23:29:48)
Included patches: 1-1567
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl/dyn          +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           +python/dyn        +vreplace
+conceal           +linebreak         +python3/dyn       +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       +lua/dyn           +ruby/dyn          -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/etc"
 f-b for $VIMRUNTIME: "/usr/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -ggdb -O2 -pipe -Wall -Werror=format-security -fstack-protector-strong --param=ssp-buffer-size=4 -fdebug-prefix-map=/usr/src/ports/vim/vim-8.0.1567-1.x86_64/build=/usr/src/debug/vim-8.0.1567-1 -fdebug-prefix-map=/usr/src/ports/vim/vim-8.0.1567-1.x86_64/src/vim-8.0.1567=/usr/src/debug/vim-8.0.1567-1 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -fstack-protector  -L/usr/local/lib -Wl,--as-needed -o vim.exe        -lm -lelf -lnsl    -lncursesw -liconv -lacl -lattr -lintl   -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector-strong  -L/usr/lib/perl5/5.26/x86_64-cygwin-threads/CORE -lperl -lpthread -ldl -lcrypt
@yugr
Copy link

yugr commented Oct 20, 2019

This is likely due to Windows git failing to understand Cygwin's path conventions (~/.vim, etc.). At least in Vundle this can be workarounded by converting path to mixed style:

  let vimdir = '~/.vim/plugged'
  if has('win32unix')
    " Use mixed path on Cygwin so that Windows git works
    let vimdir = substitute(system('cygpath -m ' . vimdir), '\n\+$', '', '')
  endif
  call vundle#begin(vimdir)

but same trick does not work for me in plug#begin.

@janlazo janlazo added the cygwin label Oct 20, 2019
@janlazo
Copy link
Contributor

janlazo commented Oct 20, 2019

Is your vimrc is in ~/.vim/vimrc where ~ is equal to $HOME in Vim or %USERPROFILE% in cmd.exe?

" in vimrc
let s:base_dir = expand('<sfile>:p:h')
call plug#begin(s:base_dir . '/plugged')

Does this help?

@yugr
Copy link

yugr commented Oct 20, 2019

Is your vimrc is in ~/.vim/vimrc

Actually it's ~/.vimrc.

call plug#begin(s:base_dir . '/plugged')

I assume you meant '/.vim/plugged'?

Does this help?

Nope, s:base_dir is just /home/iuriig which is unsuitable for Windows git. But even converting it to $(cygpath -m /home/iuriig) (i.e. C:/cygwin64/home/iuriig) as in the code I posted above does not solve the issue.

@evandrocoan
Copy link
Author

I managed to make vim-plug to clone the repositories by changing this line:
https://github.com/junegunn/vim-plug/blob/master/plug.vim#L128

To:

  let g:plug_home = 'F:\\Cygwin\\home\\Professional\\.vim\\plugged'

Then, after successfull cloning the repositories on .vim\\plugged, it throw this error:

[Plugins]                                                                       [No Name]
Error detected while processing function <SNR>8_install[1]..<SNR>8_update_impl[110]..<SNR>8_job_cb[4]..<SNR>8_job_exit_cb[4]..<SNR>8_tick[6]..<SNR>8_update_fi
nish[56]..<SNR>8_finish[9]..plug#end[89]..<SNR>8_reload_plugins[2]..<SNR>8_load_plugin[1]..<SNR>8_source:
line    4:
E484: Can't open file F:CygwinhomeProfessional.vimplugged/deoplete.nvim/plugin/deoplete.vim

@janlazo janlazo added the bug label Oct 20, 2019
@janlazo
Copy link
Contributor

janlazo commented Oct 20, 2019

Is your request for vim-plug to support both windows and cygwin builds of git?

s:source should use expand (or use fnamemodify) on the filepath before sourcing the file.

@yugr
Copy link

yugr commented Oct 20, 2019

@evandrocoan Can you try with 'F:/Cygwin/home/Professional/.vim/plugged'?

@yugr
Copy link

yugr commented Oct 20, 2019

@janlazo Basically yes, the request is to support using Windows git with Cygwin vim. For this vim-plug can either convert paths internally (from Cygwin's Unix-style format like /home/user/.vim/plugged to c:/cygwin64/home/user/.vim/plugged, this is achieved by cygpath program) or be careful to preserve path given to plug#begin (i.e. not let it be converted to Unix-style along the way). I can try to come up with a patch if this feature is considered useful for the project.

@evandrocoan
Copy link
Author

evandrocoan commented Oct 20, 2019

@yugr, yes. It worked 100% and now I got no errors anymore from vim-plug.

@janlazo, yes. As @yugr just showed:

  1. The path should be in the form C:/Users/home/.vim/plugged for git for Windows.
  2. The path should be in the form /home/.vim/plugged for git for Cygwin.

@evandrocoan
Copy link
Author

@janlazo, by running this:

fixedpath="$(cygpath --mixed --absolute "$HOME/.vim/plugged")"

You would get F:/Cygwin/home/Professional/.vim/plugged in the variable fixedpath

@yugr
Copy link

yugr commented Oct 20, 2019

@evandrocoan Great.

So basically all that's needed is for vim-plug to preserve path given to plug#begin (as C:/Users/home/user/.vim/plugged) without converting it to Unix style (/home/user/.vim/plugged). Currently this conversion happens in fnamemodify at start of plug#begin:

function! plug#begin(...)
  if a:0 > 0
    let s:plug_home_org = a:1
    let home = s:path(fnamemodify(expand(a:1), ':p'))

I think one way to fix this would be to call cygpath after computation of home in plug#begin:

function! plug#begin(...)
  if a:0 > 0
    let s:plug_home_org = a:1
    let home = s:path(fnamemodify(expand(a:1), ':p'))
  ...
  if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp
    return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
  endif
  if has('win32unix')
    " Use mixed path on Cygwin so that Windows git works
    let home = substitute(system('cygpath -m ' . home), '\n\+$', '', '')
  endif

@evandrocoan
Copy link
Author

evandrocoan commented Oct 20, 2019

o basically all that's needed is for vim-plug to preserve path given to plug#begin (as C:/Users/home/user/.vim/plugged) without converting it to Unix style (/home/user/.vim/plugged). Currently this conversion happens in fnamemodify at start of plug#begin:

@yugr, now I see why I got a lot of trouble while trying to make it work. I was setting the path, but it was being converted back.

Also, do not forget, that this patch should only be used if the the program cygpath available. For example:

if executable("cygpath")
  if has('win32unix')
    " Use mixed path on Cygwin so that Windows git works
    let home = substitute(system('cygpath -m ' . home), '\n\+$', '', '')
  endif
endif

@yugr
Copy link

yugr commented Oct 20, 2019

"Also, do not forget, that this patch should only be used if the the program cygpath available" - true but win32unix guarantees that we are in Cygwin and cygpath is always available there (it comes with base installation).

@evandrocoan
Copy link
Author

evandrocoan commented Oct 20, 2019

Thanks. I did not known that.

Just another thing then. I also just tested, and git for Cygwin does not accept absolute paths as F:/Cygwin/home/Professional/.vim/plugged. Then, the if checking should cover this:

if has('win32unix')
  if "is git for Windows?"
    " Use mixed path on Cygwin so that Windows git works
    let home = substitute(system('cygpath -m ' . home), '\n\+$', '', '')
  endif
endif

@yugr
Copy link

yugr commented Oct 20, 2019

"I also just tested, and git for Cygwin does not accept absolute paths" - can you check if your Cygwin git is recent enough? I think I had issues with older version but current 2.21.0 accepts mixed paths (I believe this was fixed in upstream git ~ 1 year ago).

@evandrocoan
Copy link
Author

My Cygwin git version is git version 2.17.0

@yugr
Copy link

yugr commented Oct 20, 2019

Yes, that one is not latest and thus probly lacks support for mixed paths. So we can either ask users to use the latest version or indeed add a check like you suggested above (I'm not sure how to discern Windows vs Cygwin git though, just checking absolute path is not reliable).

@evandrocoan
Copy link
Author

  1. We could create a setting like let g:git_executable = '/usr/bin/git2.exe' pointing the path to the git. On this case, I could point to my git for Cygwin, which I renamed to git2.exe.
  2. Or we could create a setting called let g:git_for_windows = true and run the path conversion you suggested.

I think the option 2 would be better because it would not require a git for Cygwin to be installed.

@yugr
Copy link

yugr commented Oct 20, 2019

2 sounds reasonable to me. Let's wait for comments from maintainers then.

evandrocoan added a commit to evandrocoan/dotfiles that referenced this issue Oct 20, 2019
Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030

destination path already exists and is not an empty directory
junegunn/vim-plug#896
@janlazo
Copy link
Contributor

janlazo commented Oct 21, 2019

git --version includes windows if it's the windows build. Did that change in recent cygwin/windows builds?

@evandrocoan
Copy link
Author

I also noticed that on my computer. I got installed 3 versions of git for Windows, and I ran git --version in each one of them:

git version 2.21.0.windows.1
git version 2.19.0.rc0.windows.1
git version 2.16.2.windows.1

They all seem to have windows on the version name.

@yugr
Copy link

yugr commented Oct 21, 2019

Ah, nice.

@yugr
Copy link

yugr commented Oct 22, 2019

Unfortunately Mingw gits do not include the ".windows." suffix.

@evandrocoan
Copy link
Author

Then, we go with the setting. But you could go with both. The Mingw users would have to set the setting while the git for Windows users would not.

@yugr
Copy link

yugr commented Oct 22, 2019

Proposed patch:

diff --git a/README.md b/README.md
index bad081d..fcd6096 100644
--- a/README.md
+++ b/README.md
@@ -169,15 +169,16 @@ Reload .vimrc and `:PlugInstall` to install plugins.
 
 ### Global options
 
-| Flag                | Default                           | Description                                            |
-| ------------------- | --------------------------------- | ------------------------------------------------------ |
-| `g:plug_threads`    | 16                                | Default number of threads to use                       |
-| `g:plug_timeout`    | 60                                | Time limit of each task in seconds (*Ruby & Python*)   |
-| `g:plug_retries`    | 2                                 | Number of retries in case of timeout (*Ruby & Python*) |
-| `g:plug_shallow`    | 1                                 | Use shallow clone                                      |
-| `g:plug_window`     | `vertical topleft new`            | Command to open plug window                            |
-| `g:plug_pwindow`    | `above 12new`                     | Command to open preview window in `PlugDiff`           |
-| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
+| Flag                 | Default                           | Description                                            |
+| -------------------- | --------------------------------- | ------------------------------------------------------ |
+| `g:plug_threads`     | 16                                | Default number of threads to use                       |
+| `g:plug_timeout`     | 60                                | Time limit of each task in seconds (*Ruby & Python*)   |
+| `g:plug_retries`     | 2                                 | Number of retries in case of timeout (*Ruby & Python*) |
+| `g:plug_shallow`     | 1                                 | Use shallow clone                                      |
+| `g:plug_window`      | `vertical topleft new`            | Command to open plug window                            |
+| `g:plug_windows_git` | 0                                 | Use Windows-style paths when calling git on Cygwin     |
+| `g:plug_pwindow`     | `above 12new`                     | Command to open preview window in `PlugDiff`           |
+| `g:plug_url_format`  | `https://git::@github.com/%s.git` | `printf` format to build repo URL (Only applies to the subsequent `Plug` commands) |
 
 
 ### Keybindings
diff --git a/doc/plug.txt b/doc/plug.txt
index 3740e03..e292b94 100644
--- a/doc/plug.txt
+++ b/doc/plug.txt
@@ -223,7 +223,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
                                                            *plug-global-options*
 
      *g:plug_threads* *g:plug_timeout* *g:plug_retries* *g:plug_shallow* *g:plug_window*
-                                              *g:plug_pwindow* *g:plug_url_format*
+                            g:plug_windows_git*g:plug_pwindow* *g:plug_url_format*
 
  --------------------+-----------------------------------+-----------------------------------------------------------------------------------
  Flag                | Default                           | Description                                                                       ~
@@ -233,6 +233,7 @@ Reload .vimrc and `:PlugInstall` to install plugins.
   `g:plug_retries`     | 2                                 | Number of retries in case of timeout (Ruby & Python)
   `g:plug_shallow`     | 1                                 | Use shallow clone
   `g:plug_window`      |  `verticalΓÇçtopleftΓÇçnew`             | Command to open plug window
+  `g:plug_windows_git` |  0                                | Use Windows-style paths when calling git on Cygwin
   `g:plug_pwindow`     |  `aboveΓÇç12new`                      | Command to open preview window in  `PlugDiff`
   `g:plug_url_format`  |  `https://git::@github.com/%s.git`  |  `printf`  format to build repo URL (Only applies to the subsequent  `Plug`  commands)
  --------------------+-----------------------------------+-----------------------------------------------------------------------------------
diff --git a/plug.vim b/plug.vim
index ab0e082..3483cf9 100644
--- a/plug.vim
+++ b/plug.vim
@@ -124,6 +124,10 @@ function! plug#begin(...)
   if fnamemodify(home, ':t') ==# 'plugin' && fnamemodify(home, ':h') ==# s:first_rtp
     return s:err('Invalid plug home. '.home.' is a standard Vim runtime path and is not allowed.')
   endif
+  if has('win32unix') && exists('g:plug_windows_git') && g:plug_windows_git
+    " Use mixed path fot Windows gits on Cygwin
+    let home = substitute(system('cygpath -m ' . home), '\n\+$', '', '')
+  endif
 
   let g:plug_home = home
   let g:plugs = {}

@evandrocoan
Copy link
Author

@yugr, you can write like this to get syntax highlighting:

```patch
diff --git a/README.md b/README.md
index bad081d..fcd6096 100644
--- a/README.md
+++ b/README.md
@@ -169,15 +169,16 @@ Reload .vimrc and `:PlugInstall` to install plugins.
...
```

Example:

diff --git a/README.md b/README.md
index bad081d..fcd6096 100644
--- a/README.md
+++ b/README.md
@@ -169,15 +169,16 @@ Reload .vimrc and `:PlugInstall` to install plugins.
...

But may be a pull request would be easier?

@junegunn
Copy link
Owner

Adding an option is usually the last thing I'd choose to do :)

fnamemodify is not called if g:plug_home is already defined, so does this approach help?

let g:plug_home = '... YOUR_PATH ...'
call plug#begin()

I know this is not ideal, but I'm just trying to see if there's a way to work around the issue without adding an extra option that few users would need.

@janlazo janlazo added enhancement and removed bug labels Oct 24, 2019
@janlazo janlazo changed the title destination path already exists and is not an empty directory Cygwin filepaths and git (windows build) on Cygwin Vim Oct 24, 2019
@yugr
Copy link

yugr commented Oct 24, 2019

@evandrocoan

I think the MinGW version of git should accept paths on the form /home/user/.

Even if it does accept them, MinGW's /home would be different from Cygwin's /home. And in any case it won't accept less trivial Cygwin's paths like /cygdrive/c/my-non-standard-vim-dir.

@evandrocoan
Copy link
Author

Even if it does accept them, MinGW's /home would be different from Cygwin's /home.

I did not understood this. If I ask to MinGW to open the /home, it will open /home, even if it is on C:\Users\. While Cygwin has its own /home directory which is under its installation root. I think MinGw could do the same.

in any case it won't accept less trivial Cygwin's paths like /cygdrive/c/my-non-standard-vim-dir.

Indeed, MinGw will not accept Cygwin paths like /cygdrive/c/home. But paths like ~/.vim should be acceptable. We just need to know how a vim built for MinGw will expand the path ~/.vim. If it is a vim built for MinGw, then, it should correctly expand it to /c/mingw/home/.vim. If it is not, than, we are all doomed.

@yugr
Copy link

yugr commented Oct 24, 2019

If I ask to MinGW to open the /home, it will open /home

MinGW's ~/.vim is C:/msys64/home/User/.vim, Cygwin's is C:\cygwin64\home\User\.vim. When we reference ~/.vim in Cygwin vim, we mean the latter but MinGW git will (incorrectly) treat it as the former.

We just need to know how a vim built for MinGw will expand the path ~/.vim

I guess I disagree here, in my opinion code should work for any proper location of .vim (i.e. not just ~/.vim).

@yugr
Copy link

yugr commented Oct 26, 2019

@janlazo What's your opinion on this? We have a workaround now but I'm not sure how to integrate it into vim-plug without a flag (i.e. how to reliably determine if particualr git version needs converted paths).

@janlazo
Copy link
Contributor

janlazo commented Oct 26, 2019

@yugr It looks like a lot of work to cover all the edge cases that using a flag here is a misleading. I suggest adding the workaround and a link to this issue in the wiki and suggest the user to use the full path for all filepaths passed to vim-plug, preferably with cygpath, before running :PlugInstall. The path would be of the form, /c/Users/foo/.vim, instead of the emulated path, /home/foo/.vim. This is easier to debug and to convert to the Windows path without cygpath in $PATH.

I don't use cygwin/mingw/msys2 nowadays (aside from installing/debugging windows git itself) because I use scoop for package management and use ConEmu + powershell for my terminal needs. It's a low priority for me to work on this so this issue will remain open.

@yugr
Copy link

yugr commented Oct 26, 2019

The path would be of the form, /c/Users/foo/.vim

You mean c:/Users/foo/.vim ?

I agree to the rest except that I don't see why keep it open at all (rather than closing as low-prio).

@janlazo
Copy link
Contributor

janlazo commented Nov 13, 2019

I use +win32unix vim sometimes, mostly when debugging tickets or helping other devs. Open a PR and I'll review and merge if it handles all the edge cases.

You mean c:/Users/foo/.vim ?

No. I meant /c/Users/foo/.vim because the user should avoid windows paths within mingw/cygwin vim. This should be an internal implementation detail.

@yugr
Copy link

yugr commented Nov 18, 2019

No. I meant /c/Users/foo/.vim because the user should avoid windows paths within mingw/cygwin vim

But /c/Users/foo/.vim is not a valid Cygwin path (it's MinGW-only syntax, whereas c:/Users/foo/.vim is supported by all Cygwin/MinGW tools and Windows git), let alone that it points to a non-Cygwin plugins directory (Cygwin's one would be /cygdrive/c/cygwin64/home/foo/.vim).

@janlazo
Copy link
Contributor

janlazo commented Nov 24, 2019

I reposted #896 (comment) at https://github.com/junegunn/vim-plug/wiki/faq#filepath-issues-with-cygwinmingw-vim-and-windows-git. Can anyone test if the workaround is enough when a plugin has a custom dir or rtp?

" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }

Use cygpath with dir if needed and I'll update the wiki entry.`

@evandrocoan
Copy link
Author

When I ran the command, the gocode plugin was installed successfully. But the .fzf did not.

Updated. Elapsed time: 17.072030 sec.
[====x]

- Finishing ... Done!
x fzf:
    sh: line 0: cd: /home/Professional/.fzf/: No such file or directory
- deoplete.nvim: Already installed
- gocode: Resolving deltas: 100% (2052/2052), done.
- vim-hug-neovim-rpc: Already installed
- nvim-yarp: Already installed

evandrocoan added a commit to evandrocoan/dotfiles that referenced this issue Dec 24, 2019
Cygwin filepaths and git (windows build) on Cygwin Vim
junegunn/vim-plug#896

E370: Could not load library python36.dll
vim/vim-win32-installer#48

Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030
@janlazo
Copy link
Contributor

janlazo commented Jan 15, 2020

https://github.com/junegunn/vim-plug/wiki/faq#filepath-issues-with-cygwinmingw-vim-and-windows-git
Updated to mention 'dir' key for plugins that need a custom directory. Requires cygpath as well based on #896

@janlazo janlazo closed this as completed Jan 15, 2020
evandrocoan added a commit to evandrocoan/dotfiles that referenced this issue Jun 28, 2021
Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030

destination path already exists and is not an empty directory
junegunn/vim-plug#896
evandrocoan added a commit to evandrocoan/dotfiles that referenced this issue Jun 28, 2021
Cygwin filepaths and git (windows build) on Cygwin Vim
junegunn/vim-plug#896

E370: Could not load library python36.dll
vim/vim-win32-installer#48

Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030
@DZITZGH
Copy link

DZITZGH commented Feb 14, 2022

After I try the solution,the cgywin64 show the wrong:

E115: Missing quote:  '/.vim/plugged'
E116: Invalid arguments for function s:fix_plug_path($HOME . '/.vim/plugged)

I don't know what happened.
cywin64
wrong

@evandrocoan
Copy link
Author

It is missing a quote here (and on the official example)
image

@DZITZGH
Copy link

DZITZGH commented Feb 15, 2022

Thanks for your answer.
It's OK now.

@RivenSkaye
Copy link

I can't find many mentions of specifically MSYS2 envs, except when mentioned in conjunction with cygwin.
I'm only running an MSYS2 environment on my system, for which /home is a shared folder for all envs. It's also my main CLI env on Windows and I've not had any issues with paths except for a few edge cases. A workaround is needed for VSCode & forks to play nice with unix-style paths on Windows, some applications written with no regard for the env have some problems (Nu shell's autocomplete just breaks entirely) but I've not had any problems with git or vim itself.

Would a workaround like this still be required for clean MSYS2 envs? Or is more testing needed to see if/how this could work? In the latter case, I'd gladly be the guinea pig

perXautomatik pushed a commit to perXautomatik/dotfiles that referenced this issue Aug 23, 2023
Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030

destination path already exists and is not an empty directory
junegunn/vim-plug#896
perXautomatik pushed a commit to perXautomatik/dotfiles that referenced this issue Aug 23, 2023
Cygwin filepaths and git (windows build) on Cygwin Vim
junegunn/vim-plug#896

E370: Could not load library python36.dll
vim/vim-win32-installer#48

Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030
perXautomatik pushed a commit to perXautomatik/dotfiles that referenced this issue Oct 19, 2023
Cygwin filepaths and git (windows build) on Cygwin Vim
junegunn/vim-plug#896

E370: Could not load library python36.dll
vim/vim-win32-installer#48

Calling wrong python3 interpreter under Cygwin
Shougo/deoplete.nvim#1030
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants