From 8be270894c945ab3747b98619019bbabf2ec9429 Mon Sep 17 00:00:00 2001 From: Starfall Date: Tue, 6 Feb 2024 11:14:41 -0600 Subject: zsh: move hidden config to un-hidden files as much as possible --- .config/zsh/.zshenv | 28 --------------------- .config/zsh/.zshrc | 72 +---------------------------------------------------- .config/zsh/zshenv | 28 +++++++++++++++++++++ .config/zsh/zshrc | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 .config/zsh/.zshenv create mode 100644 .config/zsh/zshenv create mode 100644 .config/zsh/zshrc (limited to '.config') diff --git a/.config/zsh/.zshenv b/.config/zsh/.zshenv deleted file mode 100644 index 80ac555..0000000 --- a/.config/zsh/.zshenv +++ /dev/null @@ -1,28 +0,0 @@ -export EDITOR='vim' -export PAGER='less' -export LESS='--RAW-CONTROL-CHARS' -export GPG_TTY=$TTY - -export PATH=$HOME/.local/bin:$PATH - -if [[ $INTELLIJ -eq 1 ]]; then - export PATH=/usr/local/bin:/usr/bin:$PATH -fi - -if [[ -n $XDG_RUNTIME_DIR ]]; then - export XDG_CONFIG_HOME="$HOME/.config" - export XDG_CACHE_HOME="$HOME/.cache" - export XDG_DATA_HOME="$HOME/.local/share" - export XDG_STATE_HOME="$HOME/.local/state" -fi - -[[ -f "$HOME/.cargo/env" ]] && . "$HOME/.cargo/env" - -if command -v npm &> /dev/null; then - export npm_config_prefix="$HOME/.local" -fi - -if command -v bat &> /dev/null; then - export MANPAGER="sh -c 'col -bx | bat --plain --language man'" - export MANROFFOPT="-c" -fi diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9aed5dc..ff7dc10 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,77 +1,7 @@ -# set ZPROF to measure startup time -[[ -v ZPROF ]] && zmodload zsh/zprof - -# colors in virtual console -# Tomorrow's Stars theme, lightly adapted from Tomorrow -if [ "$TERM" = 'linux' ]; then - echo -ne "\e]P01d1f21" - echo -ne "\e]P1d54e53" - echo -ne "\e]P2b9ca4a" - echo -ne "\e]P3e7ba47" - echo -ne "\e]P47aa6da" - echo -ne "\e]P5c397d8" - echo -ne "\e]P670c0b1" - echo -ne "\e]P7969896" - echo -ne "\e]P8373b41" - echo -ne "\e]P9cc6666" - echo -ne "\e]PAb5bd68" - echo -ne "\e]PBf0c674" - echo -ne "\e]PC81a2be" - echo -ne "\e]PDb294bb" - echo -ne "\e]PE8abeb7" - echo -ne "\e]PFc5c8c6" - clear -fi - -# plugin - fzf -# arch puts these here -if [[ -a /usr/share/fzf/key-bindings.zsh ]] && [[ -a /usr/share/fzf/completion.zsh ]]; then - export FZF_DEFAULT_OPTS='--no-height --no-reverse' - source /usr/share/fzf/key-bindings.zsh - source /usr/share/fzf/completion.zsh -fi - -# plugins - url quote magic -autoload -Uz url-quote-magic -zle -N self-insert url-quote-magic - -# plugins - magic dots (must come after url-quote-magic) -fpath=($ZDOTDIR/plugins $fpath) -autoload -Uz manydots-magic -manydots-magic - -# magic navigation -setopt autocd -cdpath=(. $HOME $HOME/devil $HOME/src) - -# a bit nicer life when copy/pasting commands from docs -setopt interactive_comments - -# aliases -alias cls=clear -alias config='git --git-dir=$HOME/.dotfiles --work-tree=$HOME' - -# collapse spaces into tabs in-place -# spacetotab [WIDTH=4] -function spacetotab () { - unexpand --tabs=${2:-4} --first-only "$1" > "$1.tmp" - mv "$1.tmp" "$1" -} +source $ZDOTDIR/zshrc # load remaining config for conf in "$ZDOTDIR/"*.zsh; do source "${conf}" done unset conf - -# display a fortune when opening an interactive terminal -tty -s && fortune $HOME/fortunes 2>/dev/null ||: - -# set ZPROF to profile startup time -[[ -v ZPROF ]] && zprof - -# startx if not already running an x server (e.g. via display manager) and only on tty1 -if (command -v startx &>/dev/null) && [ -z "${DISPLAY}" ] && [ "$(tty)" = "/dev/tty1" ]; then - exec startx -fi - diff --git a/.config/zsh/zshenv b/.config/zsh/zshenv new file mode 100644 index 0000000..80ac555 --- /dev/null +++ b/.config/zsh/zshenv @@ -0,0 +1,28 @@ +export EDITOR='vim' +export PAGER='less' +export LESS='--RAW-CONTROL-CHARS' +export GPG_TTY=$TTY + +export PATH=$HOME/.local/bin:$PATH + +if [[ $INTELLIJ -eq 1 ]]; then + export PATH=/usr/local/bin:/usr/bin:$PATH +fi + +if [[ -n $XDG_RUNTIME_DIR ]]; then + export XDG_CONFIG_HOME="$HOME/.config" + export XDG_CACHE_HOME="$HOME/.cache" + export XDG_DATA_HOME="$HOME/.local/share" + export XDG_STATE_HOME="$HOME/.local/state" +fi + +[[ -f "$HOME/.cargo/env" ]] && . "$HOME/.cargo/env" + +if command -v npm &> /dev/null; then + export npm_config_prefix="$HOME/.local" +fi + +if command -v bat &> /dev/null; then + export MANPAGER="sh -c 'col -bx | bat --plain --language man'" + export MANROFFOPT="-c" +fi diff --git a/.config/zsh/zshrc b/.config/zsh/zshrc new file mode 100644 index 0000000..84afcbf --- /dev/null +++ b/.config/zsh/zshrc @@ -0,0 +1,70 @@ +# set ZPROF to measure startup time +[[ -v ZPROF ]] && zmodload zsh/zprof + +# colors in virtual console +# Tomorrow's Stars theme, lightly adapted from Tomorrow +if [ "$TERM" = 'linux' ]; then + echo -ne "\e]P01d1f21" + echo -ne "\e]P1d54e53" + echo -ne "\e]P2b9ca4a" + echo -ne "\e]P3e7ba47" + echo -ne "\e]P47aa6da" + echo -ne "\e]P5c397d8" + echo -ne "\e]P670c0b1" + echo -ne "\e]P7969896" + echo -ne "\e]P8373b41" + echo -ne "\e]P9cc6666" + echo -ne "\e]PAb5bd68" + echo -ne "\e]PBf0c674" + echo -ne "\e]PC81a2be" + echo -ne "\e]PDb294bb" + echo -ne "\e]PE8abeb7" + echo -ne "\e]PFc5c8c6" + clear +fi + +# plugin - fzf +# arch puts these here +if [[ -a /usr/share/fzf/key-bindings.zsh ]] && [[ -a /usr/share/fzf/completion.zsh ]]; then + export FZF_DEFAULT_OPTS='--no-height --no-reverse' + source /usr/share/fzf/key-bindings.zsh + source /usr/share/fzf/completion.zsh +fi + +# plugins - url quote magic +autoload -Uz url-quote-magic +zle -N self-insert url-quote-magic + +# plugins - magic dots (must come after url-quote-magic) +fpath=($ZDOTDIR/plugins $fpath) +autoload -Uz manydots-magic +manydots-magic + +# magic navigation +setopt autocd +cdpath=(. $HOME $HOME/devil $HOME/src) + +# a bit nicer life when copy/pasting commands from docs +setopt interactive_comments + +# aliases +alias cls=clear +alias config='git --git-dir=$HOME/.dotfiles --work-tree=$HOME' + +# collapse spaces into tabs in-place +# spacetotab [WIDTH=4] +function spacetotab () { + unexpand --tabs=${2:-4} --first-only "$1" > "$1.tmp" + mv "$1.tmp" "$1" +} + +# display a fortune when opening an interactive terminal +tty -s && fortune $HOME/fortunes 2>/dev/null ||: + +# set ZPROF to profile startup time +[[ -v ZPROF ]] && zprof + +# startx if not already running an x server (e.g. via display manager) and only on tty1 +if (command -v startx &>/dev/null) && [ -z "${DISPLAY}" ] && [ "$(tty)" = "/dev/tty1" ]; then + exec startx +fi -- cgit