概要
vimって極めればvscode並のIDEになるんじゃないの? - @ulwluを参考にVimをカスタマイズしていたところ YouCompleteMe でいくつか問題があったためまとめます。
YouCompleteMe インストール
現在のvimrcはこれ→ dotfiles/dotfiles/.vimrc
にはYouCompleteMeが記載されていなかったため個別で入れてみました。
「macos YouCompleteMe install」で検索すると ChengLong/InstructionsForYCM-Mac.md を見つけて次のように実行しました。
$ brew install cmake
$ cd ~/.vim/bundle
$ git clone https://github.com/Valloric/YouCompleteMe.git
$ mkdir YouCompleteMe/ycmbuild
$ cd YouCompleteMe
$ git submodule update --init --recursive
$ cd ycmbuild
$ cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/
$ make ycm_core
fatal error: 'filesystem' file not found
最後の make ycm_core で次のようなエラーが出ました。
$ make ycm_core
Scanning dependencies of target ycm_core
[ 6%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 12%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
In file included from /Users/gremito/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/CandidateRepository.cpp:19:
/Users/gremito/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/Utils.h:23:10: fatal error: 'filesystem' file not found
# include <filesystem>
^~~~~~~~~~~~
1 error generated.
make[3]: *** [ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o] Error 1
make[2]: *** [ycm/CMakeFiles/ycm_core.dir/all] Error 2
make[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
make: *** [ycm_core] Error 2
older ycmd
ググったところ osx 10.14.6 install latest version failure #3805 を見つけて次のように最新バージョンでは macOS 10.15 以上でないと使えないと言われていました。
We've moved to C++17 and are using std::filesystem, which is only available since macOS 10.15. For macOS 10.14, either check out an older YCM commit, or use an older ycmd commit.
2021/02/23 19:42 のコメントで解決しました。
$ cd /path/to/YouCompleteMe
$ git fetch origin
$ git checkout legacy-c++11
$ git submodule update --init --recursive
$ ./install.py