diff options
Diffstat (limited to 'zsh')
-rwxr-xr-x | zsh/.zsh/aliases.zsh | 45 | ||||
-rwxr-xr-x | zsh/.zsh/keybindings.zsh | 7 | ||||
-rwxr-xr-x | zsh/.zsh/keychain.zsh | 2 | ||||
-rwxr-xr-x | zsh/.zsh/nodejs.zsh | 2 | ||||
-rw-r--r-- | zsh/.zsh/plugins.zsh | 3 | ||||
m--------- | zsh/.zsh/plugins/zsh-autosuggestions | 0 | ||||
m--------- | zsh/.zsh/plugins/zsh-history-substring-search | 0 | ||||
m--------- | zsh/.zsh/plugins/zsh-syntax-highlighting | 0 | ||||
-rw-r--r-- | zsh/.zsh/prompt.zsh | 74 |
9 files changed, 117 insertions, 16 deletions
diff --git a/zsh/.zsh/aliases.zsh b/zsh/.zsh/aliases.zsh index 8fe9d93..9ca6090 100755 --- a/zsh/.zsh/aliases.zsh +++ b/zsh/.zsh/aliases.zsh @@ -16,15 +16,13 @@ # #█▓▒░ aliases alias xyzzy="echo nothing happens" -alias ls="ls -hF --color=auto" -alias ll="ls -lahF --color=auto" -alias lsl="ls -lhF --color=auto" -alias "cd.."="cd ../" +alias ".."="cd ../" +alias "..."="cd ../.." alias up="cd ../" alias rmrf="rm -rf" alias psef="ps -ef" alias mkdir="mkdir -p" -alias cp="cp -r" +alias cp="cp -r -i" alias scp="scp -r" alias mkdir="mkdir -p" alias xsel="xsel -b" @@ -65,13 +63,46 @@ alias rustofat="toilet -t -f rustofat" alias lol="base64 </dev/urandom | lolcat" alias pacman="sudo pacman" alias update="pacman-colors && yaourt -Syua" -alias systemctl="sudo systemctl" -alias :q="sudo systemctl poweroff" +#alias systemctl="sudo systemctl" +alias dldstart="systemctl --user start aria2d.service" +alias dldstop="systemctl --user stop aria2d.service" +alias dldstatus="systemctl --user status aria2d.service" +alias dll="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana list" +alias dllw="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS watch diana list" +alias dla="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana add" +alias diana="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana" +alias dl="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana" +alias dlrm="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana remove" +alias dlrs="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana resume" +alias dlp="DIANA_SECRET_TOKEN=8NuPEM8g6O1vBf6uLyWrcdGFKkI-vBTS diana pause" +#alias :q="sudo systemctl poweroff" alias ZZ="quit" alias disks='echo "╓───── m o u n t . p o i n t s"; echo "╙────────────────────────────────────── ─ ─ "; lsblk -a; echo ""; echo "╓───── d i s k . u s a g e"; echo "╙────────────────────────────────────── ─ ─ "; df -h;' alias todo="bash ~/code/sys/todo" alias record="ffmpeg -f x11grab -s 1366x768 -an -r 16 -loglevel quiet -i :0.0 -b:v 5M -y" #pass a filename alias nexus="jmtpfs ~/nexus" +alias df='df -h' # Human-readable sizes +alias free='free -m' # Show sizes in MB +alias off='poweroff' # +alias fixit='sudo rm -f /var/lib/pacman/db.lck' +alias inst='sudo pacman -S' +alias mirrors='sudo pacman-mirrors -g' +alias update='yaourt -Syua' +alias printer='system-config-printer' +alias la='ls -lah --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' +alias ll='ls -lh --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' +alias l='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' +alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' +alias cal='cal -m' +alias bat="upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep 'percentage:' | awk '{print $2}'" +alias t="task" +alias ts="task sync" +alias tcal="task calendar" +alias ga="git add" +alias gcmsg='git commit -m' +alias gst='git status' +alias rl='source ~/.zsh/aliases.zsh' + #█▓▒░ dumb tmux trix alias tsad="printf '\033k┐(T_T)┌\033\\'" diff --git a/zsh/.zsh/keybindings.zsh b/zsh/.zsh/keybindings.zsh index 2f80417..48797e1 100755 --- a/zsh/.zsh/keybindings.zsh +++ b/zsh/.zsh/keybindings.zsh @@ -49,3 +49,10 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then zle -N zle-line-init zle -N zle-line-finish fi + +# Navigate words with ctrl+arrow keys +bindkey '^[Oc' forward-word # +bindkey '^[Od' backward-word # +bindkey '^[[1;5D' backward-word # +bindkey '^[[1;5C' forward-word # + diff --git a/zsh/.zsh/keychain.zsh b/zsh/.zsh/keychain.zsh index aee1aca..630ee9b 100755 --- a/zsh/.zsh/keychain.zsh +++ b/zsh/.zsh/keychain.zsh @@ -18,4 +18,4 @@ export SSH_KEY_PATH="~/.ssh/id_rsa" #█▓▒░ funtoo keychain -eval `keychain -q --eval ~/.ssh/id_rsa` +eval `keychain -q --eval ~/.ssh/id_rsa_mail` diff --git a/zsh/.zsh/nodejs.zsh b/zsh/.zsh/nodejs.zsh index fb762b5..4f95e1e 100755 --- a/zsh/.zsh/nodejs.zsh +++ b/zsh/.zsh/nodejs.zsh @@ -15,7 +15,7 @@ # ░░░░░░░░░░ # #█▓▒░ node version manager -source ~/.nvm/nvm.sh +#source ~/.nvm/nvm.sh #█▓▒░ aliases alias node="sudo node" diff --git a/zsh/.zsh/plugins.zsh b/zsh/.zsh/plugins.zsh new file mode 100644 index 0000000..5519c2c --- /dev/null +++ b/zsh/.zsh/plugins.zsh @@ -0,0 +1,3 @@ +source ~/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh +source ~/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +source ~/.zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh diff --git a/zsh/.zsh/plugins/zsh-autosuggestions b/zsh/.zsh/plugins/zsh-autosuggestions new file mode 160000 +Subproject fedc22e9bbd046867860e772d7d6787f5dae9d4 diff --git a/zsh/.zsh/plugins/zsh-history-substring-search b/zsh/.zsh/plugins/zsh-history-substring-search new file mode 160000 +Subproject aae3388491c2312c4efb2e86bcb999927bb2900 diff --git a/zsh/.zsh/plugins/zsh-syntax-highlighting b/zsh/.zsh/plugins/zsh-syntax-highlighting new file mode 160000 +Subproject ad522a091429ba180c930f84b2a023b40de4dbc diff --git a/zsh/.zsh/prompt.zsh b/zsh/.zsh/prompt.zsh index 4203929..cf1b525 100644 --- a/zsh/.zsh/prompt.zsh +++ b/zsh/.zsh/prompt.zsh @@ -13,21 +13,69 @@ # ░▓ mirror ▓ http://git.io/.files # ░▓▓▓▓▓▓▓▓▓▓ # ░░░░░░░░░░ +autoload -U compinit colors zcalc +compinit -d +colors -#ICO_DIRTY="⚡" +ICO_DIRTY="⚡" #ICO_DIRTY="↯" -ICO_DIRTY="*" -#ICO_AHEAD="↑" -ICO_AHEAD="🠙" +#ICO_DIRTY="*" +ICO_AHEAD="↑" +#ICO_AHEAD="🠙" #ICO_AHEAD="▲" -#ICO_BEHIND="↓" -ICO_BEHIND="🠛" +ICO_BEHIND="↓" +#ICO_BEHIND="🠛" #ICO_BEHIND="▼" ICO_DIVERGED="⥮" COLOR_ROOT="%F{red}" COLOR_USER="%F{cyan}" COLOR_NORMAL="%F{white}" PROMPT_STYLE="classic" +# Modify the colors and symbols in these variables as desired. +GIT_PROMPT_SYMBOL="%{$fg[blue]%}±" # plus/minus - clean repo +GIT_PROMPT_PREFIX="%{$fg[green]%} %{$reset_color%}" +GIT_PROMPT_SUFFIX="%{$fg[green]%}%{$reset_color%}" +GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}" # A"NUM" - ahead by "NUM" commits +GIT_PROMPT_BEHIND="%{$fg[cyan]%}BNUM%{$reset_color%}" # B"NUM" - behind by "NUM" commits +GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡%{$reset_color%}" # lightning bolt - merge conflict +GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}" # red circle - untracked files +GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●%{$reset_color%}" # yellow circle - tracked files modified +GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}" # green circle - staged changes present = ready for "git push" + +parse_git_branch() { + # Show Git branch/tag, or name-rev if on detached head + ( git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD ) 2> /dev/null +} + +parse_git_state() { + # Show different symbols as appropriate for various Git repository states + # Compose this value via multiple conditional appends. + local GIT_STATE="" + local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')" + if [ "$NUM_AHEAD" -gt 0 ]; then + GIT_STATE=$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD} + fi + local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')" + if [ "$NUM_BEHIND" -gt 0 ]; then + GIT_STATE=$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND} + fi + local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)" + if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then + GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING + fi + if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED + fi + if ! git diff --quiet 2> /dev/null; then + GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED + fi + if ! git diff --cached --quiet 2> /dev/null; then + GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED + fi + if [[ -n $GIT_STATE ]]; then + echo "$GIT_PROMPT_PREFIX$GIT_STATE$GIT_PROMPT_SUFFIX" + fi +} #█▓▒░ allow functions in the prompt @@ -42,6 +90,17 @@ else # root! USER_LEVEL="${COLOR_ROOT}" fi +git_prompt_string() { + local git_where="$(parse_git_branch)" + + # If inside a Git repository, print its branch and state + [ -n "$git_where" ] && echo "$GIT_PROMPT_SYMBOL$(parse_git_state)$GIT_PROMPT_PREFIX%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX" + + # If not inside the Git repo, print exit codes of last command (only if it failed) + [ ! -n "$git_where" ] && echo "%{$fg[red]%}%(?..%?)" +} + + #█▓▒░ git prompt GIT_PROMPT() { test=$(git rev-parse --is-inside-work-tree 2> /dev/null) @@ -116,6 +175,7 @@ ${USER_LEVEL}└─ - %f' ;; #█▓▒░ classic *) -PROMPT='${USER_LEVEL}[${COLOR_NORMAL}%~${USER_LEVEL}]$(GIT_PROMPT)── - %f' +PROMPT='%F{cyan}┌─[$USER@$HOST]─[$(git_prompt_string)${USER_LEVEL}]─[${COLOR_NORMAL}%~${USER_LEVEL}] +└─ - %f' ;; esac |