summaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2016-03-10 14:29:06 +0000
committerUrbain Vaes <urbain@vaes.uk>2016-03-10 14:29:06 +0000
commit3446f5387389b0e1671481c8a8fb9ea0eed519f6 (patch)
tree543bde435847c700507c3b229460b446f4a09028 /zsh
parentc9f80e43f431d89bbccd1ecc68c7b48fb8c01dd4 (diff)
Remove . from dotfiles for convenience
Diffstat (limited to 'zsh')
-rw-r--r--zsh/aliases27
-rw-r--r--zsh/functions25
-rw-r--r--zsh/plugins51
-rw-r--r--zsh/zshrc52
4 files changed, 155 insertions, 0 deletions
diff --git a/zsh/aliases b/zsh/aliases
new file mode 100644
index 0000000..fbb2b2f
--- /dev/null
+++ b/zsh/aliases
@@ -0,0 +1,27 @@
+#!/bin/zsh
+
+# Commands
+alias c='clear'
+alias ca='printf "\ec"'
+alias cdd='cd ~/dotfiles'
+alias notes='vim ~/dotfiles/.notes'
+
+# Programs
+alias a='vifm . .'
+alias ff='FreeFem++'
+alias g='git'
+alias l='ledger -f ~/dotfiles/.ledger/perso.ledger'
+alias lj='vim ~/dotfiles/.ledger/perso.ledger'
+alias m='cd ~/.mutt/attachments && mutt && cd -'
+alias n='newsbeuter'
+alias v='vim'
+alias vims="vim -S Session.vim"
+alias vimtex='vim -S Session.vim --servername SYNC'
+
+# Build
+alias mc='make clean'
+alias mca='make clean-all'
+
+# Tmux
+alias son="tmux set -g status on"
+alias soff="tmux set -g status off"
diff --git a/zsh/functions b/zsh/functions
new file mode 100644
index 0000000..2b43e1a
--- /dev/null
+++ b/zsh/functions
@@ -0,0 +1,25 @@
+#!/bin/zsh
+
+function colo {
+
+ # Change colors for current session
+ $HOME/bin/recolor < ~/.Xresources/$1
+
+ # Load Xresources file for future sessions
+ xrdb ~/.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" ~/.zsh/tmp
+}
+
+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/plugins b/zsh/plugins
new file mode 100644
index 0000000..116c694
--- /dev/null
+++ b/zsh/plugins
@@ -0,0 +1,51 @@
+#! /bin/zsh
+
+# 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/archlinux
+ 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
+
+ # Navigation plugins
+ zgen load uvaes/fzf-marks
+
+ # Other plugins
+ zgen load rupa/z
+ zgen load djui/alias-tips
+ zgen load tarruda/zsh-autosuggestions
+ zgen load joel-porquet/zsh-dircolors-solarized
+
+ # Save all to init script
+ zgen save
+fi
+
+# Plugins configuration
+
+# Autosuggestion
+{
+ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
+ bindkey '^y' autosuggest-accept
+}
+
+# Z
+export _Z_EXCLUDE_DIRS=("$HOME/sshfs", "$HOME/nfs")
diff --git a/zsh/zshrc b/zsh/zshrc
new file mode 100644
index 0000000..22860cd
--- /dev/null
+++ b/zsh/zshrc
@@ -0,0 +1,52 @@
+# Write tmp file if it doesn't exist
+[[ ! -f ~/.zsh/tmp ]] && echo "export COLORSCHEME=dark" > ~/.zsh/tmp
+
+# Source configuration files
+source "$HOME/.zsh/plugins"
+source "$HOME/.zsh/functions"
+source "$HOME/.zsh/aliases"
+source "$HOME/.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:/usr/bin/core_perl:/home/urbain/bin"
+
+# Editor
+export EDITOR=/usr/bin/vim
+
+# 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