Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
症状
新しくwinタブを買ったのでvimを入れようと、http://www.vim.org/ からWindows版gvim80.exeをダウンロードした。(いつ間にかver8.0が出てた)
その時NeoBundleが非推奨になってdein.vimと言うものが出ていると知ったので、それを入れようとした。
NeoBundle から dein.vim に乗り換えたら爆速だった話
この記事を参考にして導入。
ちょっとRaspbian1にも入れて試してみるか。→すんなり入った。
じゃあ、Windowsかgvimか、そこらへんの環境とうまく合わないんだろうか。
調査
未知ってなんやねん。
プラグインのひとつとしてdein.vimが読み込まれていないみたい。確かに、ちょっと変な場所にdein.vim本体が入ってて、そこをruntimepathに追加しているんだけど、それがうまくいかないのかな。
" プラグインが実際にインストールされるディレクトリlets:dein_dir=expand('~\.cache\dein')" dein.vim 本体lets:dein_repo_dir=s:dein_dir.'\repos\github.com\Shougo\dein.vim'" dein.vim がなければ github から落としてくるif &runtimepath!~#'/dein.vim'if!isdirectory(s:dein_repo_dir)execute'!git clone https://github.com/Shougo/dein.vim's:dein_repo_direndifexecute'set runtimepath^='.fnamemodify(s:dein_repo_dir,':p')endif(後略)C:\Users\fuman\_vimrc の実行を継続中です"autoload/dein.vim" を"C:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\,C:\Users\fuman/vimfiles,C:\Program Files (x86)\Vim/vimfiles,C:\Program Files (x86)\Vim\vim80,C:\Program Files (x86)\Vim/vimfiles/after,C:\Users\fuman/vimfiles/after" から検索中'runtimepath' の中にはありません:"autoload/dein.vim""autoload/dein.vim" を"C:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\,C:\Users\fuman/vimfiles,C:\Program Files (x86)\Vim/vimfiles,C:\Program Files (x86)\Vim\vim80,C:\Program Files (x86)\Vim/vimfiles/after,C:\Users\fuman/vimfiles/after" から検索中'runtimepath' の中にはありません:"autoload/dein.vim"C:\Users\fuman\_vimrc の処理中にエラーが検出されました:行133:E117: 未知の関数です:dein#load_stateE15: 無効な式です:dein#load_state(s:dein_dir)"autoload/dein.vim" を"C:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\,C:\Users\fuman/vimfiles,C:\Program Files (x86)\Vim/vimfiles,C:\Program Files (x86)\Vim\vim80,C:\Program Files (x86)\Vim/vimfiles/after,C:\Users\fuman/vimfiles/after" から検索中'runtimepath' の中にはありません:"autoload/dein.vim"行148:E117: 未知の関数です:dein#check_installE15: 無効な式です:dein#check_install()$HOME\_vimrc の取込を完了runtimepathにはパスC:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\が追加されてて、そこにちゃんとautoload\dein.vimも入ってる。なぜ認識しないんだろう?
ちょっとruntimepathの設定する文を変えてみる。
" プラグインが実際にインストールされるディレクトリlets:dein_dir=expand('~\.cache\dein')" dein.vim 本体lets:dein_repo_dir=s:dein_dir.'\repos\github.com\Shougo\dein.vim'" dein.vim がなければ github から落としてくるif &runtimepath!~#'/dein.vim'if!isdirectory(s:dein_repo_dir)execute'!git clone https://github.com/Shougo/dein.vim's:dein_repo_direndif"execute 'set runtimepath^=' . fnamemodify(s:dein_repo_dir, ':p') "いったんコメントアウト!setruntimepath^=~/.cache/dein/repos/github.com/Shougo/dein.vim/ "追加。endif(後略)C:\Users\fuman\_vimrc の実行を継続中です"autoload/dein.vim" を"C:\Users\fuman/.cache/dein/repos/github.com/Shougo/dein.vim/,C:\Users\fuman/vimfiles,C:\Program Files (x86)\Vim/vimfiles,C:\Program Files (x86)\Vim\vim80,C:\Program Files (x86)\Vim/vimfiles/after,C:\Users\fuman/vimfiles/after" から検索中行134:C:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\autoload\dein.vim を取込中C:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\autoload\dein.vim の取込を完了C:\Users\fuman/.cache/dein/repos/github.com/Shougo/dein.vim/は良いのか。途中から\が/になってるくらいしか違わないんだが
そんな感じで何パターンか試していると、C:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim\ → NGC:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim → OKC:\Users\fuman\.cache\dein\repos\github.com\Shougo\dein.vim/ → OK
となり、どうやら末尾が\だとruntimepathとしてうまく認識しないっぽい。\,とつながるところがエスケープ文字になっちゃうのか。
でも、fnamemodify()の:pオプションでそんな文字が自動的に追加されてしまうのってどうなの…
最終的に
fnamemodify()をまんま抜く形でうまくいきました。フルパスに展開しなくていいのか?と思ったけど、読めてるからいいや。
たぶん見る人が見たら汚いんだろうなあ。
コメントで指摘いただきました。expand('~\.cache\dein')で展開しているので問題なさそうです。
"""" Dein TOML" プラグインが実際にインストールされるディレクトリlets:dein_dir=expand('~\.cache\dein')" dein.vim 本体lets:dein_repo_dir=s:dein_dir.'\repos\github.com\Shougo\dein.vim'" dein.vim がなければ github から落としてくるif &runtimepath!~#'/dein.vim'if!isdirectory(s:dein_repo_dir)execute'!git clone https://github.com/Shougo/dein.vim's:dein_repo_direndif"execute 'set runtimepath^=' . fnamemodify(s:dein_repo_dir, ':p')execute'set runtimepath^='.s:dein_repo_dir "変更点endif" 設定開始if dein#load_state(s:dein_dir)call dein#begin(s:dein_dir)" プラグインリストを収めた TOML ファイル" 予め TOML ファイル(後述)を用意しておくletg:rc_dir=expand('~/vimfiles/rc') "ここも.vim → vimfiles に変えたlets:toml=g:rc_dir.'/dein.toml'lets:lazy_toml=g:rc_dir.'/dein_lazy.toml'" TOML を読み込み、キャッシュしておくcall dein#load_toml(s:toml,{'lazy':0})call dein#load_toml(s:lazy_toml,{'lazy':1})" 設定終了call dein#end()call dein#save_state()endif" もし、未インストールものものがあったらインストールif dein#check_install()call dein#install()endiffnamemodify()使ってwindows環境でruntimepathに書く、っていう組み合わせが相性悪いんですかねえ。なんかdein.vimに限らず色んな所で起こりそうな気がする。
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
