Skip to content

Instantly share code, notes, and snippets.

@kmpm
Last active December 10, 2015 16:28
Show Gist options
  • Save kmpm/4461337 to your computer and use it in GitHub Desktop.
Save kmpm/4461337 to your computer and use it in GitHub Desktop.
@echo off
SET VIMFILES="%userprofile%\vimfiles"
SET VIMRC="%userprofile%\.vimrc"
echo VIMFILES=%VIMFILES%
echo creating folders for pathogen
IF NOT EXIST %vimfiles%\autoload mkdir %vimfiles%\autoload
IF NOT EXIST %vimfiles%\bundle mkdir %vimfiles%\bundle
echo create folder for ftplugin
IF NOT EXIST %vimfiles%\ftplugin mkdir %vimfiles%\ftplugin
echo create folders for vim-sensible
mkdir %userprofile%\.cache\vim\swap
mkdir %userprofile%\.cache\vim\undo
mkdir %userprofile%\.cache\vim\backup
echo hide the dotdir %userprofile%\.cache
attrib +h %userprofile%\.cache
echo Installs pathogen
curl --insecure -Sso "%vimfiles%\autoload\pathogen.vim" https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
REM curl -# -k -So %vimfiles%\autoload\pathogen.vim https://raw.github.com/tpope/vim-pathogen/autoload/pathogen.vim
echo Fix .vimrc
IF EXIST %vimrc% attrib -h %vimrc%
echo execute pathogen#infect()>%vimrc%
echo syntax on>>%vimrc%
echo filetype plugin indent on>>%vimrc%
echo Hiding %vimrc%
attrib +h %vimrc%
echo install some bundles
pushd %vimfiles%\bundle
IF NOT EXIST .\vim-sensible git clone https://github.com/tpope/vim-sensible.git
IF NOT EXIST .\nerdtree git clone https://github.com/scrooloose/nerdtree.git
IF NOT EXIST .\syntastic git clone https://github.com/scrooloose/syntastic.git
IF NOT EXIST .\vim-jade git clone https://github.com/digitaltoad/vim-jade.git
popd
REM Filetype settings
REM JavaScript
if EXIST %vimfiles%\ftplugin\javascript.vim goto jade
echo setlocal expandtab>%vimfiles%\ftplugin\javascript.vim
echo setlocal shiftwidth=2>>%vimfiles%\ftplugin\javascript.vim
echo setlocal shiftround>>%vimfiles%\ftplugin\javascript.vim
echo setlocal tabstop=2>>%vimfiles%\ftplugin\javascript.vim
:jade
REM Jade
if EXIST %vimfiles%\ftplugin\jade.vim goto end
echo setlocal expandtab>%vimfiles%\ftplugin\jade.vim
echo setlocal shiftwidth=2>>%vimfiles%\ftplugin\jade.vim
echo setlocal shiftround>>%vimfiles%\ftplugin\jade.vim
echo setlocal tabstop=2>>%vimfiles%\ftplugin\jade.vim
:end
echo.
echo Done!
pause
#!/usr/bin/env bash
# Install / run by typing the following in a console
#curl https://gist.github.com/kmpm/4461337/raw/viminstall.sh | sh
VIMHOME=~/.vim
VIMRC=~/.vimrc
VIMBUNDLE=$VIMHOME/bundle
echo "
Will now install git, vim-scripts, vim-nox, pylint, pyflakes
"
sudo apt-get install -y git vim-nox vim-scripts pylint pyflakes
#create some folders for vim
mkdir -p $VIMHOME/autoload $VIMBUNDLE
mkdir -p $VIMHOME/indent
mkdir -p $VIMHOME/syntax
mkdir -p $VIMHOME/ftplugin
#create some folders for vim-sensible
mkdir -p ~/.local/share/vim/swap
mkdir -p ~/.local/share/vim/backup
mkdir -p ~/.local/share/vim/undo
#make sure vimrc exists
touch $VIMRC
#check for and install pathogen
if [ ! -f $VIMHOME/autoload/pathogen.vim ] ; then
echo "pathogen will be installed"
curl -Sso ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim
else
echo "pathogen already installed"
fi
clonebundle() {
folder=$2
repo=$1
if [ ! -d $VIMBUNDLE/$folder ]; then
echo "$folder will be installed"
cd $VIMBUNDLE
git clone $repo
echo ""
else
echo "$folder already installed, updating..."
cd $VIMBUNDLE/$folder
git pull origin master
echo ""
fi
}
addifnot() {
what="$1"
if grep -q "$what" $VIMRC
then
echo "already set - $what"
else
echo $what >>$VIMRC
fi
}
#function for letting a filetype
#get 2 spaces softtab
soft2() {
filetype=$1
if [ ! -f $VIMHOME/ftplugin/$filetype.vim ]; then
echo "\" set whitespace for ${filetype} to always use 2 spaces instead of tabs
setlocal expandtab
setlocal shiftwidth=2
setlocal shiftround
setlocal tabstop=2
" > $VIMHOME/ftplugin/${filetype}.vim
fi
}
addifnot "execute pathogen#infect()"
addifnot "syntax on"
addifnot "filetype plugin indent on"
addifnot "colorscheme koehler"
clonebundle https://github.com/scrooloose/nerdtree.git nerdtree
clonebundle https://github.com/scrooloose/syntastic.git syntastic
clonebundle https://github.com/tpope/vim-sensible.git vim-sensible
clonebundle https://github.com/digitaltoad/vim-jade.git vim-jade
clonebundle https://github.com/mitechie/pyflakes-pathogen.git pyflakes-pathogen
clonebundle https://github.com/tpope/vim-git.git git
clonebundle https://github.com/ervandew/supertab.git supertab
soft2 javascript
soft2 jade
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment