update shell config
This commit is contained in:
@@ -22,9 +22,6 @@ prepend_path() {
|
||||
esac
|
||||
}
|
||||
|
||||
# .profile is not included in the repo
|
||||
[ -f "$HOME/.profile" ] && . "$HOME/.profile"
|
||||
|
||||
# Better than nothing
|
||||
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||
@@ -37,8 +34,15 @@ if [[ -z "$LANG" ]]; then
|
||||
export LANG
|
||||
fi
|
||||
|
||||
# .profile is not included in the repo
|
||||
[ -f "$HOME/.profile" ] && . "$HOME/.profile"
|
||||
|
||||
# Paths
|
||||
[ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env"
|
||||
if type opam &>/dev/null; then
|
||||
eval "$(opam env)"
|
||||
fi
|
||||
prepend_path "$HOME/.cargo/bin"
|
||||
prepend_path "$HOME/go/bin"
|
||||
prepend_path "$HOME/.local/bin"
|
||||
prepend_path "$HOME/.local/scripts"
|
||||
|
||||
+22
-1
@@ -31,7 +31,7 @@ if ! shopt -oq posix; then
|
||||
fi
|
||||
fi
|
||||
|
||||
for app in nvim helix vim vi nano; do
|
||||
for app in helix nvim vim vi nano; do
|
||||
if type "$app" &>/dev/null; then
|
||||
EDITOR="$app"
|
||||
VISUAL="$app"
|
||||
@@ -69,3 +69,24 @@ fi
|
||||
if type starship &>/dev/null; then
|
||||
eval "$(starship init bash)"
|
||||
fi
|
||||
|
||||
if type fzf &>/dev/null; then
|
||||
source <(fzf --bash)
|
||||
|
||||
# use fd if available (search cwd only, skip vcs/cache junk)
|
||||
if type fd &>/dev/null; then
|
||||
export FD_CMD="fd"
|
||||
elif type fdfind &>/dev/null; then
|
||||
export FD_CMD="fdfind"
|
||||
fi
|
||||
if [[ -n "$FD_CMD" ]]; then
|
||||
export FZF_DEFAULT_COMMAND="$FD_CMD --type f --hidden --exclude .git"
|
||||
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||
export FZF_ALT_C_COMMAND="$FD_CMD --type d --hidden --exclude .git"
|
||||
fi
|
||||
|
||||
# C-y to copy fzf's output
|
||||
if type wl-copy &>/dev/null; then
|
||||
export FZF_DEFAULT_OPTS="--bind \"ctrl-y:execute-silent(echo -n {+} | wl-copy)+abort\""
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -9,4 +9,5 @@
|
||||
!10-sshs.zsh
|
||||
!50-prompt.zsh
|
||||
!60-alias.zsh
|
||||
!60-direnv.zsh
|
||||
!60-fetch.zsh
|
||||
|
||||
@@ -8,6 +8,8 @@ setopt HIST_IGNORE_DUPS HIST_SAVE_NO_DUPS HIST_FIND_NO_DUPS
|
||||
setopt HIST_IGNORE_SPACE HIST_REDUCE_BLANKS INC_APPEND_HISTORY
|
||||
setopt HIST_VERIFY
|
||||
|
||||
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/zsh"
|
||||
|
||||
# Shell options
|
||||
|
||||
setopt AUTO_CD EXTENDED_GLOB NOTIFY INTERACTIVE_COMMENTS
|
||||
|
||||
@@ -59,7 +59,7 @@ uy_done_precmd() {
|
||||
--urgency="$urgency" \
|
||||
--icon=utilities-terminal \
|
||||
--app-name=zsh \
|
||||
"$title" "$wd/ $uy_done_cmd" &
|
||||
"$title" "$wd/ $uy_done_cmd" & disown
|
||||
}
|
||||
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
if (( $+commands[direnv] )); then
|
||||
eval "$(direnv hook zsh)"
|
||||
fi
|
||||
+1
-54
@@ -1,56 +1,6 @@
|
||||
#!/hint/zsh
|
||||
|
||||
# Login shell only — runs once per session (like .bash_profile)
|
||||
|
||||
# Path helpers (needed before sourcing .profile)
|
||||
|
||||
append_path() {
|
||||
[[ -z "$1" ]] && return
|
||||
[[ -d "$1" ]] || return
|
||||
case ":$PATH:" in
|
||||
*:"$1":*) ;;
|
||||
*)
|
||||
PATH="${PATH:+$PATH:}$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
prepend_path() {
|
||||
[[ -z "$1" ]] && return
|
||||
[[ -d "$1" ]] || return
|
||||
case ":$PATH:" in
|
||||
*:"$1":*) ;;
|
||||
*)
|
||||
PATH="$1${PATH:+:$PATH}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# XDG, better than not set
|
||||
|
||||
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||
export XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
|
||||
export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
|
||||
|
||||
# Locale, better than not set
|
||||
|
||||
if [[ -z "$LANG" ]]; then
|
||||
export LANG="en_US.UTF-8"
|
||||
fi
|
||||
|
||||
# .profile is not included in the repo (private / per-device)
|
||||
[[ -f "$HOME/.profile" ]] && . "$HOME/.profile"
|
||||
|
||||
# Paths
|
||||
|
||||
[[ -f "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
|
||||
(( $+commands[opam] )) && eval "$(opam env)"
|
||||
prepend_path "$HOME/.cargo/bin"
|
||||
prepend_path "$HOME/go/bin"
|
||||
prepend_path "$HOME/.local/bin"
|
||||
prepend_path "$HOME/.local/scripts"
|
||||
prepend_path "$HOME/.local/share/fnm"
|
||||
export PATH
|
||||
# Login shell only — runs once per session
|
||||
|
||||
# GPG agent for SSH
|
||||
|
||||
@@ -70,6 +20,3 @@ if (( $+commands[ssh-add] )) && (( $+commands[ssh-agent] )) &&
|
||||
eval "$($HOME/.local/scripts/ssh-init 2>/dev/null)" &>/dev/null
|
||||
export UY_USING_SSH_AGENT=1
|
||||
fi
|
||||
|
||||
unfunction append_path
|
||||
unfunction prepend_path
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/hint/zsh
|
||||
|
||||
append_path() {
|
||||
[[ -z "$1" ]] && return
|
||||
[[ -d "$1" ]] || return
|
||||
case ":$PATH:" in
|
||||
*:"$1":*) ;;
|
||||
*)
|
||||
PATH="${PATH:+$PATH:}$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
prepend_path() {
|
||||
[[ -z "$1" ]] && return
|
||||
[[ -d "$1" ]] || return
|
||||
case ":$PATH:" in
|
||||
*:"$1":*) ;;
|
||||
*)
|
||||
PATH="$1${PATH:+:$PATH}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# XDG, better than not set
|
||||
|
||||
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
||||
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||
export XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
|
||||
export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
|
||||
|
||||
# Locale, better than not set
|
||||
|
||||
if [[ -z "$LANG" ]]; then
|
||||
export LANG="en_US.UTF-8"
|
||||
fi
|
||||
|
||||
# Somewhat expensive
|
||||
|
||||
if [[ -z "$UY_ENV_DONE" ]]; then
|
||||
[[ -f "$HOME/.profile" ]] && . "$HOME/.profile"
|
||||
(( $+commands[opam] )) && eval "$(opam env)"
|
||||
export UY_ENV_DONE=1
|
||||
fi
|
||||
|
||||
# Paths
|
||||
|
||||
[[ -f "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
|
||||
(( $+commands[opam] )) && eval "$(opam env)"
|
||||
prepend_path "$HOME/.local/share/fnm/aliases/default/bin" # 'fnm env' is eval'ed in .zshrc
|
||||
prepend_path "$HOME/.cargo/bin"
|
||||
prepend_path "$HOME/go/bin"
|
||||
prepend_path "$HOME/.local/bin"
|
||||
prepend_path "$HOME/.local/scripts"
|
||||
prepend_path "$HOME/.local/share/fnm"
|
||||
export PATH
|
||||
|
||||
unfunction append_path
|
||||
unfunction prepend_path
|
||||
Reference in New Issue
Block a user