feat(common): fixed ydig zsh function; updated some other zsh related customizations
This commit is contained in:
parent
7a009b0cbc
commit
22847db529
5 changed files with 72 additions and 12 deletions
|
@ -4,13 +4,15 @@ alias e="emacs"
|
||||||
alias grep="egrep --color"
|
alias grep="egrep --color"
|
||||||
alias cpr="rsync -rlptgoDAXhP --info=all0,progress2"
|
alias cpr="rsync -rlptgoDAXhP --info=all0,progress2"
|
||||||
alias rcp="cpr"
|
alias rcp="cpr"
|
||||||
alias ll="eza -lahv --color"
|
alias ll="eza -lah --color"
|
||||||
alias l="eza -l -g --icons --all --all"
|
alias l="eza -l -g --icons --all --all"
|
||||||
alias ls="eza"
|
alias ls="eza"
|
||||||
alias xclip="xclip -sel clipboard"
|
alias xclip="xclip -sel clipboard"
|
||||||
alias git='GIT_COMMITTER_DATE="$(date +%Y-%m-%d) 00:00:00+0000" GIT_AUTHOR_DATE="$(date +%Y-%m-%d) 00:00:00+0000" git'
|
alias git='GIT_COMMITTER_DATE="$(date +%Y-%m-%d) 00:00:00+0000" GIT_AUTHOR_DATE="$(date +%Y-%m-%d) 00:00:00+0000" git'
|
||||||
alias cat=bat
|
alias cat=batcat
|
||||||
alias less=bat
|
alias less=batcat
|
||||||
|
alias bat=batcat
|
||||||
|
alias emacs='emacsclient --create-frame --alternate-editor=""'
|
||||||
|
|
||||||
# Dev
|
# Dev
|
||||||
alias dcl="docker container ls -a --format='{{ .ID }}\t{{ .Names }}\t{{ index (split .Status \" \") 0 }}' | sort -k3r -k2 | column -t -N ID,Name,State"
|
alias dcl="docker container ls -a --format='{{ .ID }}\t{{ .Names }}\t{{ index (split .Status \" \") 0 }}' | sort -k3r -k2 | column -t -N ID,Name,State"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# https://github.com/zsh-users/zsh-completions
|
# https://github.com/zsh-users/zsh-completions
|
||||||
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
||||||
|
fpath+=/usr/lib/x86_64-linux-gnu/rubygems-integration/3.1.0/gems/vagrant-2.3.8.dev/contrib/zsh
|
||||||
|
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
if command -v ansible &> /dev/null; then
|
if command -v ansible &> /dev/null; then
|
||||||
|
@ -14,9 +15,11 @@ if command -v ansible &> /dev/null; then
|
||||||
source <(register-python-argcomplete ansible-vault)
|
source <(register-python-argcomplete ansible-vault)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
autoload -U compinit && compinit
|
|
||||||
|
|
||||||
command -v boundary &> /dev/null && complete -o nospace -C /usr/bin/boundary boundary || true
|
command -v boundary &> /dev/null && complete -o nospace -C /usr/bin/boundary boundary || true
|
||||||
command -v molecule &> /dev/null && source <(_MOLECULE_COMPLETE=zsh_source molecule) || true
|
command -v molecule &> /dev/null && source <(_MOLECULE_COMPLETE=zsh_source molecule) || true
|
||||||
command -v helm &> /dev/null && source <(helm completion zsh) || true
|
command -v helm &> /dev/null && source <(helm completion zsh) || true
|
||||||
command -v noseyparker &> /dev/null && source <(noseyparker shell-completions --shell zsh) || true
|
command -v noseyparker &> /dev/null && source <(noseyparker shell-completions --shell zsh) || true
|
||||||
|
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion"
|
||||||
|
|
||||||
|
autoload -U compinit && compinit
|
||||||
|
|
|
@ -3,7 +3,7 @@ export RUBY_VERSION="3.1"
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
export DEFAULT_USER=$(id -un)
|
export DEFAULT_USER=$(id -un)
|
||||||
export EDITOR=emacs
|
export EDITOR="emacsclient -t"
|
||||||
export TERM=xterm-256color
|
export TERM=xterm-256color
|
||||||
export LESS='-R'
|
export LESS='-R'
|
||||||
export LESSOPEN='|~/.lessfilter %s'
|
export LESSOPEN='|~/.lessfilter %s'
|
||||||
|
@ -12,11 +12,13 @@ export SSH_KEY_PATH="${HOME}/.ssh/id_ed25519"
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
export GPG_TTY="${TTY}"
|
export GPG_TTY="${TTY}"
|
||||||
|
|
||||||
|
export PINENTRY_USER_DATA="connect/greeter"
|
||||||
|
{ [ -n "${SSH_CLIENT}" ] || [ -n "${SSH_CONNECTION}" ] || [ -n "${SSH_TTY}" ]; } && export PINENTRY_USER_DATA="connect/ssh"
|
||||||
|
|
||||||
# Dev
|
# Dev
|
||||||
[ -d "$HOME/.nvm" ] && export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -d "$HOME/.nvm" ] && export NVM_SYMLINK_CURRENT=true
|
|
||||||
# shellcheck disable=SC1090
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
|
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
# shellcheck disable=SC1090
|
||||||
[ -d "${HOME}/.local/share/gems/ruby/${RUBY_VERSION}" ] && export GEM_DIR="${HOME}/.local/share/gems/ruby/${RUBY_VERSION}"
|
[ -d "${HOME}/.local/share/gems/ruby/${RUBY_VERSION}" ] && export GEM_DIR="${HOME}/.local/share/gems/ruby/${RUBY_VERSION}"
|
||||||
[ -d "${HOME}/.cargo/env" ] && source "${HOME}/.cargo/env"
|
[ -d "${HOME}/.cargo/env" ] && source "${HOME}/.cargo/env"
|
||||||
|
|
||||||
|
@ -27,3 +29,4 @@ export PATH="${PATH}:${HOME}/.local/bin"
|
||||||
[ -d "/usr/local/go/bin" ] && export PATH="${PATH}:/usr/local/go/bin"
|
[ -d "/usr/local/go/bin" ] && export PATH="${PATH}:/usr/local/go/bin"
|
||||||
[ -d "$HOME/.cargo/bin" ] && export PATH="${PATH}:$HOME/.cargo/bin"
|
[ -d "$HOME/.cargo/bin" ] && export PATH="${PATH}:$HOME/.cargo/bin"
|
||||||
[ -d "$HOME/.local/share/JetBrains/Toolbox/scripts" ] && export PATH="${PATH}:$HOME/.local/share/JetBrains/Toolbox/scripts"
|
[ -d "$HOME/.local/share/JetBrains/Toolbox/scripts" ] && export PATH="${PATH}:$HOME/.local/share/JetBrains/Toolbox/scripts"
|
||||||
|
[ -d "${HOME}/.config/emacs/bin" ] && export PATH="${PATH}:${HOME}/.config/emacs/bin"
|
||||||
|
|
|
@ -1,5 +1,36 @@
|
||||||
function ydig() {
|
function ydig() {
|
||||||
\dig +yaml "${@}" | yq '.[].message.response_message_data|{"answer": .ANSWER_SECTION, status}'
|
\dig +yaml "${@}" | yq '.[].message.response_message_data|{"answer": .ANSWER_SECTION, "status": .status}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function sshfs-target() {
|
||||||
|
local targetHost="${1}"
|
||||||
|
local remoteDir="${2}"
|
||||||
|
local mountPoint=${3}
|
||||||
|
|
||||||
|
sshfs "${DEFAULT_USER:=$(id -un)}"@"${targetHost}":"${remoteDir}" "${mountPoint}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ex: ssh-forward 0.0.0.0:3306 bastion.host protected-sql-server.remote:3306
|
||||||
|
function ssh-forward() {
|
||||||
|
local localIp="${1}"
|
||||||
|
shift
|
||||||
|
local jumpHost="${1}"
|
||||||
|
shift
|
||||||
|
local targetHost="${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
ssh -qN -L "${localIp}":"${targetHost}" "${jumpHost}" "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function composerX() {
|
||||||
|
local composerBinary
|
||||||
|
local phpBinary
|
||||||
|
local phpVersion="${1}"
|
||||||
|
shift
|
||||||
|
composerBinary=$(command -v composer)
|
||||||
|
phpBinary=$(command -v php"${phpVersion}")
|
||||||
|
|
||||||
|
${phpBinary} "${composerBinary}" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubeshell() {
|
function kubeshell() {
|
||||||
|
|
|
@ -42,13 +42,34 @@ CASE_SENSITIVE="true"
|
||||||
|
|
||||||
HIST_STAMPS="yyyy.mm.dd"
|
HIST_STAMPS="yyyy.mm.dd"
|
||||||
|
|
||||||
plugins=(autopep8 aws branch colored-man-pages colorize composer docker docker-compose git kubectl kube-ps1 npm nvm pass pep8 pip redis-cli rsync rust terraform)
|
plugins=(
|
||||||
|
autopep8
|
||||||
|
aws
|
||||||
|
branch
|
||||||
|
colored-man-pages
|
||||||
|
colorize
|
||||||
|
composer
|
||||||
|
docker
|
||||||
|
docker-compose
|
||||||
|
git
|
||||||
|
kubectl
|
||||||
|
kube-ps1
|
||||||
|
npm
|
||||||
|
nvm
|
||||||
|
pass
|
||||||
|
pep8
|
||||||
|
pip
|
||||||
|
redis-cli
|
||||||
|
rsync
|
||||||
|
rust
|
||||||
|
terraform
|
||||||
|
)
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
[ -f ~/.env ] && source ~/.env
|
||||||
[ -f ~/.zsh_exports ] && source ~/.zsh_exports
|
[ -f ~/.zsh_exports ] && source ~/.zsh_exports
|
||||||
[ -f ~/.p10k.zsh ] && source ~/.p10k.zsh
|
[ -f ~/.p10k.zsh ] && source ~/.p10k.zsh
|
||||||
[ -f ~/.zsh_functions ] && source ~/.zsh_functions
|
[ -f ~/.zsh_functions ] && source ~/.zsh_functions
|
||||||
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
|
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
|
||||||
[ -f ~/.env ] && source ~/.env
|
|
||||||
[ -f ~/.zsh_completions ] && source ~/.zsh_completions
|
[ -f ~/.zsh_completions ] && source ~/.zsh_completions
|
||||||
|
|
Loading…
Add table
Reference in a new issue