updated vim installer

This commit is contained in:
Wryn Wagner 2021-09-16 19:12:55 -06:00
parent 89505cdecc
commit ec468876e9
3 changed files with 70 additions and 24 deletions

View File

@ -1,11 +1,10 @@
#!/bin/bash
#!/bin/zsh
function INSTALL() {
local CMD_NAME="$1"
local BUILD_DIR="$2"
local BUILD="$3"
echo "installing $CMD_NAME";
echo "installing $CMD_NAME"
[ ! -d $BUILD_DIR ] && { echo "unable to locate $CMD_NAME build files"; exit 1; }
$BUILD >/dev/null 2>&1 \
@ -13,29 +12,15 @@ function INSTALL() {
|| echo "$CMD_NAME installation failed. Please attempt manual installation";
}
function INSTALL_COMMAND_T() {
local CMD_NAME='CommandT'
local BUILD_DIR="$HOME/.vim/bundle/command-t/ruby/command-t/ext/command-t";
function BUILD() {
cd $BUILD_DIR;
ruby extconf.rb;
make
}
INSTALL $CMD_NAME $BUILD_DIR BUILD;
}
function INSTALL_YCM() {
local CMD_NAME='YouCompleteMe';
local BUILD_DIR="$HOME/.vim/bundle/YouCompleteMe";
function BUILD() {
python3 $BUILD_DIR/install.py;
python3 $BUILD_DIR/install.py
}
INSTALL $CMD_NAME $BUILD_DIR BUILD;
INSTALL $CMD_NAME $BUILD_DIR BUILD
}
#INSTALL_COMMAND_T;
INSTALL_YCM;
INSTALL_YCM

View File

@ -0,0 +1,41 @@
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

@ -1,10 +1,16 @@
source "$DOTWRYN_PATH/setup/vim/compile-from-source.zsh"
#####################################################################
function VIM__SETUP() {
STATUS 'starting vim setup'
VIM__COMPILE_FROM_SOURCE
VIM__SOURCE_RC
VIM__SET_LOCAL_CONFIG
VIM__UPDATE_COLORSCHEMES
VIM__INSTALL_VUNDLE_PLUGINS
VIM__CREATE_PANE_DEFAULT_APP
STATUS 'finished vim setup'
}
VIM__VUNDLE_TARGET='https://github.com/VundleVim/Vundle.vim.git'
@ -71,10 +77,24 @@ function VIM__INSTALL_VUNDLE_PLUGINS() {
cd $PREV_DIR >>$LOG 2>&1
}
CHECK 'installing vundle plugins'
STATUS 'installing Vundle.vim plugins'
vim +PluginInstall +qall \
&& OK || WARN
&& SUCCESS 'successfully installed Vundle.vim plugins' \
|| WARN 'failed to install one or more Vundle.vim plugins' \
;
STATUS 'building plugins'
$DOTWRYN_PATH/bin/vim/rebuild_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
CHECK 'updating vim to open in panes by default'
{
echo '#!/bin/sh'
echo "exec $(which vim) -p "'$@'
} > "$HOME/.local/bin/vim" && OK || WARN
chmod +x "$HOME/.local/bin/vim"
}