aboutsummaryrefslogtreecommitdiffstats
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.zprofile5
-rw-r--r--zsh/.zshrc2
-rw-r--r--zsh/aliases.zsh79
-rw-r--r--zsh/completion/_5c4
-rw-r--r--zsh/completion/_5v4
-rw-r--r--zsh/completion/_aur4
-rw-r--r--zsh/profile-leeloo8
-rw-r--r--zsh/profile-macer5
-rw-r--r--zsh/profile-zorg21
-rw-r--r--zsh/prompt.zsh20
10 files changed, 127 insertions, 25 deletions
diff --git a/zsh/.zprofile b/zsh/.zprofile
index b4a6a5a..653b8ad 100644
--- a/zsh/.zprofile
+++ b/zsh/.zprofile
@@ -38,8 +38,11 @@ export SUDO_PROMPT=$'\e[31mSUDO\e[m password for \e[34m%p\e[m: '
export SHORTHOST=$(hostname -s)
+# Don’t use the default venv prompt in favor of our custom one
export VIRTUAL_ENV_DISABLE_PROMPT=1
+export FIGLET_FONTDIR="$HOME"/.local/share/figlet
+
if [[ -f "$ZDOTDIR"/profile-"$SHORTHOST" ]]; then
source "$ZDOTDIR"/profile-"$SHORTHOST"
fi
@@ -48,5 +51,5 @@ fi
source <(dircolors -b "$XDG_CONFIG_HOME"/dircolors)
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then
- exec startx "$XDG_CONFIG_HOME"/X11/xinitrc
+ exec startx "$XDG_CONFIG_HOME"/X11/xinitrc -- -configdir "$XDG_CONFIG_HOME"/X11/xorg.conf.d
fi
diff --git a/zsh/.zshrc b/zsh/.zshrc
index d61bafb..2e628c8 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -9,6 +9,8 @@ zstyle ':completion:*' menu select
zstyle ':completion:*' use-cache on
zstyle ':completion:*' rehash yes
+fpath=("$ZDOTDIR"/completion "${fpath[@]}")
+
autoload -Uz colors \
compinit \
promptinit \
diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh
index b828a71..ebe3481 100644
--- a/zsh/aliases.zsh
+++ b/zsh/aliases.zsh
@@ -24,6 +24,8 @@ alias ms5='mbsync --config "$XDG_CONFIG_HOME/mbsyncrc" 5monkeys'
alias msa='mbsync --config "$XDG_CONFIG_HOME/mbsyncrc" -a'
alias ty='ttytter -rc="$XDG_CONFIG_HOME"/ttytter/ttytterrc'
+alias pt='pstree --highlight-all --long --uid-changes'
+
alias sprin='curl -F "sprunge=<-" http://sprunge.us'
sprfile() {
curl -F "sprunge=<$1" http://sprunge.us
@@ -73,31 +75,82 @@ if have systemctl && [[ -d /run/systemd/system ]]; then
fi
function 5v {
- if [[ -d "$HOME"/5/venvs/"$1" ]]; then
- source "$HOME"/5/venvs/"$1"/bin/activate
+ if [[ -d "$HOME"/venvs/"$1" ]]; then
+ source "$HOME"/venvs/"$1"/bin/activate
printf "\x1b[38;5;2m==> 5venv ‘%s’ activated successfully.\x1b[0m\n" "$1"
+
else
printf "==> 5venv ‘%s’ not found\n" "$1"
printf "==> Create? [yN]: "
read yn
+
if [[ "$yn" == 'y' || "$yn" == 'yes' ]]; then
- virtualenv-2.7 "$HOME"/5/venvs/"$1"
- if (( $? == 0 )); then
- print "\x1b[38;5;2m==> 5venv created successfully, installing basic requirements.\x1b[0m"
+ printf "==> Python version? [23]: "
+ read venvver
+
+ if [[ "$venvver" == '2' ]]; then
+ virtualenv2 "$HOME"/venvs/"$1"
+ if (( $? == 0 )); then
+ print "\x1b[38;5;2m==> 5venv created successfully, installing basic requirements.\x1b[0m"
+ else
+ print "\x1b[38;5;1m==> Error: 5env creation failed. Exiting.\x1b[0m"
+ return 1
+ fi
+ source "$HOME"/venvs/"$1"/bin/activate
+ pip install -r "$HOME"/venvs/5_requirements.txt
+
+ elif [[ "$venvver" == '3' ]]; then
+ virtualenv3 "$HOME"/venvs/"$1"
+ if (( $? == 0 )); then
+ print "\x1b[38;5;2m==> 5venv created successfully, activating environment.\x1b[0m"
+ print "==> Note that no requirements were installed due to version 3 was selected."
+ else
+ print "\x1b[38;5;1m==> Error: 5env creation failed. Exiting.\x1b[0m"
+ return 1
+ fi
+ source "$HOME"/venvs/"$1"/bin/activate
+
else
- print "\x1b[38;5;1m==> Error: 5env creation failed. Exiting.\x1b[0m"
- return 1
+ printf "==> virtualenv for version ‘%s’ not found.\n" "$venvver"
+ exit 1
fi
- source "$HOME"/5/venvs/"$1"/bin/activate
- pip install -r "$HOME"/5/venvs/5_requirements.txt
fi
fi
}
function 5c {
- if [[ -n "$1" ]]; then
- cd "$HOME"/5/code/"$1"
- else
- cd "$HOME"/5/code
+ cd "$HOME"/projects/"$1"
+}
+
+function 5clone {
+ if [[ -z "$1" ]]; then
+ print "No repo name"
+ fi
+
+ (cd "$HOME"/projects
+ git clone git@github.com:5m/"$1"
+ shift
+ cd -)
+
+ pushd "$HOME"/projects/"$1"
+ git config --local user.email johannes@5monkeys.se
+}
+
+alias 5ssh='TERM=xterm ssh'
+
+aur-push() {
+ git push aur@aur.archlinux.org:/"$1".git "$1":master
+}
+
+aur-pull() {
+ local old_branch=$(git symbolic-ref --short HEAD)
+ git checkout "$1"
+ git pull aur@aur.archlinux.org:/"$1".git master:"$1"
+ git checkout "$old_branch"
+}
+
+tt() {
+ if [[ -n "$@" ]]; then
+ print "$@" | ts '[%Y-%m-%d %H:%M:%S]' >> "$HOME"/documents/timetracking
fi
}
diff --git a/zsh/completion/_5c b/zsh/completion/_5c
new file mode 100644
index 0000000..5f309c7
--- /dev/null
+++ b/zsh/completion/_5c
@@ -0,0 +1,4 @@
+#compdef 5c
+
+_arguments \
+ "1: :($(print $HOME/projects/*(/) | xargs -n1 basename))"
diff --git a/zsh/completion/_5v b/zsh/completion/_5v
new file mode 100644
index 0000000..659bb1a
--- /dev/null
+++ b/zsh/completion/_5v
@@ -0,0 +1,4 @@
+#compdef 5v
+
+_arguments \
+ "1: :($(print $HOME/venvs/*(/) | xargs -n1 basename))"
diff --git a/zsh/completion/_aur b/zsh/completion/_aur
new file mode 100644
index 0000000..83a359c
--- /dev/null
+++ b/zsh/completion/_aur
@@ -0,0 +1,4 @@
+#compdef aur-push aur-pull
+
+_arguments \
+ "1: :($(git for-each-ref --format='%(refname:short)' refs/heads))"
diff --git a/zsh/profile-leeloo b/zsh/profile-leeloo
index b37ac81..be9ae1a 100644
--- a/zsh/profile-leeloo
+++ b/zsh/profile-leeloo
@@ -1,8 +1,9 @@
if (( UID )); then
- export LD_PRELOAD="$HOME"/.local/lib/libwcwidth.so
+ if [[ -x "$HOME"/.local/lib/libwcwidth.so ]]; then
+ export LD_PRELOAD="$HOME"/.local/lib/libwcwidth.so
+ fi
export PERL5LIB="$HOME"/misc/grawity/code/lib/perl5"${PERL5LIB+:}$PERL5LIB";
- source <(perl -Mlocal::lib="$HOME"/.local)
function {
local envfile="$XDG_RUNTIME_DIR"/ssh-agent.env
@@ -16,6 +17,9 @@ if (( UID )); then
}
source "$HOME"/misc/grawity/code/kerberos/kc.sh
+
+ export MAILDIR="$HOME"/mail
+ export MANPATH="$(manpath)":"$HOME"/.local/share/man
fi
# vim: ft=zsh
diff --git a/zsh/profile-macer b/zsh/profile-macer
deleted file mode 100644
index 4d3e7fe..0000000
--- a/zsh/profile-macer
+++ /dev/null
@@ -1,5 +0,0 @@
-export PATH=/usr/local/bin:/usr/local/sbin:"$HOME"/Library/Haskell/bin:"$PATH"
-
-# path to GNU coreutils without g prefix
-export PATH=/usr/local/opt/coreutils/libexec/gnubin:"$PATH"
-export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
diff --git a/zsh/profile-zorg b/zsh/profile-zorg
new file mode 100644
index 0000000..0a19020
--- /dev/null
+++ b/zsh/profile-zorg
@@ -0,0 +1,21 @@
+if (( UID )); then
+ if [[ -x "$HOME"/.local/lib/libwcwidth.so ]]; then
+ export LD_PRELOAD="$HOME"/.local/lib/libwcwidth.so
+ fi
+
+ function {
+ local envfile="$XDG_RUNTIME_DIR"/ssh-agent.env
+ local pid=$(awk -F'[=;]' 'FNR == 2 {print $2}' "$envfile" 2>/dev/null)
+ if [[ -n "$pid" ]] && kill -0 "$pid" &>/dev/null; then
+ source "$envfile" >/dev/null
+ else
+ ssh-agent > "$envfile"
+ source "$envfile" >/dev/null
+ fi
+ }
+
+ export MAILDIR="$HOME"/mail
+ export MANPATH="$(manpath)":"$HOME"/.local/share/man
+fi
+
+# vim: ft=zsh
diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh
index 67e17b4..c83b2da 100644
--- a/zsh/prompt.zsh
+++ b/zsh/prompt.zsh
@@ -1,3 +1,4 @@
+# Red
bg[light_pink]='%K{001}'
bg[light_red]='%K{196}'
bg[red]='%K{88}'
@@ -9,6 +10,7 @@ fg[red]='%F{88}'
fg[dark_red]='%F{52}'
+# Yellow
bg[light_gold]='%K{136}'
bg[gold]='%K{139}'
bg[dark_gold]='%K{94}'
@@ -18,12 +20,17 @@ fg[gold]='%F{139}'
fg[dark_gold]='%F{94}'
+# Blue
bg[light_blue]='%K{blue}'
bg[blue]='%K{21}'
fg[light_blue]='%F{blue}'
fg[blue]='%F{21}'
+
+# Green
+bg[dark_green]='%K{64}'
+
function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then
print "$bg[light_blue]$fg[white] $(basename $VIRTUAL_ENV) %f%k"
@@ -32,23 +39,28 @@ function virtualenv_prompt {
if (( UID == 0 )); then
PROMPT='$bg[light_red] $fg[white]%m%f %k$bg[white]$fg[light_red] %~ %f%k$(virtualenv_prompt)
-$bg[light_blue]%B ^_^ %b%k '
+$bg[light_blue] λ %k '
else
case $SHORTHOST in
"theos")
PROMPT='$bg[light_pink] $fg[white]%m%f %k$bg[white]$fg[light_pink] %~ %f%k$(virtualenv_prompt)
-$bg[light_blue]%B ^_^ %b %k'
+$bg[light_blue] λ %k '
;;
"lucifer")
PROMPT='$bg[dark_gold] $fg[white]%m%f %k$bg[white]$fg[dark_gold] %~ %f%k$(virtualenv_prompt)
-$bg[light_blue]%B ^_^ %b %k'
+$bg[light_blue] λ %k '
+ ;;
+
+ "nymeria")
+ PROMPT='$bg[dark_green] $fg[white]%m%f %k$bg[white]$fg[dark_gold] %~ %f%k$(virtualenv_prompt)
+$bg[light_blue] λ %k '
;;
*)
PROMPT='$bg[black] $fg[white]%m%f %k$bg[white]$fg[black] %~ %f%k$(virtualenv_prompt)
-$bg[light_blue]%B ^_^ %b %k'
+$bg[light_blue] λ %k '
;;
esac