-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
78 lines (67 loc) · 1.83 KB
/
Copy pathbashrc
File metadata and controls
78 lines (67 loc) · 1.83 KB
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
71
72
73
74
75
76
77
# Locale
LANG=en_US.UTF-8
# screenfetch
echo '' ; screenfetch
# Aliases
## Modified command
alias grep='grep --color=auto'
## ls
alias ls='ls -hF --color=auto'
alias lr='ls -R' # recursive ls
alias ll='ls -l'
alias la='ll -A'
alias lx='ll -BX' # sort by extension
alias lz='ll -rS' # sort by size
alias lt='ll -rt' # sort by date
alias l='ls -Alh'
## Safety features
alias cp='cp -i'
alias mv='mv -i'
# safer alternative w/ timeout, not stored in history
alias rm=' timeout 3 rm -Iv --one-file-system'
alias ln='ln -i'
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
## Make Bash error tolerant
alias :q=' exit'
alias :Q=' exit'
alias :x=' exit'
alias cd..='cd ..'
# shell optional behavior
for option in autocd cdspell histappend ; do
shopt -s "$option"
done
# Git
# shellcheck disable=SC1091
source /usr/share/git/completion/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE='1'
export GIT_PS1_SHOWUNTRACKEDFILES='1'
export GIT_PS1_SHOWUPSTREAM='verbose name'
# PS1
PS1='\[\e[0;33m\][\t] \[\e[0;32m\]\u@\H \[\e[0;33m\]\w \[\e[0;35m\]$(__git_ps1 "(%s)")\n\[\e[0;33m\]$\[\e[0m\] '
# Color man
man() {
env \
LESS_TERMCAP_mb=$'\e[01;31m' \
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
man "$@"
}
# ssh-agent
SSH_ENV="${HOME}/.ssh/environment"
SSH_KEY="${HOME}/.ssh/id_rsa"
ssh-agent | sed 's/^echo/#echo/' | dd of="${SSH_ENV}" 2> /dev/null
if [ -e "${SSH_ENV}" ] ; then
chmod 600 "${SSH_ENV}"
# shellcheck source=${SSH_ENV}
# shellcheck disable=SC1091
source "${SSH_ENV}"
else
echo 'Failed.'
fi
[ -r "${SSH_KEY}" ] && $(command -v ssh-add) "${SSH_KEY}"