Skip to content

Commit

Permalink
fix: consolidate changes to PATh
Browse files Browse the repository at this point in the history
  • Loading branch information
natelandau committed Sep 8, 2024
1 parent c3f278f commit 3179fe2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 39 deletions.
16 changes: 0 additions & 16 deletions dotfiles/dot_bashrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ esac
# set default umask
umask 002

# Build PATH
_myPaths=(
"${HOME}/.local/bin"
"/usr/local/bin"
"/opt/homebrew/bin"
"${HOME}/bin"
)

for _path in "${_myPaths[@]}"; do
if [[ -d ${_path} ]]; then
if ! printf "%s" "${_path}" | grep -q "${PATH}"; then
PATH="${_path}:${PATH}"
fi
fi
done

### SOURCE BASH PLUGINS ###

# Locations containing files *.bash to be sourced to your environment
Expand Down
17 changes: 17 additions & 0 deletions dotfiles/dot_shell/sourced/0040-path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build PATH
_myPaths=(
"${HOME}/.local/bin"
"/usr/local/bin"
"/opt/homebrew/bin"
"${HOME}/bin"
"${HOME}/.cargo/bin"
"/usr/bin/snap"
)

for _path in "${_myPaths[@]}"; do
if [[ -d ${_path} ]]; then
if ! printf "%s" "${_path}" | grep -q "${PATH}"; then
PATH="${_path}:${PATH}"
fi
fi
done
4 changes: 0 additions & 4 deletions dotfiles/dot_shell/sourced/080-linux.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ aup() {
apt list --upgradable
}

if [ -e "/usr/bin/snap" ]; then
PATH="/snap/bin:${PATH}"
fi

# Systemctl aliases

alias ctl='systemctl'
Expand Down
11 changes: 9 additions & 2 deletions dotfiles/dot_shell/sourced/080-macos.sh.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if eq .chezmoi.os "darwin" }}

alias cpwd="pwd | tr -d '\n' | pbcopy" # Copy the working path to clipboard
alias cl="fc -e -|pbcopy" # Copy output of last command to clipboard
alias caff="caffeinate -ism" # Run command without letting mac sleep
Expand All @@ -13,8 +14,14 @@ alias spot-file="lsof -c '/mds$/'"

alias cleanupLS="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" # Clean up LaunchServices to remove duplicates in the "Open With" menu

listdsstore() { echo "Listing .DS_Store files..."; find "${@:-.}" -type f -name .DS_Store -print; } #list the .DS_Store files in the current directory and subdirectories
rmdsstore() { echo "Removing .DS_Store files..."; find "${@:-.}" -type f -name .DS_Store -delete -print; } # Recursively delete .DS_Store files, verbosely outputting what is being deleted.
listdsstore() {
echo "Listing .DS_Store files..."
find "${@:-.}" -type f -name .DS_Store -print
} #list the .DS_Store files in the current directory and subdirectories
rmdsstore() {
echo "Removing .DS_Store files..."
find "${@:-.}" -type f -name .DS_Store -delete -print
} # Recursively delete .DS_Store files, verbosely outputting what is being deleted.

# Search for a file using MacOS Spotlight's metadata
spotlight() { mdfind "kMDItemDisplayName == '${1}'wc"; }
Expand Down
1 change: 0 additions & 1 deletion dotfiles/dot_shell/sourced/third-party/pipx.sh.tmpl

This file was deleted.

16 changes: 0 additions & 16 deletions dotfiles/dot_zshrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@ elif [[ $0 == 'bash' ]]; then
exit
fi

# Build PATH
#############################################
_myPaths=(
"${HOME}/.local/bin"
"/usr/local/bin"
"/opt/homebrew/bin"
"${HOME}/bin"
)

for _path in "${_myPaths[@]}"; do
if [[ -d ${_path} ]]; then
if ! printf "%s" "${_path}" | grep -q "${PATH}"; then
PATH="${_path}:${PATH}"
fi
fi
done

unset _myPaths _path

Expand Down

0 comments on commit 3179fe2

Please sign in to comment.