Last active
May 2, 2016 11:22
-
-
Save fmarcia/e1cfe6d847418a42b086 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prompt | |
autoload -Uz promptinit; promptinit | |
setopt promptsubst | |
PS1=$'%B%n@%M:%~ $ %b' | |
PS2=' > ' | |
# history | |
setopt sharehistory histignorealldups appendhistory | |
HISTFILE=~/.histfile | |
HISTSIZE=9999 | |
SAVEHIST=9999 | |
# completion | |
autoload -Uz compinit; compinit | |
zstyle ':completion:*' menu select | |
zstyle ':completion:*' list-colors "${(s.:.)LSCOLORS}" | |
setopt extendedglob | |
# key bindings | |
# $(showkey -a) to view keys | |
# commands: bolyai.cs.elte.hu/zsh-manual/zsh_14.html | |
bindkey -e | |
bindkey "^[[1;5D" backward-word # Ctrl + Left | |
bindkey "^[[1;5C" forward-word # Ctrl + Right | |
bindkey '^[[A' up-line-or-search # Up | |
bindkey '^[[B' down-line-or-search # Down | |
bindkey '^[[H' beginning-of-line # Home | |
bindkey '^[OH' beginning-of-line # Home | |
bindkey '^[[F' end-of-line # End | |
bindkey '^[OF' end-of-line # End | |
bindkey '^[[2~' delete-char # Delete | |
bindkey '^[[3~' delete-char # Delete | |
bindkey '^[[1;5H' beginning-of-history # Ctrl + Home | |
bindkey '^[[1;5F' end-of-history # Ctrl + End | |
# window's title update | |
precmd() { | |
local replacement | |
if [ "$USER" = "root" ]; then | |
replacement="/root" | |
else | |
replacement="/home/$USER" | |
fi | |
local titlepath=$(pwd | sed "s|$replacement|~|") | |
print -Pn "\e]0;$USER@$HOST:$titlepath\a" | |
} | |
# colors and formats | |
if [ -x /usr/bin/dircolors ]; then | |
dircolors -b > /dev/null | |
fi | |
alias grep='grep --color=auto' | |
alias ls='ls --color=auto --time-style=long-iso --human-readable --group-directories-first' | |
# sudo | |
alias sudo='sudo ' | |
# systemd | |
alias d-enable='sudo systemctl enable' | |
alias d-start='sudo systemctl start' | |
alias d-restart='sudo systemctl restart' | |
alias d-reload='sudo systemctl reload' | |
alias d-stop='sudo systemctl stop' | |
alias d-status='systemctl status' | |
alias d-log='journalctl -e -u' | |
alias d-logext='journalctl -xe -u' | |
alias d-live='journalctl -f -u' | |
alias d-disable='sudo systemctl disable' | |
alias d-failed='systemctl --failed --all' | |
alias d-services='systemctl list-units --type=service' | |
alias d-timers='systemctl list-timers --all' | |
alias d-reboot='systemctl reboot' | |
# pacman | |
alias p-update='sudo pacman -Syu' | |
alias p-install='sudo pacman -S' | |
alias p-build='makepkg -s' | |
alias p-local='sudo pacman -U' | |
alias p-clean-cache='sudo pacman -Sc' | |
alias p-clean-pkg='sudo pacman -Rns $(pacman -Qdtq)' | |
alias p-repo='pacman -Qen' | |
alias p-aur='pacman -Qem' | |
alias p-pkg='pacman -Qo' | |
alias p-info='pacman -Qi' | |
alias p-files='pacman -Ql' | |
alias p-search='pacman -Ss' | |
alias p-remove='sudo pacman -Rcns' | |
function p-news { | |
IFS=\> | |
local DATE | |
local TITLE | |
while read -d \< TAG DATA; do | |
if [ "$TAG" = "pubDate" ]; then | |
DATE=$(date -d"$DATA" +'%Y/%m/%d') | |
elif [ "$TAG" = "title" ]; then | |
TITLE=$DATA | |
fi | |
if [ ! -z $DATE ] && [ ! -z $TITLE ]; then | |
echo "$DATE $TITLE" | |
DATE= | |
TITLE= | |
fi | |
done < <(curl -s "https://www.archlinux.org/feeds/news/") | |
} | |
# list | |
alias l='ls -l' | |
alias l-='ls -lr' | |
alias d='ls -lt' | |
alias d-='ls -ltr' | |
alias a='ls -lA' | |
alias a-='ls -lAr' | |
alias s='ls -lS' | |
alias s-='ls -lSr' | |
# cd up | |
alias ..='cd ..' | |
alias ...='cd ../..' | |
alias ....='cd ../../..' | |
alias .....='cd ../../../..' | |
alias ......='cd ../../../../..' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment