Browse Source

Merge branch 'main' of git.fishoeder.net:nokogiri/dotfiles

main
Michael Pappe 10 months ago
parent
commit
1596e03f2a
  1. 1494
      .config/zsh/.p10k-linux.zsh
  2. 199
      .config/zsh/.p10k-x11.zsh
  3. 1580
      .config/zsh/.p10k.zsh
  4. 15
      .config/zsh/.zprofile
  5. 29
      .config/zsh/.zshenv
  6. 57
      .config/zsh/.zshrc
  7. 5
      .config/zsh/10_env.zsh
  8. 1
      .config/zsh/11_pathss.zsh
  9. 30
      .config/zsh/40_functions.zsh
  10. 97
      .config/zsh/50_aliases.zsh
  11. 161
      .config/zsh/90_alias.zsh
  12. 307
      .config/zsh/90_settings.zsh
  13. 82
      .config/zsh/91_abbr.zsh
  14. 1
      .config/zsh/init/bin
  15. 1
      .config/zsh/zinit/bin

1494
.config/zsh/.p10k-linux.zsh

File diff suppressed because it is too large

199
.config/zsh/.p10k-x11.zsh

@ -1,199 +0,0 @@
# Generated by Powerlevel10k configuration wizard on 2020-08-08 at 23:12 CEST.
# Based on romkatv/powerlevel10k/config/p10k-pure.zsh, checksum 52737.
# Wizard options: nerdfont-complete + powerline, small icons, pure, snazzy, rpromt,
# 2 lines, compact, transient_prompt, instant_prompt=quiet.
# Type `p10k configure` to generate another config.
#
# Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure).
#
# Differences from Pure:
#
# - Git:
# - `@c4d3ec2c` instead of something like `v1.4.0~11` when in detached HEAD state.
# - No automatic `git fetch` (the same as in Pure with `PURE_GIT_PULL=0`).
#
# Apart from the differences listed above, the replication of Pure prompt is exact. This includes
# even the questionable parts. For example, just like in Pure, there is no indication of Git status
# being stale; prompt symbol is the same in command, visual and overwrite vi modes; when prompt
# doesn't fit on one line, it wraps around with no attempt to shorten it.
#
# If you like the general style of Pure but not particularly attached to all its quirks, type
# `p10k configure` and pick "Lean" style. This will give you slick minimalist prompt while taking
# advantage of Powerlevel10k features that aren't present in Pure.
# Temporarily change options.
'builtin' 'local' '-a' 'p10k_config_opts'
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
() {
emulate -L zsh
# Unset all configuration options.
unset -m '(POWERLEVEL9K_*|DEFAULT_USER)~POWERLEVEL9K_GITSTATUS_DIR'
# Zsh >= 5.1 is required.
autoload -Uz is-at-least && is-at-least 5.1 || return
# Prompt colors.
local grey='242'
local red='#FF5C57'
local yellow='#F3F99D'
local blue='#57C7FF'
local magenta='#FF6AC1'
local cyan='#9AEDFE'
local white='#F1F1F0'
# Left prompt segments.
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
# context # user@host
dir # current directory
vcs # git status
# command_execution_time # previous command duration
# =========================[ Line #2 ]=========================
newline # \n
# virtualenv # python virtual environment
prompt_char # prompt symbol
)
# Right prompt segments.
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
command_execution_time # previous command duration
virtualenv # python virtual environment
context # user@host
# time # current time
# =========================[ Line #2 ]=========================
newline # \n
)
# Basic style options that define the overall prompt look.
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
typeset -g POWERLEVEL9K_VISUAL_IDENTIFIER_EXPANSION= # no segment icons
# Add an empty line before each prompt except the first. This doesn't emulate the bug
# in Pure that makes prompt drift down whenever you use the Alt-C binding from fzf or similar.
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
# Magenta prompt symbol if the last command succeeded.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$magenta
# Red prompt symbol if the last command failed.
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
# Default prompt symbol.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='❯'
# Prompt symbol in command vi mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='❮'
# Prompt symbol in visual vi mode is the same as in command mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='❮'
# Prompt symbol in overwrite vi mode is the same as in command mode.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=false
# Grey Python Virtual Environment.
typeset -g POWERLEVEL9K_VIRTUALENV_FOREGROUND=$grey
# Don't show Python version.
typeset -g POWERLEVEL9K_VIRTUALENV_SHOW_PYTHON_VERSION=false
typeset -g POWERLEVEL9K_VIRTUALENV_{LEFT,RIGHT}_DELIMITER=
# Blue current directory.
typeset -g POWERLEVEL9K_DIR_FOREGROUND=$blue
# Context format when root: user@host. The first part white, the rest grey.
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE="%F{$white}%n%f%F{$grey}@%m%f"
# Context format when not root: user@host. The whole thing grey.
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE="%F{$grey}%n@%m%f"
# Don't show context unless root or in SSH.
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_CONTENT_EXPANSION=
# Show previous command duration only if it's >= 5s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=5
# Don't show fractional seconds. Thus, 7s rather than 7.3s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
# Duration format: 1d 2h 3m 4s.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
# Yellow previous command duration.
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=$yellow
# Grey Git prompt. This makes stale prompts indistinguishable from up-to-date ones.
typeset -g POWERLEVEL9K_VCS_FOREGROUND=$grey
# Disable async loading indicator to make directories that aren't Git repositories
# indistinguishable from large Git repositories without known state.
typeset -g POWERLEVEL9K_VCS_LOADING_TEXT=
# Don't wait for Git status even for a millisecond, so that prompt always updates
# asynchronously when Git state changes.
typeset -g POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0
# Cyan ahead/behind arrows.
typeset -g POWERLEVEL9K_VCS_{INCOMING,OUTGOING}_CHANGESFORMAT_FOREGROUND=$cyan
# Don't show remote branch, current tag or stashes.
typeset -g POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind)
# Don't show the branch icon.
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
# When in detached HEAD state, show @commit where branch normally goes.
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
# Don't show staged, unstaged, untracked indicators.
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED}_ICON=
# Show '*' when there are staged, unstaged or untracked files.
typeset -g POWERLEVEL9K_VCS_DIRTY_ICON='*'
# Show '⇣' if local branch is behind remote.
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON=':⇣'
# Show '⇡' if local branch is ahead of remote.
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON=':⇡'
# Don't show the number of commits next to the ahead/behind arrows.
typeset -g POWERLEVEL9K_VCS_{COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=1
# Remove space between '⇣' and '⇡' and all trailing spaces.
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${${${P9K_CONTENT/⇣* :⇡/⇣⇡}// }//:/ }'
# Grey current time.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=$grey
# Format for the current time: 09:51:02. See `man 3 strftime`.
typeset -g POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
# If set to true, time will update when you hit enter. This way prompts for the past
# commands will contain the start times of their commands rather than the end times of
# their preceding commands.
typeset -g POWERLEVEL9K_TIME_UPDATE_ON_COMMAND=false
# Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
# when accepting a command line. Supported values:
#
# - off: Don't change prompt when accepting a command line.
# - always: Trim down prompt when accepting a command line.
# - same-dir: Trim down prompt when accepting a command line unless this is the first command
# typed after changing current working directory.
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
# Instant prompt mode.
#
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
# it incompatible with your zsh configuration files.
# - quiet: Enable instant prompt and don't print warnings when detecting console output
# during zsh initialization. Choose this if you've read and understood
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
# really need it.
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
# If p10k is already loaded, reload configuration.
# This works even with POWERLEVEL9K_DISABLE_HOT_RELOAD=true.
(( ! $+functions[p10k] )) || p10k reload
}
# Tell `p10k configure` which file it should overwrite.
typeset -g POWERLEVEL9K_CONFIG_FILE=${${(%):-%x}:a}
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
'builtin' 'unset' 'p10k_config_opts'

1580
.config/zsh/.p10k.zsh

File diff suppressed because it is too large

15
.config/zsh/.zprofile

@ -1,15 +0,0 @@
#!/usr/bin/env zsh
[[ "$TTY" == /dev/tty* ]] || return 0
export $(systemctl --user show-environment)
export GPG_TTY="$TTY"
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh"
systemctl --user import-environment GPG_TTY SSH_AUTH_SOCK
if [[ -z $DISPLAY && "$TTY" == "/dev/tty1" ]]; then
systemd-cat -t sway sway
systemctl --user stop sway-session.target
systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
fi

29
.config/zsh/.zshenv

@ -1,29 +0,0 @@
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
#
if [[ "$(/usr/bin/lsb_release -i)" == *"Debian" ]]; then
export PATH=$PATH:/sbin/:/usr/sbin
fi
if [[ -d $HOME/.local/bin && ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH=$HOME/.local/bin:$PATH
fi
if [[ $UID -eq 0 ]]; then
export PATH=/root/bin:$PATH
fi
if [[ -d /usr/lib/ruby/gems/2.7.0/bin && ":$PATH:" != *":/usr/lib/ruby/gems/2.7.0/bin:"* ]]; then
export PATH=/usr/lib/ruby/gems/2.7.0/bin:$PATH
fi
if [[ -d $HOME/.emacs.d/bin ]]; then
export PATH=$HOME/.emacs.d/bin:$PATH
fi
if [[ -f /etc/profile.d/flatpak.sh ]]; then
source /etc/profile.d/flatpak.sh
fi

57
.config/zsh/.zshrc

@ -1,57 +0,0 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et foldmethod=marker
# -------------------------------------------------------------------------------------------------
#
if [ -f ~/.config/zsh/zinit/bin/zmodules/Src/zdharma/zplugin.so ]; then
module_path+=( "/home/nokogiri/.config/zsh/zinit/bin/zmodules/Src" )
zmodload zdharma/zplugin
fi
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
source $HOME/.config/zsh/zinit/bin/zinit.zsh
if [ -f /usr/share/doc/pkgfile/command-not-found.zsh ]; then
source /usr/share/doc/pkgfile/command-not-found.zsh
fi
zinit wait lucid for \
atinit"zicompinit; zicdreplay" \
zdharma/fast-syntax-highlighting \
atload"_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
blockf atpull'zinit creinstall -q .' \
zsh-users/zsh-completions \
zinit ice depth=1; zinit light romkatv/powerlevel10k
# Adapted from https://github.com/holman/dotfiles/
typeset -U config_files
config_files=($ZDOTDIR/*.zsh)
# load config files
for file in ${config_files}
do
source $file
done
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh

5
.config/zsh/10_env.zsh

@ -1,8 +1,3 @@
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et foldmethod=marker
# -------------------------------------------------------------------------------------------------
# aur settings
export AUR_PAGER=ranger
export AURDEST=/build/aur

1
.config/zsh/11_pathss.zsh

@ -0,0 +1 @@
export PATH=$PATH:$HOME/.emacs.d/bin

30
.config/zsh/40_functions.zsh

@ -1,30 +0,0 @@
timezsh() {
shell=${1-$SHELL}
for i in $(seq 1 10); do /usr/bin/time $shell -i -c exit; done
}
# easily make backups
bk() {
rsync -phaxPHAX "${1}" "$(echo $1 | sed -r "s/(.*)(\.|$)(.*)/\1_`date +%Y-%m-%d_%H%M%S`\2\3/")"
}
cget() {
curl -fJOL --compressed "$@"
}
swap() {
if [[ -z $1 ]] || [[ -z $2 ]] || [[ $1 = "-h" ]]; then
echo -e "${blue}Usage:$NC swap <file> <file>";
echo -e "Swaps files";
return 1
fi
if [[ -f $1 ]] && [[ -f $2 ]]; then
local TMPFILE=tmp.$$
mv "$1" $TMPFILE
mv "$2" "$1"
mv $TMPFILE "$2"
else
echo -e "${RED}Error:$NC One or more files don't exist"
return 1
fi
}

97
.config/zsh/50_aliases.zsh

@ -1,97 +0,0 @@
# Aliases {{{
# better ask before we lose data
alias rm='rm -Iv'
alias cp='cp -iv'
alias mv='mv -iv'
# I don't like bytes
alias dum='du -kh --max-depth=2'
alias dus='du -skh'
alias du='du -kh'
alias df="df -Th"
# function to make ls look nice is below
#alias ll='ls -l'
#alias la='ls -a'
#alias lla='ls -la'
#alias lld='ls -ld'
alias ll='exa -l '
alias la='exa -a '
alias lla='exa -la '
alias lld='exa -lD '
# well I got used to that name ;)
alias aurball='mkaurball -f'
#alias sudo="sudo " #Sudo wont recognize aliases without this
alias s='sudo '
alias mtr='mtr -t'
alias wcl='wc -l'
alias mdstat='cat /proc/mdstat'
alias keymap='setxkbmap de -variant nodeadkeys'
alias hexdump='hexdump -C'
alias grep='grep --color'
alias dmesg='dmesg -T'
alias vp='PAGER=vimpager'
if type nvim &>/dev/null && [[ -e "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim" ]] ; then
alias v='nvim'
elif type vim &>/dev/null; then
alias v='vim'
fi
alias l='less'
alias rf='readlink -f'
alias sc='screen'
alias scw='screen -X eval "chdir $PWD"'
alias g='git'
alias tiga='tig --all'
alias xc="xclip"
alias xcp="xclip -o | fb"
alias xcpe="xclip -o | vipe | ifne fb"
alias nsl='nslookup'
alias rscp='rsync --partial --progress'
alias scp='scp -o ControlPath=none'
alias mkdir='nocorrect mkdir'
alias wget='nocorrect noglob wget'
alias p='pacman'
alias sd='systemctl --no-pager'
alias b='busybox'
alias su='su -'
# too long to remember
alias asciidoc_full='asciidoc -a icons -a toc -a linkcss -a quirks!'
alias nossh='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
alias noscp='scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
alias sshpw="ssh -S none -o PubkeyAuthentication=no"
alias nosshpw="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -S none -o PubkeyAuthentication=no"
alias ssh-copy-id="ssh-copy-id -o ControlPath=none"
alias nosshfs='sshfs -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
alias callgrind='valgrind --tool=callgrind'
alias vgfull='valgrind --leak-check=full --show-reachable=yes'
alias is="iostat -Nyxm 2"
alias md='mysqldump --quick --create-options --disable-keys --add-locks --add-drop-table --lock-tables --complete-insert --skip-extended-insert'
# other random aliases
alias='pkill -9'
alias nocomment='egrep -v "^\s*(#|$)"'
alias wgetc="wget --content-disposition"
# global aliases work EVERYWHERE
# e.g. dmesg eg foo
# show last 50 lines of dmesg
alias -g eg='| egrep --color'
# }}}
# vim: set ft=zsh

161
.config/zsh/90_alias.zsh

@ -0,0 +1,161 @@
#!/usr/bin/env zsh
command -v curlie &> /dev/null && alias curl='curlie'
command -v pydf &> /dev/null && alias df='pydf'
command -v git &> /dev/null && alias diff='git diff --no-index'
command -v rmtrash &> /dev/null && alias rm='rmtrash -rf'
command -v bat &> /dev/null && alias c='bat -p' || alias c='cat'
command -v fd &> /dev/null && alias fd='fd --hidden --follow' || alias fd='find . -name'
command -v rg &> /dev/null && alias rg='rg --hidden --follow --smart-case 2>/dev/null' || alias rg='grep --color=auto --exclude-dir=.git -R'
command -v exa &> /dev/null && alias ls='exa --group --git --group-directories-first' || alias ls='ls --color=auto --group-directories-first -h'
command -v exa &> /dev/null && alias la='ll -a' || alias la='ll -A'
command -v exa &> /dev/null && alias lk='ll -s=size' || alias lk='ll -r --sort=size'
command -v exa &> /dev/null && alias lm='ll -s=modified' || alias lm='ll -r --sort=time'
alias e="$EDITOR"
alias d='dig +nocmd +multiline +noall +answer'
alias cp='cp -r --reflink=auto'
alias mkdir='mkdir -p'
alias hexdump='od -A x -t x1z -v'
alias http-serve='python -m http.server'
alias htpasswd='openssl passwd -apr1'
alias ip='ip -color -brief'
alias locate='locate -i'
alias o='xdg-open'
alias rm!='\rm -rf'
alias rsync='rsync --verbose --archive --info=progress2 --human-readable --partial'
alias sudo='sudo -E '
alias tree='tree -a -I .git --dirsfirst'
alias ll='ls -l'
alias utc='env TZ=UTC date'
alias e="$EDITOR"
alias cip="ip -color -brief"
alias mkdir='mkdir -p '
alias sudo='sudo -E'
alias o='xdg-open '
#p() { ping "${1:-10.200.200.1}" }
#systemctl
alias sys='systemctl'
alias sysu='systemctl --user'
alias status='sys status'
alias statusu='sysu status'
alias start='sys start'
alias startu='sysu start'
alias stop='sys stop'
alias stopu='sysu stop'
alias restart='sys restart'
alias restartu='sysu restart'
alias enable='sys enable'
alias enableu='sysu enable'
alias disable='sys disable'
alias disableu='sysu disable'
alias reload='sys daemon-reload'
alias reloadu='sysu daemon-reload'
alias timers='sys list-timers'
alias timersu='sysu list-timers'
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gap='git add -p'
alias gb='git branch'
alias gba='git branch --all'
alias gbd='git branch -D'
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbo='git branch --set-upstream-to=origin/$(git symbolic-ref --short HEAD) $(git symbolic-ref --short HEAD)'
alias gbu='git branch --set-upstream-to=upstream/$(git symbolic-ref --short HEAD) $(git symbolic-ref --short HEAD)'
alias gbsb='git bisect bad'
alias gbsg='git bisect good'
alias gbsr='git bisect reset'
alias gbss='git bisect start'
alias gc='git commit -v'
alias gc!='git commit -v --amend'
alias gcn!='git commit --no-edit --amend'
alias gac='git add --all && git commit -v'
alias gac!='git add --all && git commit -v --amend'
alias gacn!='git add --all && git commit --amend --no-edit'
alias gacm='git add --all && git commit -m'
alias gcm='git commit -m'
alias gcf='git commit --fixup'
alias gcfh='git commit --fixup HEAD'
alias gacf='git add --all && git commit --fixup'
alias gacfh='git add --all && git commit --fixup HEAD'
alias gco='git checkout'
alias gcom='git checkout master'
alias gcob='git checkout -b'
alias gcop='git checkout -p'
alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
alias gd='git diff'
alias gds='git diff --cached'
alias gd!='git difftool -d'
alias gds!='git difftool -d --cached'
alias gf='git fetch --tags'
alias gl='git pull --tags -f --rebase --autostash'
alias glog="git log --graph --pretty='%Cred%h%Creset%C(yellow)%d%Creset %s %Cgreen(%cr) %C(blue)<%an>%Creset' --abbrev-commit"
alias gloga="git log --graph --pretty='%Cred%h%Creset%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
alias glogp='git log -p'
alias gm='git merge'
alias gma='git merge --abort'
alias gp='git push -u'
alias gpf='git push --force-with-lease'
alias gpf!='git push --force'
alias gra='git remote add'
alias grr='git remote remove'
alias grv='git remote -v'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbi='git rebase -i'
alias grbm='git rebase -i master'
alias grbom='git rebase -i origin/master'
alias gr='git reset'
alias gr!='git reset --hard'
alias grh='git reset HEAD'
alias grh!='git reset --hard HEAD'
alias garh!='git add --all && git reset --hard HEAD'
alias gs='git show --show-signature'
alias gss='git status -sb'
alias gst='git status'
alias gsa='git submodule add'
alias gsu='git submodule update --remote'
alias gsr='git submodule-remove'
gcl() {
git clone --recursive "$@"
cd -- "${${${@: -1}##*/}%*.git}"
}
grf() {
upstream="$(git remote get-url upstream 2>/dev/null || git remote get-url origin)"
if [[ $# == 1 ]]; then
if [[ "$upstream" == https* ]]; then
fork=$(echo "$upstream" | awk -v name="$1" -F/ '{ print $1 "/" $2 "/" $3 "/" name "/" $5 }')
else
fork=$(echo "$upstream" | awk -v name="$1" -F/ '{ print "https://github.com/" name "/" $2 }')
fi
git remote remove "$1" 2>/dev/null
git remote add "$1" "$fork"
git fetch "$1"
else
myfork=$(echo "$upstream" | awk -v name="$USER" -F/ '{ print "git@github.com:" name "/" $5 }')
git remote remove upstream 2>/dev/null
git remote remove origin 2>/dev/null
git remote add upstream "$upstream"
git remote add origin "$myfork"
git fetch upstream
git fetch origin
git branch --set-upstream-to=upstream/master master
fi
}

307
.config/zsh/90_settings.zsh

@ -1,307 +0,0 @@
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et foldmethod=marker
# -------------------------------------------------------------------------------------------------
# Exports {{{
# Work around pssh hanging due to multiplexer not closing stdin
export PSSH_OPTIONS='ControlPersist=no'
# }}}
# Colors {{{
#use these in functions/shell scripts
export NC='\e[0m'
export white='\e[0;30m'
export WHITE='\e[1;30m'
export red='\e[0;31m'
export RED='\e[1;31m'
export green='\e[0;32m'
export GREEN='\e[1;32m'
export yellow='\e[0;33m'
export YELLOW='\e[1;33m'
export blue='\e[0;34m'
export BLUE='\e[1;34m'
export magenta='\e[0;35m'
export MAGENTA='\e[1;35m'
export cyan='\e[0;36m'
export CYAN='\e[1;36m'
export black='\e[0;37m'
export BLACK='\e[1;37m'
# some better colors for ls
eval "`dircolors ~/.dir_colors`"
# }}}
# Keybindings {{{
bindkey -e
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
bindkey '\e[3~' delete-char
bindkey '\e[2~' overwrite-mode
bindkey "^[[7~" beginning-of-line # Pos1
bindkey "^[[8~" end-of-line # End
bindkey "${terminfo[khome]}" beginning-of-line
bindkey "${terminfo[kend]}" end-of-line
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
bindkey "^[OA" up-line-or-history
bindkey "^[OB" down-line-or-history
#bindkey "^[[A" up-line-or-history
#bindkey "^[[B" down-line-or-history
# HOWTO make your own:
# bindkey '<crtl+v key>' action
# for some actions run `bindkey`
# "cd......" ;)
_rationalise-dot() {
if [[ $LBUFFER = "cd "* ]]; then
if [[ $LBUFFER = *.. ]]; then
LBUFFER+=/..
else
LBUFFER+=.
fi
else
LBUFFER+=.
fi
}
zle -N _rationalise-dot
bindkey . _rationalise-dot
# add edit command line feature ("alt-e")
autoload edit-command-line
zle -N edit-command-line
bindkey '\ee' edit-command-line
FZF_TMUX_HEIGHT='95%'
#FZF_DEFAULT_OPTS='
# --color fg:#D8DEE9,bg:#2E3440,hl:#A3BE8C,fg+:#D8DEE9,bg+:#434C5E,hl+:#A3BE8C
#
# --color pointer:#BF616A,info:#4C566A,spinner:#4C566A,header:#4C566A,prompt:#81A1C1,marker:#EBCB8B
#'
# Source: https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh
__fzf_use_tmux__() {
[ -n "$TMUX_PANE" ] && [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ]
}
__fzfcmd() {
__fzf_use_tmux__ &&
echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-95%}" || echo "fzf"
}
# CTRL-R - Paste the selected command from history into the command line
# Changed to work with my personal history fetcher
fzf-history-widget() {
local selected num
setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null
selected=( $(cat-history-notime |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-95%} $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) )
local ret=$?
if [ -n "$selected" ]; then
zle kill-buffer
BUFFER="$selected"
fi
zle redisplay
typeset -f zle-line-init >/dev/null && zle zle-line-init
return $ret
}
zle -N fzf-history-widget
bindkey '^R' fzf-history-widget
__fsel() {
local cmd="${FZF_CTRL_T_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | cut -b3-"}"
setopt localoptions pipefail 2> /dev/null
eval "$cmd" | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS" $(__fzfcmd) -m "$@" | while read item; do
echo -n "${(q)item} "
done
local ret=$?
echo
return $ret
}
fzf-file-widget() {
LBUFFER="${LBUFFER}$(__fsel)"
local ret=$?
zle reset-prompt
return $ret
}
zle -N fzf-file-widget
bindkey '^T' fzf-file-widget
# }}}
# Terminal title {{{
function set-title-precmd() {
printf "\e]2;%s\a" "${PWD/#$HOME/~}"
}
function set-title-preexec() {
printf "\e]2;%s\a" "$1"
}
autoload -Uz add-zsh-hook
add-zsh-hook precmd set-title-precmd
add-zsh-hook preexec set-title-preexec
## Spelling prompt
SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) '
# }}}
# Functions {{{
suv() {
nvim "sudo:$1"
}
# add current time to a file
mbk() {
mv -b "${1}" "$(echo $1 | sed -r "s/(.*)(\.|$)(.*)/\1_`date +%Y-%m-%d_%H%M%S`\2\3/")"
}
# from the grml zshrc iirc
hglob() {
echo -e "
/ directories
. plain files
@ symbolic links
= sockets
p named pipes (FIFOs)
* executable plain files (0100)
% device files (character or block special)
%b block special files
%c character special files
r owner-readable files (0400)
w owner-writable files (0200)
x owner-executable files (0100)
A group-readable files (0040)
I group-writable files (0020)
E group-executable files (0010)
R world-readable files (0004)
W world-writable files (0002)
X world-executable files (0001)
s setuid files (04000)
S setgid files (02000)
t files with the sticky bit (01000)
print *(m-1) # Dateien, die vor bis zu einem Tag modifiziert wurden.
print *(a1) # Dateien, auf die vor einem Tag zugegriffen wurde.
print *(@) # Nur Links
print *(Lk+50) # Dateien die ueber 50 Kilobytes grosz sind
print *(Lk-50) # Dateien die kleiner als 50 Kilobytes sind
print **/*.c # Alle *.c - Dateien unterhalb von \$PWD
print **/*.c~file.c # Alle *.c - Dateien, aber nicht 'file.c'
print (foo|bar).* # Alle Dateien mit 'foo' und / oder 'bar' am Anfang
print *~*.* # Nur Dateien ohne '.' in Namen
chmod 644 *(.^x) # make all non-executable files publically readable
print -l *(.c|.h) # Nur Dateien mit dem Suffix '.c' und / oder '.h'
print **/*(g:users:) # Alle Dateien/Verzeichnisse der Gruppe >users<
echo /proc/*/cwd(:h:t:s/self//) # Analog zu >ps ax | awk '{print $1}'<"
}
cat-history() {
local histfiles=($(ls -t1 "$HISTORYDIRECTORY"/*))
cat "${histfiles[@]}"
}
cat-history-notime() {
cat-history "$@" | sed 's/^: [0-9]\+:0;//'
}
hgrep() {
cat-history | mpgrep "$@" | less
}
# }}}
# History {{{
HISTORYDIRECTORY=~/.config/zsh/history
HISTFILE="$HISTORYDIRECTORY/histfile"
HISTSIZE=10000
SAVEHIST=10000000
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
mkdir -p "$HISTORYDIRECTORY"
# }}}
# Other ZSH options {{{
autoload -U colors
colors
autoload -U zmv
# .. -> cd ../
setopt autocd
# cd /etc/**/foo/blub searches ;)
setopt extendedglob
# push cds to directory stack
setopt auto_pushd
# don't push something twice
setopt pushd_ignore_dups
# don't kill jobs when exiting shell
setopt no_hup
# and don't warn
setopt no_check_jobs
# show us when some command didn't exit with 0
#setopt print_exit_value
# makepkg -g > PKGBUILD
# zsh: file exists: PKGBUILD
#
# work saved ;)
setopt no_clobber
setopt inc_append_history
setopt no_bg_nice
setopt share_history
#setopt bang_hist
setopt extended_history
#setopt hist_reduce_blanks
setopt hist_ignore_space
setopt hist_find_no_dups
setopt hist_ignore_dups
setopt nohistverify
#setopt prompt_subst
#setopt hist_fcntl_lock
setopt always_to_end
unsetopt auto_remove_slash
# show the output of time if commands takes longer than n secs (only user+system)
REPORTTIME=5
# allow comments in interactive shells
setopt interactivecomments
# ignore lines starting with a space
setopt hist_ignore_space
# }}}
# {{{ Other stuff that doesn't fit anywhere else
eval `thefuck --alias`
umask 0022
# }}}
# vim: set ft=zsh:

82
.config/zsh/91_abbr.zsh

@ -1,82 +0,0 @@
# -------------------------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et foldmethod=marker
# -------------------------------------------------------------------------------------------------
# source: http://github.com/xfire/dotfiles/blob/master/.zsh/abbrev_expansion
# power completion / abbreviation expansion / buffer expansion
# see http://zshwiki.org/home/examples/zleiab for details
# less risky than the global aliases but powerful as well
# just type the abbreviation key and afterwards ',' to expand it
typeset -Ag abbreviations
abbreviations=(
# 'M' '| most'
'dn' '&>/dev/null '
'dn1' '1>/dev/null '
'dn2' '2>/dev/null '
# 'NULL' '>/dev/null 2>&1'
'21' '2>&1 '
'l' '| less'
'll' '|& less'
'g' '| grep '
'gi' '| grep -i '
'eg' '| egrep '
'h' '| head '
'hh' '|& head '
't' '| tail '
'tt' '|& tail '
'wc' '| wc'
# 'wcb' '| wc -c'
# 'wcc' '| wc -m'
# 'wcw' '| wc -w'
'wcl' '| wc -l'
's' '| sort'
'su' '| sort -u'
'sl' '| sort | less'
'a' '| awk '
# 'A1' "| awk '{print \$1}'"
# 'A2' "| awk '{print \$2}'"
# 'A3' "| awk '{print \$3}'"
# 'A4' "| awk '{print \$4}'"
# 'A5' "| awk '{print \$5}'"
# 'A6' "| awk '{print \$6}'"
# 'A7' "| awk '{print \$7}'"
# 'A8' "| awk '{print \$8}'"
# 'A9' "| awk '{print \$9}'"
# 'CA' "|& cat -A"
'v' '|& vim -'
'x' '| xargs'
'xx' '|& xargs'
'hide' "echo -en '\033]50;nil2\007'"
'tiny' 'echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-80-*-*-c-*-iso8859-15\007"'
'small' 'echo -en "\033]50;6x10\007"'
'medium' 'echo -en "\033]50;-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-15\007"'
'default' 'echo -e "\033]50;-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-15\007"'
'large' 'echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-150-*-*-c-*-iso8859-15\007"'
'huge' 'echo -en "\033]50;-misc-fixed-medium-r-normal-*-*-210-*-*-c-*-iso8859-15\007"'
'smartfont' 'echo -en "\033]50;-artwiz-smoothansi-*-*-*-*-*-*-*-*-*-*-*-*\007"'
'semifont' 'echo -en "\033]50;-misc-fixed-medium-r-semicondensed-*-*-120-*-*-*-*-iso8859-15\007"'
'da' 'du -sch '
'j' 'jobs -l '
'co' "./configure && make && sudo make install"
'ch' "./configure --help"
'rw-' 'chmod 600 '
'600' 'chmod u+rw-x,g-rwx,o-rwx '
'rwx' 'chmod u+rwx '
'700' 'chmod u+rwx,g-rwx,o-rwx '
'r--' 'chmod u+r-wx,g-rwx,o-rwx '
'644' 'chmod u+rw-x,g+r-wx,o+r-wx\n # 4=r,2=w,1=x '
'755' 'chmod u+rwx,g+r-w+x,o+r-w+x '
'cx' 'chmod +x '
'de' 'export DISPLAY=:0.0'
'd' 'DISPLAY=:0.0'
)
globalias() {
local MATCH
LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#}
LBUFFER+=${abbreviations[$MATCH]:-$MATCH,,}
}
zle -N globalias
bindkey ",," globalias

1
.config/zsh/init/bin

@ -1 +0,0 @@
Subproject commit e03cc7ce3f8dff75030027de8e4c794183da4189

1
.config/zsh/zinit/bin

@ -1 +0,0 @@
Subproject commit e03cc7ce3f8dff75030027de8e4c794183da4189
Loading…
Cancel
Save