Update PROJECT_NAME on cd

This commit is contained in:
Daniel Lynn 2023-04-19 12:06:25 -05:00
parent b7e826b392
commit 9fb4d582ce
Signed by: daniel
GPG Key ID: 28496A140E180A9D
4 changed files with 13 additions and 7 deletions

View File

@ -1,12 +1,12 @@
# gh # gh
if (( $+commands[gh] )); then if (( $+commands[gh] )); then
gh_chpwd_hook() { _gh_chpwd_hook() {
if [[ -d ".github" ]]; then if [[ -d ".github" ]]; then
PAGER= gh pr list PAGER= gh pr list
fi fi
} }
chpwd_functions+=( gh_chpwd_hook ) chpwd_functions+=( _gh_chpwd_hook )
gh_chpwd_hook _gh_chpwd_hook
fi fi

View File

@ -1,12 +1,12 @@
# git # git
if (( $+commands[git] )); then if (( $+commands[git] )); then
git_chpwd_hook() { _git_chpwd_hook() {
if [[ -d ".git" ]]; then if [[ -d ".git" ]]; then
git status git status
fi fi
} }
chpwd_functions+=( git_chpwd_hook ) chpwd_functions+=( _git_chpwd_hook )
git_chpwd_hook _git_chpwd_hook
fi fi

7
zsh.d/project_name.zsh Normal file
View File

@ -0,0 +1,7 @@
_project_name_chpwd_hook() {
export PROJECT_NAME="${PWD##*/}"
}
chpwd_functions+=( _project_name_chpwd_hook )
_project_name_chpwd_hook

View File

@ -8,7 +8,6 @@ export HELIX_RUNTIME="$HOME/src/helix/runtime"
export NVM_DIR="$HOME/.nvm" export NVM_DIR="$HOME/.nvm"
export SKIM_DEFAULT_COMMAND="git ls-tree -r --name-only HEAD || rg --files" export SKIM_DEFAULT_COMMAND="git ls-tree -r --name-only HEAD || rg --files"
export VISUAL="helix" export VISUAL="helix"
export PROJECT_NAME="${PWD##*/}"
fpath+=(~/.zsh/completions) fpath+=(~/.zsh/completions)