Add suggestion for plugins that use 'dir' in Cygwin because of mixed path issue with Windows Git.

Jan Edmund Lazo 2020-01-15 06:31:46 -05:00
parent 9b4627b4e4
commit 790042dd43

12
faq.md

@ -218,19 +218,21 @@ REG QUERY "HKLM\Software\Microsoft\Command Processor" /v AutoRun
### Filepath issues with Cygwin/MinGW Vim and Windows Git
Windows Git must be upgraded to support mixed paths (ie. `C:/Users/foo/.vim/plugged`).
Modify your vimrc to use `g:plug_home` instead of passing a filepath to `plug#begin` so that vim-plug does not convert it back to Unix paths (ie. `/home/foo/.vim/plugged`) and break when passing filepaths to Windows Git.
Modify your vimrc to use `g:plug_home` instead of passing a filepath to `plug#begin` so that vim-plug does not convert it back to Unix paths (ie. `/home/foo/.vim/plugged`) and break when passing filepaths to Windows Git. Use `cygpath -m` command to convert a filepath to mixed paths. Plugins that define `dir` to install the plugin in some directory must use mixed paths as well.
```vim
let g:plug_home = '~/.vim/plugged'
function! s:fix_plug_path(path)
if has('win32unix')
\ && executable('cygpath')
\ && executable('git')
\ && split(system('git --version'))[2] =~# 'windows'
" Use mixed path on Cygwin so that Windows git works
let g:plug_home = substitute(system('cygpath -m ' . g:plug_home), '\r*\n\+$', '', '')
return substitute(system('cygpath -m ' . a:path), '\r*\n\+$', '', '')
endif
return a:path
endfunction
let g:plug_home = s:fix_plug_path($HOME . '/.vim/plugged)
call plug#begin()
call plug#('junegunn/fzf', { 'dir': s:fix_plug_path($HOME . '/.fzf'), 'do': './install --all' })
```
Details at https://github.com/junegunn/vim-plug/issues/896