Extracted vim installation functions for external use

This commit is contained in:
yage
2022-02-06 00:45:04 -07:00
parent a7bf48df9e
commit fdb6f3d00a
6 changed files with 88 additions and 82 deletions

View File

@ -1,41 +0,0 @@
VIM__SOURCE_TARGET='https://github.com/vim/vim.git'
VIM__LOCAL_PATH="$HOME/.packages/vim"
function VIM__COMPILE_FROM_SOURCE() {
STATUS 'setting up vim'
[ -d $VIM__LOCAL_PATH ] && {
USER_PROMPT 'vim already compiled; update? [y/N]'
READ_K yn
[[ $yn =~ [^yY] ]] && return 0
cd $VIM__LOCAL_PATH
CHECK 'updating vim to latest'
git pull >>$LOG 2>&1 \
&& OK || { WARN 'unable to update vim'; return 1; }
} || {
CHECK 'getting vim source'
git clone $VIM__SOURCE_TARGET $VIM__LOCAL_PATH >>$LOG 2>&1 \
&& OK || { WARN 'unable to download vim'; return 1; }
}
cd $VIM__LOCAL_PATH
CHECK 'configuring vim'
./configure \
--with-features=huge \
--enable-cscope \
--enable-gtk2-check \
--enable-gtk3-check \
--enable-gui=auto \
--enable-luainterp=yes \
--enable-perlinterp=yes \
--enable-python3interp=yes \
--enable-rubyinterp=yes \
--enable-terminal \
>>$LOG 2>&1 && OK || { WARN; return 1; }
CHECK 'building vim'
sudo make >>$LOG 2>&1 && OK || { WARN; return 1; }
CHECK 'installing vim'
sudo make install >>$LOG 2>&1 && OK || WARN
}

View File

@ -4,16 +4,13 @@ source "$DOTWRYN_PATH/setup/vim.compile.zsh"
function SETUP__VIM() {
STATUS 'starting vim setup'
VIM__COMPILE_FROM_SOURCE
"$DOTWRYN_PATH/bin/vim/compile"
VIM__SOURCE_RC
VIM__INSTALL_VUNDLE_PLUGINS
"$DOTWRYN_PATH/bin/vim/install-plugins"
VIM__CREATE_PANE_DEFAULT_APP
STATUS 'finished vim setup'
}
VIM__VUNDLE_TARGET='https://github.com/VundleVim/Vundle.vim.git'
VIM__VUNDLE_LOCAL="$HOME/.vim/bundle/Vundle.vim"
#####################################################################
function VIM__SOURCE_RC() {
@ -29,32 +26,6 @@ function VIM__SOURCE_RC() {
}
}
function VIM__INSTALL_VUNDLE_PLUGINS() {
[ ! -d "$HOME/.vim/bundle/Vundle.vim" ] && {
CHECK 'installing Vundle.vim'
git clone $VIM__VUNDLE_TARGET $VIM__VUNDLE_LOCAL >>$LOG 2>&1 \
&& OK || { WARN; return 1; }
} || {
CHECK 'updating Vundle.vim'
local PREV_DIR=$(pwd)
cd $VIM__VUNDLE_LOCAL >>$LOG 2>&1 \
&& git pull >>$LOG 2>&1 \
&& OK || WARN 'unable to pull latest Vundle.vim'
cd $PREV_DIR >>$LOG 2>&1
}
STATUS 'installing Vundle.vim plugins'
vim +PluginInstall +qall \
&& SUCCESS 'successfully installed Vundle.vim plugins' \
|| WARN 'failed to install one or more Vundle.vim plugins' \
;
CHECK 'building plugins (this may take a minute)'
$DOTWRYN_PATH/bin/vim/rebuild-plugins >>$LOG 2>&1\
&& OK || WARN 'retry plugin build manually'
}
function VIM__CREATE_PANE_DEFAULT_APP() {
which vim | grep "$HOME/.local/bin/vim" && return 0