summaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorAndrew Guschin <guschin.drew@gmail.com>2023-04-25 10:05:10 +0400
committerAndrew Guschin <guschin.drew@gmail.com>2023-04-25 10:29:37 +0400
commite0b6841de0c7beb44346f48b7aa8e093b14d14ab (patch)
treee4b73927f5eafcf4476206e8e6b37f887049405e /.bashrc
parentba280a36c79ac3ce9a3f41abcd75cb1327e46f75 (diff)
Синхронизировал .bashrc и .zshrc
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc39
1 files changed, 24 insertions, 15 deletions
diff --git a/.bashrc b/.bashrc
index c25df19..5b8704b 100644
--- a/.bashrc
+++ b/.bashrc
@@ -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"