Check for certain commands before using
Check for existence of certain commands like nvim before using them in aliases or env vars like EDITOR.
This commit is contained in:
@@ -69,10 +69,12 @@ autoload -U select-word-style && select-word-style bash
|
|||||||
|
|
||||||
## Setup the prompt
|
## Setup the prompt
|
||||||
# use bright version of colors when printing bold
|
# use bright version of colors when printing bold
|
||||||
if [ -e "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors" ]; then
|
if command -v dircolors >/dev/null 2>&1; then
|
||||||
eval "$(dircolors -b "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors")"
|
if [ -e "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors" ]; then
|
||||||
else
|
eval "$(dircolors -b "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors/dircolors")"
|
||||||
eval "$(dircolors -b)"
|
else
|
||||||
|
eval "$(dircolors -b)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "$ZSH_CONF/powerlevel10k/powerlevel10k.zsh-theme" ]; then
|
if [ -e "$ZSH_CONF/powerlevel10k/powerlevel10k.zsh-theme" ]; then
|
||||||
@@ -151,7 +153,13 @@ comp-source "$ZSH_CONF/keys.zsh"
|
|||||||
[[ "$PATH" =~ "$HOME/\.local/bin" ]] || export PATH="$HOME/.local/bin${PATH:+:${PATH}}"
|
[[ "$PATH" =~ "$HOME/\.local/bin" ]] || export PATH="$HOME/.local/bin${PATH:+:${PATH}}"
|
||||||
|
|
||||||
## Env variables that have nothing to do with zsh
|
## Env variables that have nothing to do with zsh
|
||||||
export EDITOR=nvim
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
|
export EDITOR=nvim
|
||||||
|
elif command -v vim >/dev/null 2>&1; then
|
||||||
|
export EDITOR=vim
|
||||||
|
elif command -v nano >/dev/null 2>&1; then
|
||||||
|
export EDITOR=nano
|
||||||
|
fi
|
||||||
|
|
||||||
# `sudo nano` won't work without this (?)
|
# `sudo nano` won't work without this (?)
|
||||||
if [ "$TERM" = "xterm-kitty" ]; then
|
if [ "$TERM" = "xterm-kitty" ]; then
|
||||||
@@ -171,8 +179,9 @@ export LESS_TERMCAP_us=$'\e[1;4;31m'
|
|||||||
## Less clutter in $HOME by enforcing the XDG base directory standard
|
## Less clutter in $HOME by enforcing the XDG base directory standard
|
||||||
export ATOM_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/atom"
|
export ATOM_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/atom"
|
||||||
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
|
||||||
export LESSHISTFILE=-
|
|
||||||
export SQLITE_HISTORY="${XDG_DATA_HOME:-$HOME/.local/share}/sqlite3/sqlite_history"
|
export SQLITE_HISTORY="${XDG_DATA_HOME:-$HOME/.local/share}/sqlite3/sqlite_history"
|
||||||
|
# No less history file
|
||||||
|
export LESSHISTFILE=-
|
||||||
|
|
||||||
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
|
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
|
||||||
export VIMINIT="let \$MYVIMRC=\"${XDG_CONFIG_HOME:-$HOME/.config}/vim/xdg.vim\" | source \$MYVIMRC"
|
export VIMINIT="let \$MYVIMRC=\"${XDG_CONFIG_HOME:-$HOME/.config}/vim/xdg.vim\" | source \$MYVIMRC"
|
||||||
|
|||||||
@@ -40,8 +40,10 @@ alias -g G='| grep '
|
|||||||
alias -g no2='2>/dev/null'
|
alias -g no2='2>/dev/null'
|
||||||
alias hex=xxd
|
alias hex=xxd
|
||||||
alias bin='xxd -b -c4 | cut -d" " -f2-5'
|
alias bin='xxd -b -c4 | cut -d" " -f2-5'
|
||||||
alias vim=nvim
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
alias vi=nvim
|
alias vim=nvim
|
||||||
|
alias vi=nvim
|
||||||
|
fi
|
||||||
alias tmux='tmux -f "$HOME/.config/tmux/tmux.conf"'
|
alias tmux='tmux -f "$HOME/.config/tmux/tmux.conf"'
|
||||||
alias resetCursor='echo -ne "\e[5 q"'
|
alias resetCursor='echo -ne "\e[5 q"'
|
||||||
alias makeThisScratchpad='echo -ne "\033]0;scratchpad-terminal\007"'
|
alias makeThisScratchpad='echo -ne "\033]0;scratchpad-terminal\007"'
|
||||||
|
|||||||
Reference in New Issue
Block a user