在Termux中安装YCM(YouCompleteMe)

我的vim配置 相似,在Termux中也可以配置和编译YCM(YouCompleteMe),只是需要稍有调整。

安装Ultimate vimrc Awsome版本
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
  • 配置 ~/.vim_runtime/my_configs.vim :

~/.vim_runtime/my_configs.vim
" 行号和配色
"
set nu rnu
set background=dark
colorscheme dracula

" 自动缩进
"
filetype indent on
set ai
set si

" 折叠
"
set foldmethod=syntax
set foldlevelstart=99
  • 准备YCM编译依赖:

准备YCM编译依赖
apt install vim-python clang python cmake
  • 准备YCM目录:

准备YCM目录
cd ~/.vim_runtime/my_plugins/
git clone https://github.com/ycm-core/YouCompleteMe.git
cd YouCompleteMe
  • 按需编译YouCompleteMe:

按需编译YouCompleteMe(目前仅支持Go,C/C++,JS)
git submodule update --init --recursive

python3 install.py --clangd-completer --go-completer \
            --ts-completer

如果加上 --rust-completer 参数来支持 Rust Atlas 会出现一个报错:

Installing rust-analyzer for Rust support...info: syncing channel updates for 'nightly-2021-10-26-aarch64-linux-android'
info: latest update on 2021-10-26, rust version 1.58.0-nightly (29b124802 2021-10-25)
error: target 'aarch64-linux-android' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets

FAILED

这个报错是因为rust官方支持平台没有包括 aarch64-linux-android 。目前我还没有找到解决方法,但是参考 can’t install on termux android #3542 有人提示采用 Termux proot完整Linux文件系统 模式运行 Arch Linux 似乎可以安装 RustPython ,我推测在 Termux proot完整Linux文件系统 模拟环境中采用了比较通用的platform参数,我后续再想办法实践解决。

参考