-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Comments
This is likely due to Windows git failing to understand Cygwin's path conventions (
but same trick does not work for me in |
Is your vimrc is in " in vimrc
let s:base_dir = expand('<sfile>:p:h')
call plug#begin(s:base_dir . '/plugged') Does this help? |
Actually it's ~/.vimrc.
I assume you meant '/.vim/plugged'?
Nope, |
I managed to make To: let g:plug_home = 'F:\\Cygwin\\home\\Professional\\.vim\\plugged' Then, after successfull cloning the repositories on
|
Is your request for vim-plug to support both windows and cygwin builds of git?
|
@evandrocoan Can you try with |
@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 |
@janlazo, by running this: fixedpath="$(cygpath --mixed --absolute "$HOME/.vim/plugged")" You would get |
@evandrocoan Great. So basically all that's needed is for vim-plug to preserve path given to
I think one way to fix this would be to call
|
@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 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 |
"Also, do not forget, that this patch should only be used if the the program cygpath available" - true but |
Thanks. I did not known that. Just another thing then. I also just tested, and git for Cygwin does not accept absolute paths as 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 |
"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). |
My Cygwin git version is |
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). |
I think the option 2 would be better because it would not require a git for Cygwin to be installed. |
2 sounds reasonable to me. Let's wait for comments from maintainers then. |
Calling wrong python3 interpreter under Cygwin Shougo/deoplete.nvim#1030 destination path already exists and is not an empty directory junegunn/vim-plug#896
|
I also noticed that on my computer. I got installed 3 versions of git for Windows, and I ran
They all seem to have |
Ah, nice. |
Unfortunately Mingw gits do not include the ".windows." suffix. |
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. |
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 = {} |
@yugr, you can write like this to get syntax highlighting:
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? |
Adding an option is usually the last thing I'd choose to do :)
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. |
Even if it does accept them, MinGW's |
I did not understood this. If I ask to MinGW to open the
Indeed, MinGw will not accept Cygwin paths like |
MinGW's
I guess I disagree here, in my opinion code should work for any proper location of |
@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 |
@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 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. |
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). |
I use
No. I meant |
But |
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 " 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 |
When I ran the command, the
|
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
https://github.com/junegunn/vim-plug/wiki/faq#filepath-issues-with-cygwinmingw-vim-and-windows-git |
Calling wrong python3 interpreter under Cygwin Shougo/deoplete.nvim#1030 destination path already exists and is not an empty directory junegunn/vim-plug#896
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
After I try the solution,the cgywin64 show the wrong:
|
Thanks for your answer. |
I can't find many mentions of specifically MSYS2 envs, except when mentioned in conjunction with cygwin. 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 |
Calling wrong python3 interpreter under Cygwin Shougo/deoplete.nvim#1030 destination path already exists and is not an empty directory junegunn/vim-plug#896
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
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
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 isgit 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 saysdestination path already exists and is not an empty directory
. But it should say something likeAll up to date
because everything is already installed and up-to-date:.vimrc
The text was updated successfully, but these errors were encountered: