From 5622ac654af06b513e3c2dfb9fea586884d2ba7d Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Wed, 7 Dec 2022 18:59:49 -0800 Subject: [PATCH] Consolidate rgenv and update aliases files --- zsh-linux/.config/zsh-linux/00-aliases.zsh | 9 ----- zsh-macos/.config/zsh-macos/00-aliases.zsh | 39 ++++++---------------- zsh/.config/zsh/.zshrc | 8 +++++ 3 files changed, 18 insertions(+), 38 deletions(-) diff --git a/zsh-linux/.config/zsh-linux/00-aliases.zsh b/zsh-linux/.config/zsh-linux/00-aliases.zsh index 83e799b..3b8e0f7 100644 --- a/zsh-linux/.config/zsh-linux/00-aliases.zsh +++ b/zsh-linux/.config/zsh-linux/00-aliases.zsh @@ -110,7 +110,6 @@ alias zdotdir='cd -- ${ZDOTDIR:-${HOME}/.zsh}' alias zshaliases='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/00-aliases.zsh' alias zbindings='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/keybindings.zsh' alias zconf='cd -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d' -alias zfuncs='cd -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/functions' alias zhist='${EDITOR} -- ${HISTFILE}' alias zmod='cd -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/modules' alias zpath='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/path.zsh' @@ -128,14 +127,6 @@ lsbin() { fi } -rgenv () { - if [[ -n $1 ]]; then - env | rg --ignore-case $1 - else - return 0 - fi -} - stow-config () { local dotfile_dir="${HOME}/Dotfiles" diff --git a/zsh-macos/.config/zsh-macos/00-aliases.zsh b/zsh-macos/.config/zsh-macos/00-aliases.zsh index ddcc2fe..bfbe24b 100644 --- a/zsh-macos/.config/zsh-macos/00-aliases.zsh +++ b/zsh-macos/.config/zsh-macos/00-aliases.zsh @@ -107,42 +107,23 @@ alias myip='curl ifconfig.me' alias restartfans='sudo systemctl restart fancontrol.service' # zsh -alias zdotdir='cd -- ${ZDOTDIR:-${HOME}/.zsh}' -alias zshaliases='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/00-aliases.zsh' -alias zbindings='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/keybindings.zsh' -alias zconf='cd -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d' -alias zfuncs='cd -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/functions' -alias zhist='${EDITOR} -- ${HISTFILE}' -alias zmod='cd -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/modules' -alias zpath='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/path.zsh' -alias zprompt='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/conf.d/prompt.zsh' -alias zshrc='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/.zshrc' -alias zshrefresh='source -- ${ZDOTDIR:-${HOME}/.zsh}/.zshrc' -alias zshenv='${EDITOR} -- ${ZDOTDIR:-${HOME}/.zsh}/.zshenv' +alias zdotdir='cd -- "$ZDOTDIR"' +alias zshaliases='${EDITOR} -- "$XDG_CONFIG_HOME"/zsh-macos/00-aliases.zsh' +alias zbindings='${EDITOR} -- "$XDG_CONFIG_HOME"/zsh/00-keybindings.zsh' +alias zconf='cd -- $ZDOTDIR' +alias zhist='${EDITOR} -- "${HISTFILE}"' +alias zpath='${EDITOR} -- "$XDG_CONFIG_HOME"/zsh-macos/path.zsh' +alias zprompt='${EDITOR} -- "$ZDOTDIR"/prompt.zsh' +alias zshrc='${EDITOR} -- "$ZDOTDIR"/.zshrc' +alias zshenv='${EDITOR} -- "$ZDOTDIR"/.zshenv' # ---------- Parameterized Aliases ---------- -lsbin() { - if [[ -n $1 ]]; then - pacman -Qql $1 | rg bin - else - return 0 - fi -} - -rgenv () { - if [[ -n $1 ]]; then - env | rg --ignore-case $1 - else - return 0 - fi -} - stow-config () { local dotfile_dir="${HOME}/Dotfiles" for conf in "${@}"; do if [[ -n ${conf} ]]; then - mkdir --parents "${dotfile_dir}/${conf}/.config" + mkdir -p "${dotfile_dir}/${conf}/.config" mv "${XDG_CONFIG_HOME}/${conf}" "${dotfile_dir}/${conf}/.config" cd "${dotfile_dir}" && stow "${conf}" cd - diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 8ff0410..5330f06 100755 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -61,6 +61,14 @@ mkcd() { autoload -Uz mkcd +rgenv () { + if [[ -n $1 ]]; then + env | rg --ignore-case $1 + else + return 0 + fi +} + # Detect OS to autoload uncommon config files if [[ "$(uname)" =~ "Darwin" ]]; then for dotfile in "$XDG_CONFIG_HOME"/zsh-macos/*(.); do