Extracted vim installation functions for external use
This commit is contained in:
parent
a7bf48df9e
commit
fdb6f3d00a
44
bin/vim/compile
Executable file
44
bin/vim/compile
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
source "$HOME/.config/wryn/env.zsh"
|
||||||
|
source $ZSH_COLOR_UTIL
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
TARGET='https://github.com/vim/vim.git'
|
||||||
|
LOCAL_PATH="$HOME/.packages/vim"
|
||||||
|
|
||||||
|
STATUS 'setting up vim'
|
||||||
|
[ -d $LOCAL_PATH/.git ] && {
|
||||||
|
USER_PROMPT 'vim already compiled; update? [y/N]'
|
||||||
|
read -k yn; echo
|
||||||
|
[[ $yn =~ [^yY] ]] && return 0
|
||||||
|
cd $LOCAL_PATH
|
||||||
|
|
||||||
|
CHECK 'updating vim to latest'
|
||||||
|
git pull >/dev/null 2>&1 \
|
||||||
|
&& OK || FAIL 'unable to update vim'
|
||||||
|
} || {
|
||||||
|
CHECK 'getting vim source'
|
||||||
|
git clone $TARGET $LOCAL_PATH >/dev/null 2>&1 \
|
||||||
|
&& OK || FAIL 'unable to download vim'
|
||||||
|
}
|
||||||
|
cd $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 \
|
||||||
|
>/dev/null 2>&1 && OK || FAIL
|
||||||
|
|
||||||
|
CHECK 'building vim'
|
||||||
|
sudo make >/dev/null 2>&1 && OK || FAIL
|
||||||
|
|
||||||
|
CHECK 'installing vim'
|
||||||
|
sudo make install >/dev/null 2>&1 && OK || FAIL
|
29
bin/vim/install-plugins
Executable file
29
bin/vim/install-plugins
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
source "$HOME/.config/wryn/env.zsh"
|
||||||
|
source $ZSH_COLOR_UTIL
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
TARGET='https://github.com/VundleVim/Vundle.vim.git'
|
||||||
|
VUNDLE_DIR="$HOME/.vim/bundle/Vundle.vim"
|
||||||
|
|
||||||
|
[ ! -d "$VUNDLE_DIR" ] && {
|
||||||
|
CHECK 'installing Vundle.vim'
|
||||||
|
git clone $TARGET $VUNDLE_DIR >>$LOG 2>&1 \
|
||||||
|
&& OK || FAIL
|
||||||
|
} || {
|
||||||
|
CHECK 'updating Vundle.vim'
|
||||||
|
cd $VUNDLE_DIR >>$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' \
|
||||||
|
;
|
||||||
|
|
||||||
|
STATUS 'building plugins (this may take a minute)'
|
||||||
|
$DOTWRYN/bin/vim/rebuild-plugins
|
@ -1,20 +1,25 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
source "$HOME/.config/wryn/env.zsh"
|
||||||
|
source $ZSH_COLOR_UTIL
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
function INSTALL() {
|
function INSTALL() {
|
||||||
local CMD_NAME="$1"
|
local CMD_NAME="$1"
|
||||||
local BUILD_DIR="$2"
|
local BUILD_DIR="$2"
|
||||||
local BUILD="$3"
|
local BUILD="$3"
|
||||||
|
|
||||||
echo "installing $CMD_NAME"
|
[ ! -d $BUILD_DIR ] && FATAL "unable to locate $CMD_NAME build files"
|
||||||
[ ! -d $BUILD_DIR ] && { echo "unable to locate $CMD_NAME build files"; exit 1; }
|
|
||||||
|
|
||||||
|
CHECK "Installing $CMD_NAME"
|
||||||
$BUILD >/dev/null 2>&1 \
|
$BUILD >/dev/null 2>&1 \
|
||||||
&& echo "$CMD_NAME installation successful" \
|
&& OK || WARN "failed automated build"
|
||||||
|| echo "$CMD_NAME installation failed. Please attempt manual installation";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
function INSTALL_YCM() {
|
function INSTALL_YCM() {
|
||||||
local CMD_NAME='YouCompleteMe';
|
local CMD_NAME='YouCompleteMe'
|
||||||
local BUILD_DIR="$HOME/.vim/bundle/YouCompleteMe";
|
local BUILD_DIR="$HOME/.vim/bundle/YouCompleteMe"
|
||||||
|
|
||||||
function BUILD() {
|
function BUILD() {
|
||||||
python3 $BUILD_DIR/install.py
|
python3 $BUILD_DIR/install.py
|
||||||
@ -23,4 +28,5 @@ function INSTALL_YCM() {
|
|||||||
INSTALL $CMD_NAME $BUILD_DIR BUILD
|
INSTALL $CMD_NAME $BUILD_DIR BUILD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
INSTALL_YCM
|
INSTALL_YCM
|
||||||
|
@ -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
|
|
||||||
}
|
|
@ -4,16 +4,13 @@ source "$DOTWRYN_PATH/setup/vim.compile.zsh"
|
|||||||
|
|
||||||
function SETUP__VIM() {
|
function SETUP__VIM() {
|
||||||
STATUS 'starting vim setup'
|
STATUS 'starting vim setup'
|
||||||
VIM__COMPILE_FROM_SOURCE
|
"$DOTWRYN_PATH/bin/vim/compile"
|
||||||
VIM__SOURCE_RC
|
VIM__SOURCE_RC
|
||||||
VIM__INSTALL_VUNDLE_PLUGINS
|
"$DOTWRYN_PATH/bin/vim/install-plugins"
|
||||||
VIM__CREATE_PANE_DEFAULT_APP
|
VIM__CREATE_PANE_DEFAULT_APP
|
||||||
STATUS 'finished vim setup'
|
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() {
|
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() {
|
function VIM__CREATE_PANE_DEFAULT_APP() {
|
||||||
which vim | grep "$HOME/.local/bin/vim" && return 0
|
which vim | grep "$HOME/.local/bin/vim" && return 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user