diff --git a/.config/aliasrc/docker b/.config/aliasrc/docker index 7d0b749..c1b6853 100644 --- a/.config/aliasrc/docker +++ b/.config/aliasrc/docker @@ -1,5 +1,5 @@ # docker -if [ -x "$(which docker)" ]; then +if type docker &>/dev/null; then alias dc='docker compose' alias killdocker='docker kill $(docker ps -q)' diff --git a/.config/aliasrc/pkgmanager b/.config/aliasrc/pkgmanager index ad847cd..47745bd 100644 --- a/.config/aliasrc/pkgmanager +++ b/.config/aliasrc/pkgmanager @@ -1,5 +1,5 @@ # pacman and yay -if [ -x "$(which pacman)" ]; then +if type pacman &>/dev/null; then alias spa='sudo pacman -S' alias spaa='sudo pacman -S --overwrite="*"' alias spu='sudo pacman -Syyuu' @@ -7,7 +7,7 @@ if [ -x "$(which pacman)" ]; then alias spr='sudo pacman -R' fi -if [ -x "$(which yay)" ]; then +if type yay &>/dev/null; then alias ys='yay -S' alias yss='yay -S --overwrite="*"' alias yr='yay -R' @@ -15,7 +15,7 @@ if [ -x "$(which yay)" ]; then fi # brew -if [ -x "$(which pacman)" ]; then +if type brew &>/dev/null; then alias bu='brew update && brew update --cask' alias bup='brew upgrade && brew upgrade --cask' alias bd='brew doctor' diff --git a/.config/aliasrc/programs b/.config/aliasrc/programs index fea6b8a..d317900 100755 --- a/.config/aliasrc/programs +++ b/.config/aliasrc/programs @@ -11,7 +11,7 @@ alias e='exit' alias grep='grep --color=auto' # ls -if [ -x "$(which exa)" ]; then +if type exa &>/dev/null; then alias ls='exa --icons -g' lst() { exa --no-icons --sort=time | head --lines=1; } fi @@ -29,7 +29,7 @@ alias pip='python3 -m pip' alias ipy='ipython --TerminalInteractiveShell.editing_mode=vi --TerminalInteractiveShell.timeoutlen=0.2' # vim -if [ -x "$(which nvim)" ]; then +if type nvim &>/dev/null; then alias vim='nvim' fi alias v='vim' diff --git a/.config/scriptrc/fzf.sh b/.config/scriptrc/fzf.sh index cccdfdd..2f3fe33 100644 --- a/.config/scriptrc/fzf.sh +++ b/.config/scriptrc/fzf.sh @@ -1,5 +1,5 @@ # fzf settings -if [ ! -z "$(which fzf 2>/dev/null)" ]; then +if type fzf &>/dev/null; then export FZF_DEFAULT_OPTS="--reverse --bind change:first --bind ctrl-j:down,ctrl-k:up -i --cycle --header-first --border rounded" source <(fzf --zsh) fi diff --git a/.config/scriptrc/start_tmux.sh b/.config/scriptrc/start_tmux.sh index 818e90b..426d16b 100644 --- a/.config/scriptrc/start_tmux.sh +++ b/.config/scriptrc/start_tmux.sh @@ -1,5 +1,5 @@ # run neofetch or tmux if available -if [ ! -z "$(which tmux 2>/dev/null)" ]; then +if type tmux &>/dev/null; then if [ ! -n "$TMUX" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then exec tmux fi diff --git a/.zshrc b/.zshrc index baf2233..9030d94 100755 --- a/.zshrc +++ b/.zshrc @@ -70,9 +70,10 @@ setopt HIST_IGNORE_ALL_DUPS setopt INC_APPEND_HISTORY setopt SHARE_HISTORY -# Basic auto/tab complete: +# load brew specific thinys if type brew &>/dev/null; then FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" + eval "$(/opt/homebrew/bin/brew shellenv)" fi autoload -Uz compinit @@ -192,8 +193,8 @@ bindkey '^R' history-incremental-search-backward bindkey '\eOH' beginning-of-line bindkey '\eOF' end-of-line -# IMPORTA -if [ ! -z "$(which nvim 2>/dev/null)" ]; then +# editor +if type nvim &>/dev/null; then export EDITOR=nvim else export EDITOR=vim @@ -208,16 +209,7 @@ bindkey '^ ' autosuggest-accept bindkey '^l' autosuggest-accept # exports - local bin, python, brew -export PATH="$HOME/.local/bin:$HOME/.bin:/Users/$USER/Library/Python/3.9/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/libpq/bin:/opt/homebrew/bin:/opt/homebrew/sbin:$HOME/.cargo/bin:$PATH" - -# mysql client on macos -export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH" -export PATH="/opt/homebrew/opt/dotnet@6/bin:$PATH" -export PATH="${HOME}/Library/Android/sdk/tools:${HOME}/Library/Android/sdk/platform-tools:${PATH}" -export PATH="${HOME}/go/bin/:$PATH" -export LDFLAGS="-L/opt/homebrew/opt/mysql-client/lib" -export CPPFLAGS="-I/opt/homebrew/opt/mysql-client/include" -export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql-client/lib/pkgconfig" +export PATH="$HOME/.local/bin:$HOME/.bin:$HOME/.cargo/bin:${HOME}/go/bin/:/opt/homebrew/bin:$PATH:$PATH" # Load aliases and shortcuts if existent. if [ -d "$HOME/.config/aliasrc" ]; then