Skip to content

Commit d32e01a

Browse files
author
Daniel Lindegren
committed
refactor: reorganize .zshenv with improved path management
- Add helper function add_to_path() for cleaner PATH manipulation - Group environment variables by category with clear section comments - Uncomment /usr/local/sbin path addition - Add EDITOR and VISUAL environment variables for nvim - Remove unnecessary comment lines and improve formatting
1 parent 0befe00 commit d32e01a

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

common/.zshenv

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
#
21
# ~/.zshenv
3-
#
4-
if [ -d "$HOME/.bin" ]; then
5-
export PATH="$HOME/.bin:$PATH"
6-
fi
7-
8-
if [ -d "$HOME/.android/android-sdk/platform-tools" ]; then
9-
export PATH="$HOME/.android/android-sdk/platform-tools:$PATH"
10-
fi
11-
12-
if [ -d "/Applications/Visual Studio Code.app/Contents/Resources/app/bin" ]; then
13-
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
14-
fi
15-
16-
#if [ -d "/usr/local/sbin" ]; then
17-
# export PATH="/usr/local/sbin:$PATH"
18-
#fi
192

3+
# ---------------------------------
4+
# Path Configuration
5+
# ---------------------------------
6+
7+
# Function to safely add directories to PATH
8+
add_to_path() {
9+
if [ -d "$1" ]; then
10+
export PATH="$1:$PATH"
11+
fi
12+
}
13+
14+
# Add directories to PATH
15+
add_to_path "$HOME/.bin"
16+
add_to_path "$HOME/.android/android-sdk/platform-tools"
17+
add_to_path "/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
18+
add_to_path "/usr/local/share/python"
19+
add_to_path "$HOME/.poetry/bin"
20+
add_to_path "$HOME/homebrew/bin"
21+
22+
# ---------------------------------
23+
# Development Environment Variables
24+
# ---------------------------------
25+
26+
# NVM configuration
2027
if [ -d "$HOME/.nvm" ]; then
21-
export NVM_DIR="$HOME/.nvm"
28+
export NVM_DIR="$HOME/.nvm"
2229
fi
2330

24-
if [ -d "/usr/local/share/python" ]; then
25-
export PATH="/usr/local/share/python:$PATH"
26-
fi
27-
28-
if [ -d "$HOME/.poetry/bin" ]; then
29-
export PATH="$HOME/.poetry/bin:$PATH"
30-
fi
31-
32-
if [ -d "$HOME/homebrew/bin" ]; then
33-
export PATH="$HOME/homebrew/bin:$PATH"
34-
fi
35-
36-
# Configuration for virtualenv
31+
# Python virtualenv configuration
3732
export WORKON_HOME=$HOME/.virtualenvs
3833
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
3934
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
4035

36+
# Package configuration
4137
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/zlib/1.2.11/lib/pkgconfig/
38+
39+
# ---------------------------------
40+
# Editor Configuration
41+
# ---------------------------------
42+
export EDITOR="nvim"
43+
export VISUAL="nvim"

0 commit comments

Comments
 (0)