-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathosx_bashrc
More file actions
60 lines (54 loc) · 1.48 KB
/
osx_bashrc
File metadata and controls
60 lines (54 loc) · 1.48 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
#!/bin/bash
# vim: filetype=sh
# Source global definitions
if [[ -f "${HOME}/.all_bashrc" ]]; then
source "${HOME}/.all_bashrc";
fi
# Turn colors on or off (used for MACOSX)
export CLICOLOR=1
#
# Aliases
#
alias unmount="diskutil unmount"
# cd to the path of the front Finder 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 'No Finder window found' >&2
fi
}
# pcat (pretty cat) for shell code syntax highlighting
# Depends on the installation of Pygment
#
# conda install Pygment
#
# https://gist.github.com/BretFisher/6f688dde0122399efdca5a9d26100437
# https://coderwall.com/p/7wvx0g/syntax-highlighting-in-the-terminal-with-pygments
#
# -g: auto detection of lexer from file contents
#
# Can pass in `-l` if you want to override the lexer:
#
# pcat -l sh test.R
#
pcat() {
pygmentize -f terminal256 -O style=native -g $* | less -R
}
# Allows auto-completion of ssh hostnames
# Depends on the following (installed during `install_osx_software.sh`):
#
# ```
# brew install bash-completion
# brew tap homebrew/completions
# ```
#
# https://apple.stackexchange.com/a/209269
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
# Load RVM into a shell session *as a function*
source "${HOME}/.rvm/scripts/rvm" ;
fi