2020-11-21 18:07:26 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
DIR=$(dirname "$(readlink -f "$0")")
|
|
|
|
. "$DIR/../env.sh"
|
|
|
|
|
|
|
|
log 'Setting up vim'
|
|
|
|
|
|
|
|
# check dependencies
|
|
|
|
if [ "$VIM_MODE" = "enhanced" ]; then
|
2020-11-23 02:00:49 +00:00
|
|
|
if ! has_cmd node; then
|
2020-11-23 07:54:48 +00:00
|
|
|
"$PDIR/devel/nodejs.sh"
|
2020-11-23 02:00:49 +00:00
|
|
|
fi
|
|
|
|
if ! has_cmd python; then
|
2020-11-23 07:54:48 +00:00
|
|
|
"$PDIR/devel/python.sh"
|
2020-11-23 02:00:49 +00:00
|
|
|
fi
|
2020-11-21 18:07:26 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# install nvim
|
2020-11-23 07:54:48 +00:00
|
|
|
if ! has_cmd "$VIM"; then
|
|
|
|
case "$PM" in
|
|
|
|
apt)
|
2020-12-08 03:18:26 +00:00
|
|
|
# nvim not very compatible with CJK characters and ranger
|
|
|
|
#sudo add-apt-repository ppa:neovim-ppa/stable -y
|
|
|
|
#sudo apt update
|
|
|
|
#sudo apt install -y neovim
|
|
|
|
#if enhance_vim; then
|
|
|
|
#sudo pip3 install pyvim neovim
|
|
|
|
#fi
|
|
|
|
|
|
|
|
# gui-common is required for clipboard integration
|
2021-01-17 07:30:01 +00:00
|
|
|
sudo add-apt-repository ppa:jonathonf/vim -y -n
|
2021-01-15 07:42:29 +00:00
|
|
|
pm_update
|
2020-12-08 03:18:26 +00:00
|
|
|
sudo apt install -y vim vim-gui-common
|
2020-11-23 07:54:48 +00:00
|
|
|
if enhance_vim; then
|
2020-12-08 03:18:26 +00:00
|
|
|
sudo pip3 install pyvim
|
2020-11-23 07:54:48 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
pacman)
|
2020-12-08 03:18:26 +00:00
|
|
|
#sudo pacman -S --noconfirm --needed neovim
|
|
|
|
#if enhance_vim; then
|
|
|
|
#sudo pip install pyvim neovim
|
|
|
|
#fi
|
|
|
|
sudo pacman -S --noconfirm --needed vim
|
2020-11-23 07:54:48 +00:00
|
|
|
if enhance_vim; then
|
2020-12-08 03:18:26 +00:00
|
|
|
sudo pip install pyvim
|
2020-11-23 07:54:48 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2020-11-21 18:07:26 +00:00
|
|
|
|
|
|
|
# symlink configuration
|
2020-12-17 07:18:43 +00:00
|
|
|
sudo ln -sf "$(command -v vim)" /usr/bin/v
|
2020-11-21 18:07:26 +00:00
|
|
|
lnsf "$DIR/vim/init.vim" "$XDG_CONFIG_HOME/nvim/init.vim"
|
|
|
|
lnsf "$DIR/vim/coc-settings.json" "$XDG_CONFIG_HOME/nvim/coc-settings.json"
|
|
|
|
lnsf "$DIR/vim/coc-settings.json" "$HOME/.vim/coc-settings.json"
|
|
|
|
lnsf "$DIR/vim/init.vim" "$HOME/.vimrc"
|