updated stuff

This commit is contained in:
Nikolas Weger 2019-11-18 22:40:23 +01:00
parent c427c918d4
commit fa06d6afcc
11 changed files with 34 additions and 2115 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "zplugin/bin"]
path = zplugin/bin
url = https://github.com/zdharma/zplugin

View file

@ -14,28 +14,28 @@ die() { yell "$*"; exit 111; }
try() { "$@" || die "cannot $*"; }
remove() {
if [ -n "$(grep -P "[[:space:]]$hostname" /etc/hosts)" ]; then
echo "$hostname found in $hostsFile. Removing now...";
try sudo sed -ie "/[[:space:]]$hostname/d" "$hostsFile";
if grep -qP "[[:space:]]$hostname" /etc/hosts; then
echo "$hostname found in $hostsFile. Removing now..."
try sudo sed -ie "/[[:space:]]$hostname/d" "$hostsFile"
else
yell "$hostname was not found in $hostsFile";
yell "$hostname was not found in $hostsFile"
fi
}
add() {
if [ -n "$(grep -P "[[:space:]]$hostname" /etc/hosts)" ]; then
yell "$hostname, already exists: $(grep $hostname $hostsFile)";
if grep -qP "[[:space:]]$hostname" /etc/hosts; then
yell "$hostname already exists: $(grep "$hostname" $hostsFile)"
else
echo "Adding $hostname to $hostsFile...";
try printf "%s\t%s\n" "$ip" "$hostname" | sudo tee -a "$hostsFile" > /dev/null;
echo "Adding $hostname to $hostsFile..."
try printf "%s\t%s\n" "$ip" "$hostname" | sudo tee -a "$hostsFile" > /dev/null
if [ -n "$(grep $hostname /etc/hosts)" ]; then
echo "$hostname was added succesfully:";
echo "$(grep $hostname /etc/hosts)";
if grep -q "$hostname" /etc/hosts; then
echo "$hostname was added succesfully:"
grep "$hostname" /etc/hosts
else
die "Failed to add $hostname";
die "Failed to add $hostname"
fi
fi
}
$@
"$@"

@ -1 +0,0 @@
Subproject commit 60094e8fb54eff1680419433a5de782ec11a9e9c

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,27 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.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
source "$ZDOTDIR/export.zsh"
source "$ZDOTDIR/history.zsh"
source "$ZDOTDIR/zplugin.zsh"
source "$ZDOTDIR/libraries/export.zsh"
source "$ZDOTDIR/libraries/dircolor.zsh"
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
autoload -Uz compinit
if [[ -n $HOME/.cache/zsh/compdump(#qN.mh+24) ]]; then
compinit -d $HOME/.cache/zsh/compdump
else
compinit -d $HOME/.cache/zsh/compdump -C
fi
for file in $ZDOTDIR/libraries/source/*.zsh; do source "$file"; done
for file in $ZDOTDIR/libraries/plugins/*.zsh; do source "$file"; done
source "/usr/share/fzf/completion.zsh"
source "/usr/share/fzf/key-bindings.zsh"
source "/usr/share/doc/pkgfile/command-not-found.zsh"
for file in $ZDOTDIR/functions/*.zsh; do source "$file"; done
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp)"
@ -26,5 +34,6 @@ lfcd () {
}
bindkey -s '^o' 'lfcd\n'
# To customize prompt, run "p10k configure" or edit $ZDOTDIR/.p10k.zsh
[[ ! -f $ZDOTDIR/.p10k.zsh ]] || source $ZDOTDIR/.p10k.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

View file

@ -1,71 +0,0 @@
alias x=extract
extract() {
local remove_archive
local success
local extract_dir
if (( $# == 0 )); then
cat <<-'EOF' >&2
Usage: extract [-option] [file ...]
Options:
-r, --remove Remove archive after unpacking.
EOF
fi
remove_archive=1
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
remove_archive=0
shift
fi
while (( $# > 0 )); do
if [[ ! -f "$1" ]]; then
echo "extract: '$1' is not a valid file" >&2
shift
continue
fi
success=0
extract_dir="${1:t:r}"
case "${1:l}" in
(*.tar.gz|*.tgz) (( $+commands[pigz] )) && { pigz -dc "$1" | tar xv } || tar zxvf "$1" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz)
tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
|| xzcat "$1" | tar xvf - ;;
(*.tar.zma|*.tlz)
tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
mkdir -p "$extract_dir/data"
cd "$extract_dir"; ar vx "../${1}" > /dev/null
cd control; tar xzvf ../control.tar.gz
cd ../data; extract ../data.tar.*
cd ..; rm *.tar.* debian-binary
cd ..
;;
(*)
echo "extract: '$1' cannot be extracted" >&2
success=1
;;
esac
(( success = $success > 0 ? $success : $? ))
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
shift
done
}

View file

@ -1,8 +0,0 @@
cmds=(status show start stop reload restart enable disable daemon-reload)
for cmd in $cmds; do
alias sc-$cmd="sudo systemctl $cmd"
done
alias sc-enablenow="sc-enable --now"
alias sc-disablenow="sc-disable --now"

View file

@ -1,40 +0,0 @@
## History wrapper
function omz_history {
local clear list
zparseopts -E c=clear l=list
if [[ -n "$clear" ]]; then
# if -c provided, clobber the history file
echo -n >| "$HISTFILE"
echo >&2 History file deleted. Reload the session to see its effects.
elif [[ -n "$list" ]]; then
# if -l provided, run as if calling `fc' directly
builtin fc "$@"
else
# unless a number is provided, show all history events (starting from 1)
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
fi
}
# Timestamp format
case ${HIST_STAMPS-} in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
"") alias history='omz_history' ;;
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
esac
# History in cache directory:
HISTSIZE=50000
SAVEHIST=10000
HISTFILE=$HOME/.config/dotfiles/cache/zsh/history
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data

View file

@ -1,2 +1,5 @@
LS_COLORS='no=00;37:fi=01;34:rs=00;37:di=00;34:ln=00;36:mh=00;37:pi=40;33:so=00;35:do=00;35:bd=40;33;01:cd=40;33;01:or=00;05;37;41:mi=00;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=04;34:st=37;44:ex=00;32:*.cmd=00;33:*.exe=00;33:*.com=00;33:*.btm=00;33:*.bat=00;33:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz=01;31:*.bz2=01;31:*.bzip2=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.apk=01;31:*.gem=01;31:*.jpg=00;35:*.JPG=00;35:*.jpeg=00;35:*.gif=00;35:*.bmp=00;35:*.pbm=00;35:*.pgm=00;35:*.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00;35:*.tiff=00;35:*.png=00;35:*.svg=00;35:*.svgz=00;35:*.mng=00;35:*.pcx=00;35:*.dl=00;35:*.xcf=00;35:*.xwd=00;35:*.yuv=00;35:*.cgm=00;35:*.emf=00;35:*.eps=00;35:*.CR2=00;35:*.ico=00;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.html=00;32:*.rst=00;32:*.md=00;32:*.patch=00;32:*.diff=00;32:*.tex=00;32:*.doc=00;32:*.xml=00;32:*.xls=00;32:*.xlsx=00;32:*.doc=00;32:*.docx=00;32:*.ppt=00;32:*.pptx=00;32:*.key=00;32:*.pt=01;32:*.tmpl=01;32:*.in=01;32:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.m4a=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:*.mov=01;36:*.mpg=01;36:*.mpeg=01;36:*.m2v=01;36:*.mkv=01;36:*.ogm=01;36:*.mp4=01;36:*.m4v=01;36:*.mp4v=01;36:*.vob=01;36:*.qt=01;36:*.nuv=01;36:*.wmv=01;36:*.asf=01;36:*.rm=01;36:*.rmvb=01;36:*.flc=01;36:*.avi=01;36:*.fli=01;36:*.flv=01;36:*.gl=01;36:*.m2ts=01;36:*.divx=01;36:*.webm=01;36:*.axv=01;36:*.anx=01;36:*.ogv=01;36:*.ogx=01;36:*.conf=00;36:*.cnf=00;36:*.cfg=00;36:*.ini=00;36:*.properties=00;36:*.yaml=00;36:*.vcl=00;36:*.c=00;33:*.cpp=00;33:*.py=00;33:*.coffesscript=00;33:*.js=00;33:*.rb=00;33:*.sh=00;33:*.zsh=00;33:*.env=00;33:*.bash=00;33:*.php=00;33:*.java=00;33:*.zcml=00;33:*.db=00;32:*.sql=00;32:*.json=00;32:*.plist=00;32:*.fs=00;32:*.tex=01;37:*.rdf=01;37:*.owl=01;37:*.n3=01;37:*.ttl=01;37:*.nt=01;37:*.torrent=01;37:*.xml=01;37:*Makefile=01;37:*Rakefile=01;37:*build.xml=01;37:*rc=01;37:*.nfo=01;37:*README=01;37:*README.txt=01;37:*readme.txt=01;37:*README.markdown=01;37:*README.md=01;37:*.ini=01;37:*.yml=01;37:*.cfg=01;37:*.conf=01;37:*.c=01;37:*.cpp=01;37:*.cc=01;37:*.log=01;30:*.bak=01;30:*.aux=01;30:*.lof=01;30:*.lol=01;30:*.lot=01;30:*.out=01;30:*.toc=01;30:*.bbl=01;30:*.blg=01;30:*~=01;30:*#=01;30:*.part=01;30:*.incomplete=01;30:*.swp=01;30:*.tmp=01;30:*.temp=01;30:*.o=01;30:*.obj=01;30:*.pyc=01;30:*.pyo=01;30:*.class=01;30:*.cache=01;30:*.egg-info=01;30:';
export LS_COLORS
alias ls="ls --color=tty"
zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}

View file

@ -1,40 +0,0 @@
declare -A ZPLGM
ZPLGM[BIN_DIR]="$HOME/.config/dotfiles/zplugin/bin"
ZPLGM[HOME_DIR]="$HOME/.config/dotfiles/zplugin"
source $HOME/.config/dotfiles/zplugin/bin/zplugin.zsh
# completions
zplugin silent wait blockf atpull'zplugin creinstall -q .' for zsh-users/zsh-completions
# autosuggest
zplugin silent wait atload"_zsh_autosuggest_start" for zsh-users/zsh-autosuggestions
# theme
zplugin light romkatv/powerlevel10k
# lib files
zplugin snippet OMZ::lib/clipboard.zsh
zplugin snippet OMZ::lib/completion.zsh
zplugin snippet OMZ::lib/directories.zsh
zplugin snippet OMZ::lib/functions.zsh
zplugin snippet OMZ::lib/grep.zsh
zplugin snippet OMZ::lib/key-bindings.zsh
zplugin snippet OMZ::lib/misc.zsh
zplugin snippet OMZ::lib/spectrum.zsh
zplugin snippet OMZ::lib/termsupport.zsh
alias ls="ls --color=tty"
setopt auto_cd
setopt multios
setopt prompt_subst
zplugin snippet OMZ::plugins/common-aliases/common-aliases.plugin.zsh
zplugin snippet OMZ::plugins/gitignore/gitignore.plugin.zsh
# ls_colors
source $ZDOTDIR/dircolor.zsh
zstyle ":completion:*" list-colors “${(s.:.)LS_COLORS}
# syntax highlighting
zplugin silent wait atinit"zpcompinit; zpcdreplay -q" for zsh-users/zsh-syntax-highlighting