From b8a9b07b741cddbf6e0476e70c94aa186d62b6ae Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Sat, 8 Aug 2015 17:42:24 +0200 Subject: Separate zsh aliases and plugins --- zsh/zsh-aliases | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ zsh/zsh-functions | 31 +++++++++++++++++++++++++++++ zsh/zsh-plugins | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ zsh/zsh-tmp | 1 + 4 files changed, 145 insertions(+) create mode 100644 zsh/zsh-aliases create mode 100644 zsh/zsh-functions create mode 100644 zsh/zsh-plugins create mode 100644 zsh/zsh-tmp (limited to 'zsh') diff --git a/zsh/zsh-aliases b/zsh/zsh-aliases new file mode 100644 index 0000000..9d2dbe6 --- /dev/null +++ b/zsh/zsh-aliases @@ -0,0 +1,54 @@ +# Apps for filetypes +alias -s vim=$EDITOR +alias -s cpp=$EDITOR +alias -s c=$EDITOR +alias -s tex=$EDITOR +alias -s pdf=zathura + +# Directories +alias books='cd ~/Dropbox/phd/books' +alias cdd='cd ~/dotfiles' +alias papers='cd ~/Dropbox/phd/papers' +alias report='cd ~/Dropbox/phd/reports/9\ months' +alias u='cd ~/Dropbox/phd' +alias uc='cd ~/Dropbox/phd/programs' +alias ul='cd ~/Dropbox/phd/literature' +alias up='cd ~/Dropbox/phd/presentations' +alias ur='cd ~/Dropbox/phd/reports' + +# Commands +alias a='vifm' +alias c='clear' +alias ca='printf "\ec"' +alias commit='git commit -a -m' +alias g='git' +alias install='sudo apt-get install' +alias m='mutt' +alias mail='offlineimap -u quiet &' +alias mc='make clean' +alias mca='make clean-all' +alias n='nvim' +alias ns="$EDITOR -S Session.vim" +alias pull='git pull origin master' +alias push='git push origin master' +alias pushs='git push --recurse-submodules=check' +alias update='sudo apt-get update' +alias upgrade='sudo apt-get upgrade' +alias v='vim' +alias x='sh ~/.xmodmap' +alias youtube=mpsyt + +# Configuration +alias em="$EDITOR ~/.mutt/muttrc" +alias en="$EDITOR ~/.nvimrc" +alias eo="$EDITOR ~/.offlineimaprc" +alias et="$EDITOR ~/.tmux.conf" +alias ev="$EDITOR ~/.vimrc" +alias evi="$EDITOR ~/.vifm/vifmrc" +alias ex="$EDITOR ~/.xmodmap" +alias ez="$EDITOR ~/.zshrc" +alias eza="$EDITOR ~/.zathurarc" + +# Tmux +alias son="tmux set -g status on" +alias soff="tmux set -g status off" diff --git a/zsh/zsh-functions b/zsh/zsh-functions new file mode 100644 index 0000000..f9f387d --- /dev/null +++ b/zsh/zsh-functions @@ -0,0 +1,31 @@ +function colo { + + # Change colors for current session + $HOME/.bin/recolor.sh < ~/.Xresources/Xresources.$1 + + # Load Xresources file for future sessions + xrdb ~/.Xresources/Xresources.$1 + + # Change environment variable + export COLORSCHEME=$1 + + # Change default environment variable for future sessions + sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/dotfiles/zshrc +} + +z() { + if [[ -z "$*" ]]; then + cd "$(_z -l 2>&1 | fzf-tmux +s --tac | sed 's/^[0-9,.]* *//')" + else + _z "$@" + fi +} + +fshow() { + git log --graph --color=always \ + --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | + fzf --ansi --no-sort --reverse --tiebreak=index --toggle-sort=\` \ + --bind 'ctrl-m:execute: + echo {} | grep -o "[a-f0-9]\{7\}" | + xargs -I % sh -c "git show --color=always % | less -R"' +} diff --git a/zsh/zsh-plugins b/zsh/zsh-plugins new file mode 100644 index 0000000..23e94cc --- /dev/null +++ b/zsh/zsh-plugins @@ -0,0 +1,59 @@ +# Load zgen +source "/home/urbain/.zgen/zgen.zsh" + +# Load plugins +if ! zgen saved; then + + echo "Creating a zgen save" + + # Load oh-my-zsh framework + zgen oh-my-zsh + + # Oh-my-zsh plugins + zgen oh-my-zsh plugins/git + zgen oh-my-zsh plugins/vi-mode + zgen oh-my-zsh plugins/ubuntu + zgen oh-my-zsh plugins/tmux + zgen oh-my-zsh plugins/themes + + # zsh-users plugins + zgen load zsh-users/zsh-completions src + zgen load zsh-users/zsh-syntax-highlighting + + # Appearance + zgen oh-my-zsh themes/eastwood + + # My plugins + zgen load uvaes/fzf-marks + zgen load uvaes/grm + + # Other plugins + zgen load rupa/z + zgen load djui/alias-tips + zgen load tarruda/zsh-autosuggestions + zgen load Tarrasch/zsh-autoenv + zgen load joel-porquet/zsh-dircolors-solarized + + # Save all to init script + zgen save +fi + +# Plugin configuration + +# Autosuggestion +{ + # Environment variables for plugins + AUTOSUGGESTION_HIGHLIGHT_COLOR='fg=6' + + zle-line-init() { + zle autosuggest-start + } + zle -N zle-line-init + + bindkey '^y' autosuggest-execute-suggestion +} + +# GRM +{ + REPOFILE=/home/urbain/dotfiles/repos.zsh +} diff --git a/zsh/zsh-tmp b/zsh/zsh-tmp new file mode 100644 index 0000000..a5abbce --- /dev/null +++ b/zsh/zsh-tmp @@ -0,0 +1 @@ +export COLORSCHEME=light -- cgit v1.2.3