-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
83 lines (68 loc) · 2.46 KB
/
.bashrc
File metadata and controls
83 lines (68 loc) · 2.46 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
78
79
80
81
82
83
################################################################################
# basic settings
################################################################################
# homebrew
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export HOMEBREW_CACHE=~/Library/Caches/Homebrew
export HOMEBREW_EDITOR=/usr/local/bin/vim
# export HOMEBREW_GITHUB_API_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# bash-completion
[ -f `brew --prefix`/etc/bash_completion ] && . `brew --prefix`/etc/bash_completion
# git
export GIT_TERMINAL_PROMPT=0
export GIT_PS1_SHOWDIRTYSTATE=true
#export PS1='\h:\[\033[33m\]\W\[\033[00m\] \[\033[32m\]\u\[\033[00m\]\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\]\$ '
export PS1='\[\033[32m\]\h\[\033[00m\] \[\033[33m\]\W\[\033[00m\]\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\]\$ '
# z
[ -f `brew --prefix`/etc/profile.d/z.sh ] && . `brew --prefix`/etc/profile.d/z.sh
# openssl
export PATH=/usr/local/opt/openssl/bin:$PATH
# python user packages to use `pip install --user`
export PATH=$HOME/.local/bin:$PATH
################################################################################
# functions
################################################################################
# cd the path and open Finder's active window
cdf () {
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'`
if [ "$target" != "" ]
then
cd "$target"
pwd
else
echo 'Finder''s window not found.' >&2
fi
}
# select a folder by peco and cd it
pecocd () {
local dir=`ls -1d */ | peco`
if [ ! -z "$dir" ] ; then
cd "$dir"
fi
}
# select a host by peco and ssh it
pecossh () {
[ -f ~/.ssh/config ] && grep -w Host ~/.ssh/config | peco | awk '{print $2}' | xargs -o -n 1 ssh
}
################################################################################
# aliases
################################################################################
# basic
alias ls='ls -F -G'
alias ll='ls -l'
alias la='ls -a'
alias lla='ls -la'
#alias rm='rm -i'
#alias rd='rmdir'
alias relogin='exec $SHELL -l'
alias df='df -h' # display MB instead of KB
alias f='open .' # open Finder
# Homebrew
alias j='z'
alias rm='trash'
alias cat='ccat'
# Editor
alias c='code' # open Visual Studio Code
################################################################################
# others
################################################################################