LoginSignup
3
3

More than 5 years have passed since last update.

WindowsのCygwin環境でVimにdeinを入れる時にハマった

Posted at

最近WindowsでCygwinを使い始めて色々遊んでます。
Windowsのコマンドプロンプトより大分身軽で使いやすいです。

Vimも入れられたし、プラグイン入れるか……ってところでハマるとは思ってませんでした。

先に結論

rsyncとgitがCygwin側に入ってませんでした。
しかも、Windows側にgitが入ってたせいで、ディレクトリがずれててずっと気づかなかったです。

dein.vimを入れ終わるまで

どうやら最近はNeobundleよりdein.vimを使えって話だったので、dein.vimをインストールしてみることにしました。

環境

Windows10 64bit
Cygwin 64bit 2.6.0
Vim 8.0

.vimrc
set number
set autoindent
set tabstop=4
set shiftwidth=4
set expandtab

"dein Scripts-----------------------------

if !&compatible
  set nocompatible
endif

augroup MyAutoCmd
  autocmd!
augroup END

"直接ディレクトリぶちこむ書き方は良くない
let s:cache_home = '/home/Kage/.vim'
let s:dein_dir = s:cache_home . '/dein'
let s:dein_repo_dir = s:dein_dir . '/repos/github.com/Shougo/dein.vim'
if !isdirectory(s:dein_repo_dir)
  call system('git clone https://github.com/Shougo/dein.vim ' . shellescape(s:dein_repo_dir))
endif
let &runtimepath = s:dein_repo_dir .",". &runtimepath
" プラグイン読み込み
if dein#load_state(s:dein_dir)
  call dein#begin(s:dein_dir)
  call dein#add('scrooloose/nerdtree')
  call dein#add('Shougo/unite.vim')
  call dein#end()
  call dein#save_state()
endif
if has('vim_starting') && dein#check_install()
  call dein#install()
endif
" }}}

"End dein Scripts-------------------------

ディレクトリが直接指定になってるので、このままコピペすると地獄を見ます。

わくわくしながらVim起動

[dein] Not installed plugins: ['nerdtree', 'unite.vim']
[dein] Update started: (2016/12/06 05:26:13)
dein |nerdtree | git clone --recursive https://github.com/scrooloose/nerdtree.git "/home/Kage/.vim/dein/repos/github.com/scrooloose/nerdtree"
dein [========== ] nerdtree
dein |unite.vim | git clone --recursive https://github.com/Shougo/unite.vim.git "/home/Kage/.vim/dein/repos/github.com/Shougo/unite.vim"
dein [====================] unite.vim
fatal: destination path 'NERDTree' already exists and is not an empty directory.

は?

rsyncとgitコマンドが入ってないといけなかった

Requirements

  • Vim 7.4 or above or NeoVim.
  • "rsync" command in $PATH (UNIX)
  • "xcopy" command in $PATH (Windows)
  • "git" command in $PATH (if you want to install github or vim.org plugins)

rsyncコマンドが入ってませんでした。
最初に公式ページなぜ見なかったし。

apt-get install rsync

してから、もう一度vimを立ち上げます。

[dein] Not installed plugins: ['nerdtree', 'unite.vim']
[dein] Update started: (2016/12/06 05:26:13)
dein |nerdtree | git clone --recursive https://github.com/scrooloose/nerdtree.git "/home/Kage/.vim/dein/repos/github.com/scrooloose/nerdtree"
dein [========== ] nerdtree
dein |unite.vim | git clone --recursive https://github.com/Shougo/unite.vim.git "/home/Kage/.vim/dein/repos/github.com/Shougo/unite.vim"
dein [====================] unite.vim
fatal: destination path 'NERDTree' already exists and is not an empty directory.

えっ……どういうことだ……。

結論:gitコマンドがCygwin側に入ってなかった

何時間もトラブルシューティングしてましたが、
gitコマンドが正しく実行されてるにも関わらず/home/Kage/.vim/dein/repos/github.com/フォルダ内にリポジトリが出来ませんでした。

試しに

git clone --recursive https://github.com/scrooloose/nerdtree.git 

とCygwin上で手打ちしても、既にフォルダがあると文句を言われる。
散々トラブルシューティングした結果、どうやらWindows側のgitコマンドを呼び出していたらしく、Cドライブ直下に2つ目の.vimフォルダが出来てました。やらかしマン。

apt-get install git

Cygwin側にgitコマンドを入れたらちゃんと~/.vim/dein/repos/github.com/ディレクトリの方にリポジトリできました。ちゃんちゃん。

教訓

Windowsはクソ、MacかLinuxのメイン機が欲しい。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3