169 lines
4.6 KiB
Bash
169 lines
4.6 KiB
Bash
# bindkey -v # editor jako vi
|
|
bindkey -e # editor jako emacs
|
|
bindkey ' ' magic-space # mezerník rozbaluje odkazy na historii
|
|
|
|
alias ls="ls --classify --color --group-directories-first --quoting-style=literal"
|
|
alias l="ls --human-readable -l"
|
|
alias ll="l --almost-all"
|
|
alias grep="grep --text --color=auto"
|
|
alias pull_website="wget --no-parent --recursive --page-requisites --convert-links --html-extension --no-clobber"
|
|
alias ..="cd .."
|
|
alias pp=python2
|
|
alias ppp=python3
|
|
alias htop="htop --delay=3"
|
|
alias O=xdg-open
|
|
alias gits="git status"
|
|
alias gita="git add"
|
|
alias gitc="git commit"
|
|
alias gitp="git push"
|
|
alias gitl="git log --shortstat --graph"
|
|
alias gitd="git diff --word-diff"
|
|
alias over-video-x264="over-video --video x264 --video-preset slow --video-quality 22 --no-context"
|
|
alias Y="noglob youtube-dl --no-check-certificate -f 'bestvideo[height<=1080]+bestaudio/best[height<=1080]'"
|
|
alias Yall="noglob youtube-dl --no-check-certificate -o \"%(autonumber)s-%(title)s.%(ext)s\""
|
|
alias Ytune="noglob youtube-dl --no-check-certificate -x --audio-format vorbis --audio-quality 4"
|
|
alias units="units -v"
|
|
alias usystemctl="systemctl --user"
|
|
alias battery="upower -i /org/freedesktop/UPower/devices/battery_BAT0"
|
|
|
|
# apparently this is the only way of setting GNU Screen to UTF-8
|
|
alias screen="screen -U"
|
|
|
|
# Edit the current command line in $EDITOR
|
|
export VISUAL="nano"
|
|
autoload -U edit-command-line
|
|
zle -N edit-command-line
|
|
bindkey '\C-e' edit-command-line
|
|
|
|
mkcd () {
|
|
mkdir -p "$1" && cd "$1"
|
|
}
|
|
|
|
mkv-fixtitles () {
|
|
for arg in "$@"
|
|
do
|
|
title="${arg%%.[mM][kK][vV]}"
|
|
mkvpropedit "$arg" --set "title=$title" --edit track:v1 --delete name > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "$arg failed"
|
|
fi
|
|
done
|
|
}
|
|
|
|
psg () { ps axu | grep -v grep | grep -i $* } # hledání v běžících procesech
|
|
|
|
pskill () {
|
|
pids=($(psg $1|awk '{print $2}'))
|
|
|
|
for pid in $pids; do
|
|
echo "Killing $pid..."
|
|
kill $pid
|
|
done
|
|
}
|
|
|
|
psm () {
|
|
pid=(${=$(psg $1|grep -o --color=no -E "[0-9]+")})
|
|
echo "Found pid=${pid[1]}."
|
|
scanmem -p ${pid[1]}
|
|
}
|
|
|
|
zres () {
|
|
. /etc/zsh/zshrc
|
|
hash -r
|
|
}
|
|
|
|
# kill GNU Screen pages in the specified range
|
|
kill_screens () {
|
|
for p in {$1..$2}
|
|
do
|
|
screen -p $p -X stuff "exit\n"
|
|
done
|
|
}
|
|
|
|
|
|
# winetricks tools
|
|
wt-prefix() {
|
|
export WINEPREFIX="$HOME/.local/share/wineprefixes/$1"
|
|
|
|
grep "#arch=win32" "${WINEPREFIX}/system.reg" > /dev/null
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
export WINEARCH="win32"
|
|
else
|
|
unset WINEARCH
|
|
fi
|
|
}
|
|
|
|
wt-goto_c() {
|
|
cd $WINEPREFIX/drive_c
|
|
}
|
|
|
|
wt-list_prefixes() {
|
|
ls $* $HOME/.local/share/wineprefixes/
|
|
}
|
|
|
|
cds() {
|
|
cd /mnt/storage/$USER/$1
|
|
}
|
|
|
|
http-dir() {
|
|
echo "Serving $PWD on 0.0.0.0:55555"
|
|
/usr/sbin/thttpd -D -d . -p 55555 -l -
|
|
}
|
|
|
|
swap-files() {
|
|
TMP=.swap-files.tmp
|
|
mv "$1" "$TMP" && mv "$2" "$1" && mv "$TMP" "$2"
|
|
}
|
|
|
|
HISTFILE=~/.history # soubor pro ukládání do historie
|
|
SAVEHIST=5000 # ukládá se 5000 příkazů
|
|
HISTSIZE=5000 # :)
|
|
setopt HIST_IGNORE_SPACE
|
|
setopt HIST_IGNORE_ALL_DUPS
|
|
#setopt SHARE_HISTORY
|
|
#setopt EXTENDED_HISTORY
|
|
setopt INC_APPEND_HISTORY
|
|
|
|
setopt EXTENDED_GLOB
|
|
unsetopt NO_CLOBBER # ochrana při přesměrovávání výstupů
|
|
unsetopt CORRECTALL # opravy překlepů
|
|
setopt NO_BEEP # nepípat při chybách
|
|
unsetopt equals # kvůli emerge =něco
|
|
export ZLE_REMOVE_SUFFIX_CHARS=$' \t\n;&'
|
|
|
|
# File completion
|
|
setopt AUTOLIST # vypisuje možnosti pro doplnění
|
|
setopt NO_LIST_AMBIGUOUS # vypisuje je HNED, ne až při druhém <Tab>
|
|
setopt LIST_PACKED # zkrácený výpis
|
|
zmodload -i zsh/complist # obarví vypisované soubory
|
|
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
|
zstyle ':completion::complete:*' use-cache 1
|
|
zstyle ':completion:*' special-dirs true
|
|
autoload -U compinit # aktivuje "standardní" pravidla pro doplňování
|
|
compinit
|
|
autoload colors zsh/terminfo
|
|
|
|
source /usr/share/over-prompt/zsh-init
|
|
|
|
# keyboard stuff
|
|
bindkey "\e[1~" beginning-of-line
|
|
bindkey "\e[2~" quoted-insert
|
|
bindkey "\e[3~" delete-char
|
|
bindkey "\e[4~" end-of-line
|
|
bindkey "\e[5~" beginning-of-history
|
|
bindkey "\e[6~" end-of-history
|
|
bindkey "\e[7~" beginning-of-line
|
|
bindkey "\e[8~" end-of-line
|
|
bindkey "\e[H" beginning-of-line
|
|
bindkey "\e[F" end-of-line
|
|
bindkey "\eOH" beginning-of-line
|
|
bindkey "\eOF" end-of-line
|
|
bindkey "\eOd" backward-word
|
|
bindkey "\eOc" forward-word
|
|
bindkey '\e[A' history-beginning-search-backward
|
|
bindkey '\e[B' history-beginning-search-forward
|
|
|
|
# paludis default options
|
|
export CAVE_OPTIONS="--log-level warning"
|
|
export CAVE_RESOLVE_OPTIONS="--reinstall-scm weekly --show-descriptions new --continue-on-failure if-satisfied"
|