summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2015-06-06 12:05:11 +0100
committerUrbain Vaes <urbain@vaes.uk>2015-06-06 12:05:11 +0100
commitc53aa7ade263a59aab221c83ebcd297aa628c2dd (patch)
tree3f4c9601e031e89724430ab9f0ce806d7d98947d
parent1c65bc1f98bedacaa40cad62d50bad3af1dbc2f1 (diff)
updated install.sh
-rw-r--r--README.md4
-rw-r--r--bookmarks5
-rw-r--r--id_rsa.pub1
-rwxr-xr-xinstall.sh242
-rw-r--r--nvim/.netrwhist3
-rw-r--r--nvimrc5
-rw-r--r--vimrc1
-rw-r--r--zshrc4
8 files changed, 190 insertions, 75 deletions
diff --git a/README.md b/README.md
index b5fe2eb..7c6d79e 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,4 @@ This repository contains my configuration files. I use the following programs:
+ *offlineimap* + *mutt* + *msmtp* to receive, wirte, and send emails.
+ *zsh* with the *oh-my-zsh* framework as my shell.
-All the configuration files can be installed by executing the script install.sh. If used with arguments, only the files passed to the script will be installed. For example, executing
-`./install.sh vim vimrc`
-will install my vim configuration.
+All the configuration files can be installed by executing the script install.sh.
diff --git a/bookmarks b/bookmarks
new file mode 100644
index 0000000..4bf977a
--- /dev/null
+++ b/bookmarks
@@ -0,0 +1,5 @@
+code : /home/urbain/Dropbox/phd/code/spectral
+dotfiles : /home/urbain/dotfiles
+paper : /home/urbain/Dropbox/phd/papers/spectral
+phd : /home/urbain/Dropbox/phd
+report : /home/urbain/Dropbox/phd/reports/esa
diff --git a/id_rsa.pub b/id_rsa.pub
deleted file mode 100644
index a39a69a..0000000
--- a/id_rsa.pub
+++ /dev/null
@@ -1 +0,0 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCv6LqRBCwYerI/vrOU/AAitTYMAIpde++y3ue/LoQ0ndu84v0MQI5PuARjhdiPnCBnCpgxIltIGafrzq2P2FSZJvFms8aCG9+/qQsOjObcNkY4ZVAxNiG7vfg/x30MeRcd8KYCA1pl/GkaEtLHxWuiUHhGXnJ0zgYymJY0KasgXAGwNpvlbGqQcAB4A9gqRyQ2UKCZB4g76CHsjS4VCwghYaR13eTMB/PtcHUCt1cFas9yCmxPVF8UmkFNpw+9grfRlCt07gUy9VsSjPtDZQWAidQpuQkB4ZQpUCFSn/URvNyr9MxX16TsIwUe37uqFlrEOoRIh4nCyL29VuQyeH2GBVrlDjtfkG/7l9B4+Y3SXL3TotNUx8Ho2S1ObZ3r2ujtIj+OBbD8oNcY0HGeogctF+f9w/Mfs23avjbL4yfJ+T2cven+lNG5pwrz7ZBKFc4gChPRgm6mxYNT+yF7bBF8v6MmiLEQy41AKWCMFSqyZ6Kz14aG8fJ33iPpWFc51ZR89Y26I3EVpweiRekX+Xvcrm6bfaCQov9ZssUvh+k+/Q5xJ0RizEWwGVaOkgtkq8A3v7gZtSR+cs7iuLheq0DI1h1lHJ83NYAi7q7gcGtXmhqdWJP0sA5FX3qCAQCImDbni39ZpwWpjwe09/5zbV5NkPf+g65JjYzMW2qwkm/lSQ== u.vaes13@imperial.ac.uk
diff --git a/install.sh b/install.sh
index f679a42..89da167 100755
--- a/install.sh
+++ b/install.sh
@@ -1,42 +1,131 @@
#!/bin/bash
home=/home/urbain
-dir=~/dotfiles
-olddir=~/dotfiles_old
+dir=$home/dotfiles
+olddir=$home/dotfiles_old
+
+declare -A repodirs
+repodirs[altercation/mutt-colors-solarized]=$home/.solarized/mutt-colors-solarized
+repodirs[Anthony25/gnome-terminal-colors-solarized]=$home/.solarized/gnome-terminal-colors-solarized
+repodirs[seebi/dircolors-solarized]=$home/.solarized/dircolors-solarized
+repodirs[gmarik/vundle]=$dir/bundle/vundle
+repodirs[junegunn/vim-plug]=$dir/nvim/vim-plug
+repodirs[junegunn/fzf]=$home/.fzf
+repodirs[tmux-plugins/tpm]=$home/.tmux/plugins/tpm
+repodirs[uvaes/fuzzy-zsh-marks]=$home/github/fuzzy-zsh-marks
+repodirs[alols/xcape]=$home/xcape
+repodirs[icholy/ttygif]=$home/ttygif
+
+function after_vimplug {
+ cd ..
+ rm -rf autoload
+ mkdir -p autoload
+ cd autoload
+ ln -s ../vim-plug/plug.vim;
+}
+
+declare -A actions
+actions[altercation/mutt-colors-solarized]=''
+actions[Anthony25/gnome-terminal-colors-solarized]=''
+actions[seebi/dircolors-solarized]=''
+actions[gmarik/vundle]=''
+actions[junegunn/vim-plug]='after_vimplug'
+actions[junegunn/fzf]='./install'
+actions[tmux-plugins/tpm]=''
+actions[uvaes/fuzzy-zsh-marks]=''
+actions[alols/xcape]='make'
+actions[icholy/ttygif]='make'
+
+function fetch_repo {
+ cd $1
+ echo "Fetching origin of git repository stored in $1 ..."
+ git fetch -q origin master
+}
+
+function clone_repo {
+ githubDir=https://github.com/$1
+ echo "Cloning $repo in $2"
+ git clone -q $githubDir $2
+ cd $2
+}
+
+function waitjobs {
+ for job in `jobs -p`
+ do
+ wait $job
+ done
+}
-install_dotfiles=0
-install_repos=0
-install_aux=0
+function install_repos {
+ echo -e "\n*** \e[1mInstalling git repositories\e[0m ***"
-while [[ $# > 0 ]]
-do
- key="$1"
- echo $key
- case $key in
- -d|--dotfiles)
- install_dotfiles=1
- ;;
- -r|--repositories)
- install_repos=1
- ;;
- -l|--lib)
- install_aux=1
- ;;
- *)
- ;;
- esac
- shift
-done
+ for repo in "${!repodirs[@]}"; do
+
+ repodir=${repodirs[$repo]}
+ action=${actions[$repo]}
+
+ if [ ! -d $repodir ]; then
+ clone_repo $repo $repodir $action &
+ else
+ echo -e "\e[0mRepository $repo already installed in ${repodir}.\e[0m"
+ fi
+ done
+ waitjobs
+ echo "--> Done!"; echo
+
+ echo -e "*** \e[1mExectutiong actions after installation\e[0m ***"
+ for repo in "${!repodirs[@]}"; do
+ cd ${repodirs[$repo]}
+ eval ${actions[$repo]}
+ done
+}
+
+function update_repos {
+ echo -e "\n*** \e[1mUpdating git repositories\e[0m ***"
+
+ for repo in "${!repodirs[@]}"; do
+
+ repodir=${repodirs[$repo]}
+
+ if [ -d $repodir ]; then
+ fetch_repo $repodir &
+ fi
+ done
+
+ for job in `jobs -p`
+ do
+ wait $job
+ done
-if [[ "$install_dotfiles" -eq "1" ]]; then
+ echo "--> Done!"; echo
- echo -e "\n*** Installing dotfiles ***"
+ for repo in "${!repodirs[@]}"; do
+ repodir=${repodirs[$repo]}
+
+ if [ -d $repodir ]; then
+ cd $repodir
+ echo "Merging upstream updates of git repository stored in ${repo}..."
+ cat <(git log --reverse --pretty=format:"-- %h %s (%cr)" -4); echo -e "\e[36m"
+ output=$(git log HEAD..origin)
+ if [[ ! -z $output ]]; then
+ cat <(git log --reverse --pretty=format:"-- %h %s (%cr)" HEAD..origin); echo -e "\e[0m"
+ else
+ echo -e "-- No updates since last pull\e[0m"
+ fi
+ git merge -q origin/master
+ echo
+ fi
+ done
+}
+
+function install_dotfiles {
+ echo -e "\n*** \e[1mInstalling dotfiles\e[0m ***"
rm -rf $olddir
mkdir -p $olddir
- listFiles=`ls --ignore="make" --ignore="tex" --ignore="README.md"`
+ listFiles=`ls --ignore="make" --ignore="README.md"`
cd $dir
for file in $listFiles; do
@@ -54,49 +143,70 @@ if [[ "$install_dotfiles" -eq "1" ]]; then
mkdir -p mutt/temp
mkdir -p mutt/cache
mkdir -p mutt/cache/bodies
-fi
+}
-if [[ "$install_repos" -eq "1" ]]; then
- echo -e "\n *** Updating/Creating git repositories ***"
-
- declare -A repos
- repos[altercation]=$home/.solarized/mutt-colors-solarized
- repos[Anthony25]=$home/.solarized/gnome-terminal-colors-solarized
- repos[seebi]=$home/.solarized/dircolors-solarized
- repos[gmarik]=$home/.vim/bundle/vundle
- repos[junegunn]=$home/.nvim/vim-plug
- repos[tmux-plugins]=$home/.tmux/plugins/tpm
- repos[uvaes]=$home/git/fuzzy-zsh-marks
- repos[alols]=$home/xcape
-
- for author in "${!repos[@]}"; do
- thisDir=${repos[$author]}
- if [ ! -d $thisDir ]; then
- parentDir=`echo $thisDir | sed 's/\/[^\/]\+$//g'`
- githubDir=https://github.com/$author`echo $thisDir | sed 's/.*\(\/[^\/]\+\)$/\1/g'`
- mkdir -p $parentDir; cd $parentDir
- echo "Cloning $githubDir in $parentDir..."
- git clone -q $githubDir >> /dev/null
- else
- cd $thisDir
- echo "Updating git repository stored in $thisDir"
- git pull -q origin master >> /dev/null
- cat <(git log --pretty=format:"-- %h %s (%cr)" "ORIG_HEAD...HEAD")
- fi
+function clean {
+ echo -e "\n*** \e[1mCleaning repositories\e[0m ***"
+ for repo in "${!repodirs[@]}"; do
+ rm -rfv ${repodirs[$repo]}
done
- # Installing vim-plug vim package manager
- cd $dir/nvim
- if [ -e autoload ]; then
- rm -rf autoload
+ echo -e "\n*** \e[1mCleaning dotfiles\e[0m ***"
+ for file in `ls`; do
+ rm -rfv ~/.$file
+ done
+}
+
+function install_packages {
+ apt-get install ttyrec mutt msmtp
+}
+
+function update_dotfiles {
+ cd $dir
+ echo -e "\n*** \e[1m Updating dotfiles repository\e[0m ***"
+ git fetch -q origin master
+ cat <(git log --reverse --pretty=format:"-- %h %s (%cr)" -4); echo -e "\e[36m"
+ output=$(git log HEAD..origin)
+ if [[ ! -z $output ]]; then
+ cat <(git log --reverse --pretty=format:"-- %h %s (%cr)" HEAD..origin); echo -e "\e[0m"
+ else
+ echo -e "-- No updates since last pull\e[0m"
fi
- mkdir -p autoload
- ln -s $dir/nvim/vim-plug/plug.vim $dir/nvim/autoload/plug.vim
-fi
+}
-# Creating auxiliary files
-if [[ "$install_aux" -eq "1" ]]; then
- echo "Nothing to do for -a"
+if [[ $# = 0 ]]; then
+ update_dotfiles
+ install_dotfiles
+ update_repos
fi
-echo -e "\n*** Installation successful *** \n"
+while [[ $# > 0 ]]
+do
+ key="$1"
+ case $key in
+ -d|--dotfiles)
+ install_dotfiles
+ ;;
+ -i|--repositories)
+ install_repos
+ ;;
+ -u|--repositories)
+ update_repos
+ ;;
+ -p|--packages)
+ install_packages
+ ;;
+ -c|--clean)
+ clean
+ ;;
+ -a|--all)
+ clean
+ install_dotfiles
+ install_repos
+ update_repos
+ ;;
+ *)
+ ;;
+ esac
+ shift
+done
diff --git a/nvim/.netrwhist b/nvim/.netrwhist
index 87463a3..8e202e0 100644
--- a/nvim/.netrwhist
+++ b/nvim/.netrwhist
@@ -1,4 +1,5 @@
let g:netrw_dirhistmax =10
-let g:netrw_dirhist_cnt =2
+let g:netrw_dirhist_cnt =3
let g:netrw_dirhist_1='/home/urbain/Dropbox/phd/reports/mres'
let g:netrw_dirhist_2='/home/urbain/dotfiles/git_template/hooks'
+let g:netrw_dirhist_3='/home/urbain/bin'
diff --git a/nvimrc b/nvimrc
index 195cb6a..e087bbc 100644
--- a/nvimrc
+++ b/nvimrc
@@ -13,7 +13,7 @@ Plug 'gregsexton/gitv', { 'on' : 'Gitv' }
Plug 'honza/vim-snippets'
Plug 'itchyny/calendar.vim', { 'on' : 'Calendar' }
Plug 'jamessan/vim-gnupg', { 'for' : 'asc' }
-Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' , 'on' : 'FZF' }
+Plug 'junegunn/fzf'
Plug 'junegunn/seoul256.vim'
Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-oblique'
@@ -239,6 +239,9 @@ nnoremap <Return> o<Esc>
nnoremap <s-Return> O<Esc>
nnoremap >f :FZF ~ <cr>
+" Substitute shadowed by vim-sneak
+nnoremap _ s
+
" Git
nnoremap <Leader>gs :Gstatus<cr>
nnoremap <Leader>gr :Gread<cr>
diff --git a/vimrc b/vimrc
index 615cab0..9973b88 100644
--- a/vimrc
+++ b/vimrc
@@ -8,7 +8,6 @@ call vundle#rc()
Plugin 'gmarik/vundle'
Plugin 'airblade/vim-gitgutter'
Plugin 'altercation/vim-colors-solarized'
-Plugin 'AndrewRadev/splitjoin.vim'
Plugin 'bling/vim-airline'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'edkolev/tmuxline.vim'
diff --git a/zshrc b/zshrc
index fff7a68..8bd1407 100644
--- a/zshrc
+++ b/zshrc
@@ -93,8 +93,7 @@ bindkey -a 'j' history-beginning-search-forward
crontab ~/.crontab
TERM=xterm-256color
-[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
-source ~/git/fuzzy-zsh-marks/plugin.zsh
+source ~/github/fuzzy-zsh-marks/plugin.zsh
fancy-ctrl-z () {
@@ -108,3 +107,4 @@ fancy-ctrl-z () {
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
+[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh