#!/bin/bash toolName=vim indentDownUrl="https://www.vim.org/scripts/download_script.php?src_id=27565" seqVimConfigLoc="$HOME/.vimrc" sq_aptOpt= seq_config() { ## Apt cmdline option to suppress user interaction interactive || sq_aptOpt="-y" ## Return of non zero value will abort the sequence return 0 } step_1_info() { echo "Install $toolName"; } step_1_alias() { echo "install"; } step_1() { exe apt install vim ${sq_aptOpt} } step_2_info() { echo "Installing indentation script $seqVimIndentLoc"; } step_2_alias() { echo "setup"; } step_2() { if [ ! -e "$seqVimIndentLoc" ]; then exe mkdir -p $(dirname "$seqVimIndentLoc") cd $(dirname "$seqVimIndentLoc") wget --content-disposition $indentDownUrl fi info "Installing indentation rules" addConf -c "$seqVimConfigBasic" "$seqVimConfigLoc" } seqVimIndentLoc="$HOME/.vim/indent/sh.vim" seqVimConfigBasic="set t_TI= t_TE= filetype plugin indent on syntax on" step_3_info() { echo "Install editorconfig as vim 8 plugin"; } step_3_alias() { echo "editorconfig"; } step_3() { local ecDir="$HOME/.vim/pack/editorconfig/start" local ecUrl='https://github.com/editorconfig/editorconfig-vim.git' if [ ! -e "$ecDir" ]; then info "Installing editorconfig plugin" exe mkdir -p "$ecDir" exe cd "$ecDir" exe git clone "$ecUrl" else info "Upgrading editorconfig plugin" exe cd "$ecDir" exe git pull fi } step_10_info() { echo "Setup $HOME/.vimrc globaly to use spaces and indent 2"; } step_10() { info "Installing formating rules" info -a " 'set expandtab shiftwidth=2 softtabstop=2 tabstop=2'" info -a " Indent by 2 spaces" info -a " 'set noro'" info -a " Don't set files read only for vimdiff" info -a " 'cindent cinkeys-=0#'" info -a " Don't remove leading spaces for comments" addConf -a "$seqVimConfig" "$seqVimConfigLoc" } seqVimConfig="set expandtab shiftwidth=2 softtabstop=2 tabstop=2 set noro set cindent cinkeys-=0#" # shellcheck disable=SC2034 # Appears unused readonly sqr_minVersion=16 # shellcheck disable=SC1091 # Don't follow this source . /usr/local/bin/sequencer.sh