-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc.symlink
70 lines (55 loc) · 2.52 KB
/
bashrc.symlink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
# export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
alias l='ls --color=auto'
alias ll='ls -l'
alias lla='ls -la'
alias gs='git status'
alias gd='git diff'
alias gb='git branch'
alias gwt='git worktree'
alias gco='git checkout'
alias gpull='git pull'
alias gpush='git push'
alias fcd='cd $(fd -t d --hidden --follow --exclude \".git\" | fzf)'
alias ff='$(fd -t f -H -I | fzf)'
alias fh='$(history | fzf)'
alias work='cd /mnt/c/work/workspace'
# bind -x '"\eW":"cd $(fd -t d --hidden --follow --exclude \".git\" | fzf)"'
# bind -x '"^t":"$(fd -t f -H -I | fzf)"'
# bind -x '"\C-t":"$(fd -t f -H -I | fzf)"'
# bind -x '"\C-r":"(history | fzf)"'
# bind -x '"\ec":"cd $(fd -t d --hidden --follow --exclude \".git\" | fzf)"'
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
###---------- PROMPT ----------###
function parse_git_dirty {
STATUS="$(git status 2> /dev/null)"
if [[ $? -ne 0 ]]; then printf ""; return; else printf "["; fi
if echo ${STATUS} | grep -c "renamed:" &> /dev/null; then printf ">"; else printf ""; fi
if echo ${STATUS} | grep -c "branch is ahead:" &> /dev/null; then printf "!"; else printf ""; fi
if echo ${STATUS} | grep -c "new file::" &> /dev/null; then printf "+"; else printf ""; fi
if echo ${STATUS} | grep -c "Untracked files:" &> /dev/null; then printf "?"; else printf ""; fi
if echo ${STATUS} | grep -c "modified:" &> /dev/null; then printf "*"; else printf ""; fi
if echo ${STATUS} | grep -c "deleted:" &> /dev/null; then printf "-"; else printf ""; fi
printf "]"
}
parse_git_branch() {
# Long form
git rev-parse --abbrev-ref HEAD 2> /dev/null
# Short form
# git rev-parse --abbrev-ref HEAD 2> /dev/null | sed -e 's/.*\/\(.*\)/\1/'
}
prompt_comment() {
DIR="$HOME/.local/share/promptcomments/"
MESSAGE="$(find "$DIR"/*.txt | shuf -n1)"
cat "$MESSAGE"
}
# PS1="\e[00;36m\]┌─[ \e[00;37m\]\T \d \e[00;36m\]]──\e[00;31m\]>\e[00;37m\] \u\e[00;31m\]@\e[00;37m\]\h\n\e[00;36m\]|\n\e[00;36m\]└────\e[00;31m\]> \e[00;37m\]\w \e[00;31m\]\$ \e[01;37m\]"
# PS1="\[\e[01;37m\]{ \[\e[01;34m\]\w \[\e[01;37m\]} \[\e[01;35m\]\[\$ \]\[\e[01;37m\]"
# PS1="\[\e[1;36m\]\$(parse_git_branch)\[\033[31m\]\$(parse_git_dirty)\[\033[00m\]\n\w\[\e[1;37m\] \[\e[1;36m\]\[\e[1;37m\] "
PS1="\[\033[00m\]\w\[\e[1;37m\]\[\e[1;36m\]\[\e[1;36m\] \$(parse_git_branch)\[\033[31m\]\$(parse_git_dirty) \[\e[1;37m\] "