diff options
Diffstat (limited to '.zsh')
-rw-r--r-- | .zsh/zsh-aliases | 54 | ||||
-rw-r--r-- | .zsh/zsh-functions | 31 | ||||
-rw-r--r-- | .zsh/zsh-plugins | 59 | ||||
-rw-r--r-- | .zsh/zsh-tmp | 1 | ||||
-rw-r--r-- | .zsh/zshrc | 77 |
5 files changed, 222 insertions, 0 deletions
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..26b5726 --- /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/.grmrc +} 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 diff --git a/.zsh/zshrc b/.zsh/zshrc new file mode 100644 index 0000000..c891760 --- /dev/null +++ b/.zsh/zshrc @@ -0,0 +1,77 @@ +ZSH_PLUGINS="$HOME/.zsh/zsh-plugins" +ZSH_ALIASES="$HOME/.zsh/zsh-aliases" +ZSH_TMP="$HOME/.zsh/zsh-tmp" + +# Source configurations +source $ZSH_PLUGINS +source $ZSH_ALIASES +source $ZSH_TMP + +# Custom key bindings for built-in widgets +bindkey -a 'k' history-beginning-search-backward +bindkey -a 'j' history-beginning-search-forward +bindkey '^P' history-beginning-search-backward +bindkey '^N' history-beginning-search-forward + +# Paths of executables +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" +export PATH="$PATH:/home/urbain/.local/bin" + +# Editor +export EDITOR=/usr/bin/nvim + +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"' +} + +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=light + +# Change default environment variable for future sessions +sed -i --follow-symlinks "s/^export COLORSCHEME=.*$/export COLORSCHEME=$1/g" ~/dotfiles/zshrc +} + +# Fix tmux colors +if [[ -n ${TMUX} && -n ${commands[tmux]} ]];then + case $(tmux showenv TERM 2>/dev/null) in + *256color) ;& + TERM=fbterm) + TERM=screen-256color ;; + *) + TERM=screen + esac +fi + +# Export GPG-agent related +if [[ -f "${HOME}/.gpg-agent-info" ]]; then + source /home/urbain/.gpg-agent-info + export GPG_AGENT_INFO + export SSH_AUTH_SOCK +fi + + +# Tmux colors fix +if [[ -n ${TMUX} && -n ${commands[tmux]} ]];then + case $(tmux showenv TERM 2>/dev/null) in + *256color) ;& + TERM=fbterm) + TERM=screen-256color ;; + *) + TERM=screen + esac +fi + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh |