diff options
| -rw-r--r-- | .bashrc | 39 | ||||
| -rw-r--r-- | .zshrc | 1 |
2 files changed, 24 insertions, 16 deletions
@@ -1,6 +1,5 @@ # enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" +if [ -x /usr/bin/dircolors ] || [ "$(uname)" = "Darwin" ]; then alias ls='ls --color=auto' alias gcc='gcc -fdiagnostics-color=always' alias grep='grep --color=auto' @@ -14,28 +13,38 @@ fi alias la='ls -lhFA' alias ll='ls -lhF' alias l='ls -CF' -alias dotfiles="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME'" -alias dotstat="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME' status" -alias dotdiff="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME' diff" -alias dotadd="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME' add -f" -alias vim="nvim" +alias dot="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME'" + +# XDG aliases +alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"' +alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"' +alias sqlite3='sqlite3 -init "$XDG_CONFIG_HOME"/sqlite3/sqliterc' + +# Bash config +bind "set completion-ignore-case on" # Functions -fzf_cd() { - cd "$(find ~ -type d | fzf)" +cdf() { + cd "$(find ~ -type d &>/dev/null | fzf)" +} + +vcsinfo_git_branch() { + git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/^\(* \)//' } -set_ps1() { +vcsinfo_branch() { + branch=$(vcsinfo_git_branch) + [ ! -z $branch ] && echo " ($branch)" && return +} + +set_prompt() { # red color if current user us root, otherwise - green [ "$USER" = "root" ] && UCOLOR="\e[1;31m" || UCOLOR="\e[1;32m" [ "$USER" = "root" ] && END="#" || END="$" BLUE="\e[1;34m" PURPLE="\e[1;35m" STOP="\e[m" - export PS1="\A $UCOLOR\u$STOP@$PURPLE\h$STOP:$BLUE\w$STOP $END " + export PS1="\A $UCOLOR\u$STOP@$PURPLE\h$STOP:$BLUE\w$STOP\$(vcsinfo_branch)"$'\n'"$END " } +set_prompt 0 -bind '"\C-f":"fzf_cd\n"' - -set_ps1 -export TERM="xterm-256color" @@ -14,7 +14,6 @@ alias la='ls -lhFA' alias ll='ls -lhF' alias l='ls -CF' alias dot="/usr/bin/git --git-dir='$HOME/.dotfiles' --work-tree='$HOME'" -alias e="$EDITOR" # XDG aliases alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"' |