-
Notifications
You must be signed in to change notification settings - Fork 3
/
.bashrc.Darwin
43 lines (33 loc) · 1.02 KB
/
.bashrc.Darwin
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
#!/usr/bin/env bash
export BASH_SILENCE_DEPRECATION_WARNING=1
export EDITNOW='subl'
export EDITOR='subl -w -n'
export LESS="$LESS -i -F -R -X"
export CLICOLOR=1
export TERM=xterm-color
alias ls="/bin/ls -F"
alias git='hub'
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# ... using \001 and \002 instead of \[ and \] can solve this issue.
# https://unix.stackexchange.com/a/447520/442723
uber_prompt() {
local BLUE="\001\033[0;34m\002"
local YELLOW="\001\033[0;33m\002"
local RED="\001\033[0;31m\002"
local LIGHT_RED="\001\033[1;31m\002"
local GREEN="\001\033[0;32m\002"
local LIGHT_GREEN="\001\033[1;32m\002"
local WHITE="\001\033[1;37m\002"
local LIGHT_GRAY="\001\033[0;37m\002"
PS1="$LIGHT_GRAY$*$GREEN\$(parse_git_branch)$LIGHT_GRAY\$ "
PS2='> '
PS4='+ '
}
uber_prompt "\h:\W"
scutil_set_hostname() {
sudo scutil --set HostName "${1}.local"
sudo scutil --set LocalHostName "$1"
sudo scutil --set ComputerName "$1"
}