refactored some stuff
This commit is contained in:
parent
e007eb5a58
commit
5f3ecf6090
29 changed files with 91 additions and 666 deletions
|
@ -1,4 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
dte="$(date +"%a, %B %d %l:%M%p"| sed 's/ / /g')"
|
||||
echo -e "$dte"
|
|
@ -1,4 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
kern="$(uname -r)"
|
||||
echo -e "$kern "
|
|
@ -1,4 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
mem="$(free -h | awk '/^Mem:/ {print $3 "/" $2}')"
|
||||
echo -e "$mem ram "
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/php
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
$script = array_shift($_SERVER['argv']);
|
||||
$settings['token'] = 'ayndqf6fdyjo9pua8reusvvb733k1u';
|
||||
|
@ -18,4 +18,4 @@ curl_close($curl);
|
|||
|
||||
$json = json_decode($return, true);
|
||||
|
||||
if(isset($json['info'])) echo("Result: ${json['info']}");
|
||||
if(isset($json['info'])) echo("Result: ${json['info']}");
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
cupd=$(checkupdates | wc -l)
|
||||
printf "$cupd updates \n"
|
4
bin/upt
4
bin/upt
|
@ -1,4 +0,0 @@
|
|||
#! /bin/bash
|
||||
|
||||
upt="$(uptime --pretty | sed -e 's/up //g' -e 's/ days/d/g' -e 's/ day/d/g' -e 's/ hours/h/g' -e 's/ hour/h/g' -e 's/ minutes/m/g' -e 's/, / /g')"
|
||||
echo -e "$upt uptime "
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
|
||||
echo "${vol}% "
|
11
zsh/.zshrc
11
zsh/.zshrc
|
@ -1,4 +1,9 @@
|
|||
source "$ZDOTDIR/exports.zsh"
|
||||
export path=($path $HOME/.config/dotfiles/bin)
|
||||
export fpath=($fpath $ZDOTDIR/local/fpath)
|
||||
|
||||
export os=$(grep -E "^ID=" /etc/*release | cut -d= -f2)
|
||||
export wsl=$(uname -r | cut -d'-' -f3)
|
||||
|
||||
source "$ZDOTDIR/dircolor.zsh"
|
||||
|
||||
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
|
@ -8,11 +13,11 @@ autoload -Uz compinit bashcompinit
|
|||
compinit -d $HOME/.cache/zsh/compdump
|
||||
bashcompinit
|
||||
|
||||
for file in $ZDOTDIR/libs/*.zsh; do source "$file"; done
|
||||
for file in $ZDOTDIR/plgs/*.zsh; do source "$file"; done
|
||||
for file in $ZDOTDIR/files/*.zsh; do source "$file"; done
|
||||
|
||||
[[ -f "$ZDOTDIR/local/rc.zsh" ]] && source "$ZDOTDIR/local/rc.zsh"
|
||||
|
||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
|
||||
export STARSHIP_CONFIG=$ZDOTDIR/starship.toml
|
||||
eval "$(starship init zsh)"
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
#homebrew
|
||||
export path=($path $HOME/.config/dotfiles/bin /home/linuxbrew/.linuxbrew/{sbin,bin})
|
||||
export fpath=($fpath /home/linuxbrew/.linuxbrew/share/zsh/site-functions $ZDOTDIR/local/fpath)
|
||||
export manpath=($manpath /usr/local/share/man /usr/share/man /home/linuxbrew/.linuxbrew/share/man)
|
||||
export infopath=($infopath /usr/local/share/info /usr/share/info /home/linuxbrew/.linuxbrew/share/info)
|
||||
export XDG_DATA_DIRS=($XDG_DATA_DIRS /home/linuxbrew/.linuxbrew/share)
|
||||
export path=($path $HOME/.config/dotfiles/bin)
|
||||
export fpath=($fpath $ZDOTDIR/local/fpath)
|
||||
export infopath=($infopath /usr/share/info)
|
||||
|
||||
#gems
|
||||
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
|
||||
export path=($path $GEM_HOME/bin)
|
||||
|
||||
#stuff
|
||||
export os=$(grep -E "^ID=" /etc/*release | cut -d= -f2)
|
||||
export wsl=$(uname -r | cut -d'-' -f3)
|
||||
export STARSHIP_CONFIG=$ZDOTDIR/starship.toml
|
||||
|
|
19
zsh/files/aliases.zsh
Normal file
19
zsh/files/aliases.zsh
Normal file
|
@ -0,0 +1,19 @@
|
|||
alias ls='exa -al --color=always --group-directories-first'
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
alias grep="grep --exclude-dir={.bzr,CVS,.git,.hg,.svn} --color=auto"
|
||||
|
||||
alias sc-status="sudo systemctl status"
|
||||
alias sc-start="sudo systemctl start"
|
||||
alias sc-stop="sudo systemctl stop"
|
||||
alias sc-reload="sudo systemctl reload"
|
||||
alias sc-restart="sudo systemctl restart"
|
||||
alias sc-enable="sudo systemctl enable"
|
||||
alias sc-disable="sudo systemctl disable"
|
||||
alias sc-daemon-reload="sudo systemctl daemon-reload"
|
||||
|
||||
alias duplHostKeys='cat ~/.ssh/known_hosts | egrep -v "mesh.eu|inetbone.net" | cut -d" " -f3 | sort | uniq -d'
|
||||
alias tb="nc termbin.com 9999"
|
|
@ -1,47 +1,25 @@
|
|||
zmodload -i zsh/complist
|
||||
|
||||
WORDCHARS=''
|
||||
|
||||
unsetopt menu_complete
|
||||
unsetopt flowcontrol
|
||||
setopt auto_menu
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
|
||||
bindkey -M menuselect '^o' accept-and-infer-next-history
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
|
||||
if [[ "$CASE_SENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
unset CASE_SENSITIVE HYPHEN_INSENSITIVE
|
||||
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
||||
else
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
fi
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
||||
|
||||
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
|
||||
zstyle ':completion::complete:*' use-cache 1
|
||||
zstyle ':completion::complete:*' cache-path "$HOME/.cache/zsh/compcache/"
|
||||
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns adm amanda apache at avahi avahi-autoipd backup beaglidx bin bitcoin bitwarden_rs cacti canna clamav ceph colord consul couchdb cups daemon dbus dhcp dhcpcd distcache dnsdist dnsmasq dovecot eeleater elasticsearch fax flatpak flaskdemo ftp games gdm geoclue git gitea gkrellmd gluster gopher gophernicus gnats hacluster haldaemon halt hsqldb http ident irc junkbust kdm kibana landscape ldap lightdm list lldpd logstash lp lxd mail mailman mailnull man mattermost messagebus mldonkey mongodb mxisd mysql nagios named netdata netdump news nfsnobody nm-openvpn nobody nscd ntp nut nvidia-persistenced nweger nx obsrun openvpn operator pcap pcp polkitd pollinate postfix postgres powerdns privoxy proxy pulse prosody puppet pvm quagga radiusd radvd redis rpc rpcuser rpm rtkit root scard sddm shutdown smmsp squid sshd statd stunnel svn synapse sync sys syslog systemd-coredump systemd-journal-remote systemd-network systemd-resolve systemd-timesync tcpdump teamspeak tftp tinyproxy tor transmission tss turnserver usbmux unbound uucp uuidd vault vcsa webvirtmgr wildfly wwwrun www-data xfs youtrack zabbix-agent zabbix-server zabbix zerotier-one zerotier '_*'
|
||||
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
||||
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||
|
@ -50,16 +28,3 @@ zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipa
|
|||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost megumi _gateway pxm
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' '*.eeleater.org' '*sublime*' '*.local'
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
|
||||
|
||||
if [[ $COMPLETION_WAITING_DOTS = true ]]; then
|
||||
expand-or-complete-with-dots() {
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
|
||||
print -Pn "%{%F{red}......%f%}"
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
|
||||
|
||||
zle expand-or-complete
|
||||
zle redisplay
|
||||
}
|
||||
zle -N expand-or-complete-with-dots
|
||||
bindkey "^I" expand-or-complete-with-dots
|
||||
fi
|
11
zsh/files/history.zsh
Normal file
11
zsh/files/history.zsh
Normal file
|
@ -0,0 +1,11 @@
|
|||
HISTSIZE=50000
|
||||
SAVEHIST=20000
|
||||
HISTFILE=$HOME/.cache/zsh/history
|
||||
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history
|
|
@ -1,20 +1,3 @@
|
|||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init() {
|
||||
echoti smkx
|
||||
}
|
||||
function zle-line-finish() {
|
||||
echoti rmkx
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
|
||||
bindkey -e
|
||||
|
||||
bindkey '\ew' kill-region
|
||||
bindkey -s '\el' 'ls\n'
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
|
||||
if [[ "${terminfo[kpp]}" != "" ]]; then
|
||||
bindkey "${terminfo[kpp]}" up-line-or-history
|
||||
fi
|
||||
|
@ -43,17 +26,6 @@ if [[ "${terminfo[kend]}" != "" ]]; then
|
|||
bindkey "${terminfo[kend]}" end-of-line
|
||||
fi
|
||||
|
||||
bindkey ' ' magic-space
|
||||
|
||||
bindkey '^[[1;5C' forward-word
|
||||
bindkey '^[[1;5D' backward-word
|
||||
|
||||
if [[ "${terminfo[kcbt]}" != "" ]]; then
|
||||
bindkey "${terminfo[kcbt]}" reverse-menu-complete
|
||||
fi
|
||||
|
||||
bindkey '^?' backward-delete-char
|
||||
|
||||
if [[ "${terminfo[kdch1]}" != "" ]]; then
|
||||
bindkey "${terminfo[kdch1]}" delete-char
|
||||
else
|
||||
|
@ -61,9 +33,3 @@ else
|
|||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
fi
|
||||
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '\C-x\C-e' edit-command-line
|
||||
|
||||
bindkey "^[m" copy-prev-shell-word
|
44
zsh/files/termsupport.zsh
Normal file
44
zsh/files/termsupport.zsh
Normal file
|
@ -0,0 +1,44 @@
|
|||
function title {
|
||||
emulate -L zsh
|
||||
setopt prompt_subst
|
||||
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
: ${2=$1}
|
||||
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||
print -Pn "\e]2;$2:q\a"
|
||||
print -Pn "\e]1;$1:q\a"
|
||||
;;
|
||||
screen*|tmux*)
|
||||
print -Pn "\ek$1:q\e\\"
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function omz_termsupport_precmd {
|
||||
emulate -L zsh
|
||||
|
||||
title '%15<..<%~%<<' '%n@%m: %~'
|
||||
}
|
||||
|
||||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
|
@ -1,3 +0,0 @@
|
|||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
|
@ -1,121 +0,0 @@
|
|||
function take() {
|
||||
mkdir -p $@ && cd ${@:$#}
|
||||
}
|
||||
|
||||
function open_command() {
|
||||
local open_cmd
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd='open' ;;
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
|
||||
open_cmd='cmd.exe /c start ""'
|
||||
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||
} ;;
|
||||
msys*) open_cmd='start ""' ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
${=open_cmd} "$@" &>/dev/null
|
||||
}
|
||||
|
||||
function alias_value() {
|
||||
(( $+aliases[$1] )) && echo $aliases[$1]
|
||||
}
|
||||
|
||||
function try_alias_value() {
|
||||
alias_value "$1" || echo "$1"
|
||||
}
|
||||
|
||||
function default() {
|
||||
(( $+parameters[$1] )) && return 0
|
||||
typeset -g "$1"="$2" && return 3
|
||||
}
|
||||
|
||||
function env_default() {
|
||||
(( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
|
||||
export "$1=$2" && return 3
|
||||
}
|
||||
|
||||
zmodload zsh/langinfo
|
||||
|
||||
function omz_urlencode() {
|
||||
emulate -L zsh
|
||||
zparseopts -D -E -a opts r m P
|
||||
|
||||
local in_str=$1
|
||||
local url_str=""
|
||||
local spaces_as_plus
|
||||
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||
local str="$in_str"
|
||||
|
||||
local encoding=$langinfo[CODESET]
|
||||
local safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
|
||||
str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error converting string from $encoding to UTF-8" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
local i byte ord LC_ALL=C
|
||||
export LC_ALL
|
||||
local reserved=';/?:@&=+$,'
|
||||
local mark='_.!~*''()-'
|
||||
local dont_escape="[A-Za-z0-9"
|
||||
if [[ -z $opts[(r)-r] ]]; then
|
||||
dont_escape+=$reserved
|
||||
fi
|
||||
|
||||
if [[ -z $opts[(r)-m] ]]; then
|
||||
dont_escape+=$mark
|
||||
fi
|
||||
dont_escape+="]"
|
||||
|
||||
local url_str=""
|
||||
for (( i = 1; i <= ${#str}; ++i )); do
|
||||
byte="$str[i]"
|
||||
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||
url_str+="$byte"
|
||||
else
|
||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||
url_str+="+"
|
||||
else
|
||||
ord=$(( [##16] #byte ))
|
||||
url_str+="%$ord"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo -E "$url_str"
|
||||
}
|
||||
|
||||
function omz_urldecode {
|
||||
emulate -L zsh
|
||||
local encoded_url=$1
|
||||
|
||||
local caller_encoding=$langinfo[CODESET]
|
||||
local LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
local tmp=${encoded_url:gs/+/ /}
|
||||
tmp=${tmp:gs/\\/\\\\/}
|
||||
tmp=${tmp:gs/%/\\x/}
|
||||
local decoded
|
||||
eval "decoded=\$'$tmp'"
|
||||
|
||||
local safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then
|
||||
decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding)
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error converting string from UTF-8 to $caller_encoding" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -E "$decoded"
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
grep-flag-available() {
|
||||
echo | grep $1 "" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
GREP_OPTIONS=""
|
||||
|
||||
if grep-flag-available --color=auto; then
|
||||
GREP_OPTIONS+=" --color=auto"
|
||||
fi
|
||||
|
||||
VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
|
||||
|
||||
if grep-flag-available --exclude-dir=.cvs; then
|
||||
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
|
||||
elif grep-flag-available --exclude=.cvs; then
|
||||
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
|
||||
fi
|
||||
|
||||
alias grep="grep $GREP_OPTIONS"
|
||||
|
||||
unset GREP_OPTIONS
|
||||
unset VCS_FOLDERS
|
||||
unfunction grep-flag-available
|
|
@ -1,33 +0,0 @@
|
|||
function omz_history {
|
||||
local clear list
|
||||
zparseopts -E c=clear l=list
|
||||
|
||||
if [[ -n "$clear" ]]; then
|
||||
echo -n >| "$HISTFILE"
|
||||
echo >&2 History file deleted. Reload the session to see its effects.
|
||||
elif [[ -n "$list" ]]; then
|
||||
builtin fc "$@"
|
||||
else
|
||||
[[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
|
||||
fi
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
HISTSIZE=50000
|
||||
SAVEHIST=10000
|
||||
HISTFILE=$HOME/.cache/zsh/history
|
||||
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history
|
|
@ -1,18 +0,0 @@
|
|||
autoload -Uz is-at-least
|
||||
|
||||
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; then
|
||||
for d in $fpath; do
|
||||
if [[ -e "$d/url-quote-magic" ]]; then
|
||||
if is-at-least 5.1; then
|
||||
autoload -Uz bracketed-paste-magic
|
||||
zle -N bracketed-paste bracketed-paste-magic
|
||||
fi
|
||||
autoload -Uz url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
setopt long_list_jobs
|
||||
setopt interactivecomments
|
|
@ -1,79 +0,0 @@
|
|||
function title {
|
||||
emulate -L zsh
|
||||
setopt prompt_subst
|
||||
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
: ${2=$1}
|
||||
|
||||
case "$TERM" in
|
||||
cygwin|xterm*|putty*|rxvt*|ansi)
|
||||
print -Pn "\e]2;$2:q\a"
|
||||
print -Pn "\e]1;$1:q\a"
|
||||
;;
|
||||
screen*|tmux*)
|
||||
print -Pn "\ek$1:q\e\\"
|
||||
;;
|
||||
*)
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
print -Pn "\e]2;$2:q\a"
|
||||
print -Pn "\e]1;$1:q\a"
|
||||
else
|
||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||
echoti tsl
|
||||
print -Pn "$1"
|
||||
echoti fsl
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<"
|
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
|
||||
|
||||
if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then
|
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m"
|
||||
fi
|
||||
|
||||
function omz_termsupport_precmd {
|
||||
emulate -L zsh
|
||||
|
||||
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||
}
|
||||
|
||||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
setopt extended_glob
|
||||
|
||||
if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
||||
|
||||
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
function update_terminalapp_cwd() {
|
||||
emulate -L zsh
|
||||
|
||||
local URL_PATH="$(omz_urlencode -P $PWD)"
|
||||
[[ $? != 0 ]] && return 1
|
||||
|
||||
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
|
||||
}
|
||||
|
||||
precmd_functions+=(update_terminalapp_cwd)
|
||||
update_terminalapp_cwd
|
||||
fi
|
|
@ -1,7 +0,0 @@
|
|||
# ALIASES
|
||||
alias ta='tmux attach -t'
|
||||
alias tad='tmux attach -d -t'
|
||||
alias ts='tmux new-session -s'
|
||||
alias tl='tmux list-sessions'
|
||||
alias tksv='tmux kill-server'
|
||||
alias tkss='tmux kill-session -t'
|
|
@ -1,11 +0,0 @@
|
|||
alias ls='exa -al --color=always --group-directories-first'
|
||||
alias la='exa -a --color=always --group-directories-first'
|
||||
alias ll='exa -l --color=always --group-directories-first'
|
||||
alias lt='exa -aT --color=always --group-directories-first'
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
alias duplHostKeys='cat ~/.ssh/known_hosts | egrep -v "mesh.eu|inetbone.net" | cut -d" " -f3 | sort | uniq -d'
|
||||
alias tb="nc termbin.com 9999"
|
|
@ -1,141 +0,0 @@
|
|||
# Docker
|
||||
_appup_docker () {
|
||||
if hash docker-compose >/dev/null 2>&1; then
|
||||
# Check if docker has been started
|
||||
if [ "${APPUP_CHECK_STARTED:-true}" = true ]; then
|
||||
if hash docker-machine >/dev/null 2>&1 && [ "${APPUP_DOCKER_MACHINE:-true}" = true ]; then
|
||||
if docker-machine status | grep -qi "Stopped"; then
|
||||
read -r -k 1 "REPLY?Docker Machine is not running, would you like to start it? [y/N] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
docker-machine start default && eval $(docker-machine env default)
|
||||
echo ""
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
elif docker ps 2>&1 | grep -qi "Is the docker daemon running?"; then
|
||||
read -r -k 1 "REPLY?Docker for Mac is not running, would you like to start it? [y/N] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
open -a Docker
|
||||
|
||||
echo ""
|
||||
echo "Waiting for docker to start.."
|
||||
echo ""
|
||||
|
||||
# Wait for it to start
|
||||
while true; do
|
||||
if docker ps 2>&1 | grep -qi "Is the docker daemon running?" || docker ps 2>&1 | grep -qi "connection refused"; then
|
||||
sleep 5
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
return0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check YAML extension
|
||||
compose_file=''
|
||||
compose_project_file=''
|
||||
|
||||
if [ -e "docker-compose.yml" ]; then
|
||||
compose_file='docker-compose.yml'
|
||||
elif [ -e "docker-compose.yaml" ]; then
|
||||
compose_file='docker-compose.yaml'
|
||||
fi
|
||||
|
||||
# <cmd> <project name> will look for docker-compose.<project name>.yml
|
||||
if [ -n "$2" ]; then
|
||||
if [ -e "docker-compose.$2.yml" ]; then
|
||||
compose_project_file="docker-compose.$2.yml"
|
||||
elif [ -e "docker-compose.$2.yaml" ]; then
|
||||
compose_project_file="docker-compose.$2.yaml"
|
||||
fi
|
||||
|
||||
if [ -n "$compose_project_file" ]; then
|
||||
# Override project name from custom env
|
||||
if [ -e ".env.$2" ]; then
|
||||
project=$(source ".env.$2"; echo $COMPOSE_PROJECT_NAME)
|
||||
|
||||
if [ -n $project ]; then
|
||||
docker-compose -p "${project}" -f "$compose_file" -f "$compose_project_file" $1 "${@:3}"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
docker-compose -f "$compose_file" -f "$compose_project_file" $1 "${@:3}"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
docker-compose $1 "${@:2}"
|
||||
else
|
||||
echo >&2 "Docker compose file found but docker-compose is not installed."
|
||||
fi
|
||||
}
|
||||
|
||||
# Vagrant
|
||||
_appup_vagrant () {
|
||||
if hash vagrant >/dev/null 2>&1; then
|
||||
vagrant $1 "${@:2}"
|
||||
else
|
||||
echo >&2 "Vagrant file found but vagrant is not installed."
|
||||
fi
|
||||
}
|
||||
|
||||
# Commands
|
||||
up () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker up "$@"
|
||||
elif [ -e "Vagrantfile" ]; then
|
||||
_appup_vagrant up "$@"
|
||||
elif hash up >/dev/null 2>&1; then
|
||||
env up "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
down () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker down "$@"
|
||||
elif [ -e "Vagrantfile" ]; then
|
||||
_appup_vagrant destroy "$@"
|
||||
elif hash down >/dev/null 2>&1; then
|
||||
env down "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
start () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker start "$@"
|
||||
elif [ -e "Vagrantfile" ]; then
|
||||
_appup_vagrant up "$@"
|
||||
elif hash start >/dev/null 2>&1; then
|
||||
env start "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
restart () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker restart "$@"
|
||||
elif [ -e "Vagrantfile" ]; then
|
||||
_appup_vagrant reload "$@"
|
||||
elif hash start >/dev/null 2>&1; then
|
||||
env start "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
stop () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker stop "$@"
|
||||
elif [ -e "Vagrantfile" ]; then
|
||||
_appup_vagrant halt "$@"
|
||||
elif hash stop >/dev/null 2>&1; then
|
||||
env stop "$@"
|
||||
fi
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
function colored() {
|
||||
command env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" "$@"
|
||||
}
|
||||
|
||||
# Colorize man and dman/debman (from debian-goodies)
|
||||
function man dman debman {
|
||||
colored $0 "$@"
|
||||
}
|
|
@ -1,82 +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.zst|*.tzst)
|
||||
tar --zstd --help &> /dev/null \
|
||||
&& tar --zstd -xvf "$1" \
|
||||
|| zstdcat "$1" | tar xvf - ;;
|
||||
(*.tar) tar xvf "$1" ;;
|
||||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$1" ;;
|
||||
(*.tar.lz4) lz4 -c -d "$1" | tar xvf - ;;
|
||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$1" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$1" || gunzip -k "$1" ;;
|
||||
(*.bz2) bunzip2 "$1" ;;
|
||||
(*.xz) unxz "$1" ;;
|
||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$1" ;;
|
||||
(*.lz4) lz4 -d "$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" ;;
|
||||
(*.rpm) mkdir "$extract_dir" && cd "$extract_dir" && rpm2cpio "../$1" | cpio --quiet -id && cd .. ;;
|
||||
(*.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 ..
|
||||
;;
|
||||
(*.zst) unzstd "$1" ;;
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" >&2
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||
shift
|
||||
done
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
|
||||
|
||||
_gitignoreio_get_command_list() {
|
||||
curl -sfL https://www.gitignore.io/api/list | tr "," "\n"
|
||||
}
|
||||
|
||||
_gitignoreio () {
|
||||
compset -P '*,'
|
||||
compadd -S '' `_gitignoreio_get_command_list`
|
||||
}
|
||||
|
||||
compdef _gitignoreio gi
|
|
@ -1,5 +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
|
Loading…
Add table
Reference in a new issue