-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_osx
65 lines (53 loc) · 1.5 KB
/
.bash_osx
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
#!/usr/bin/env bash
# Homebrew rbenv overrides
export RBENV_ROOT=/usr/local/var/rbenv
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Homebrew bash-completion
if [[ -f $(brew --prefix)/etc/bash_completion ]]; then
source $(brew --prefix)/etc/bash_completion
fi
# Coreutils Overrides
# enable color support of ls and also add handy aliases
if [[ "$TERM" != "dumb" ]]; then
if [[ -r "$HOME/.dircolors" ]]; then
eval "`gdircolors $HOME/.dircolors`"
else
eval "`gdircolors -b`"
fi
alias ls='gls --color=auto'
alias dir='gls --color=auto --format=vertical'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Open a file on a remote vim server
remote_mvim() {
local remote_option="$1" && shift
local options=()
local files=()
local cmd=''
# Parse the command line
# Once we hit our first file parameter everything
# after that is assumed to be files
while [[ -n $1 ]]; do
if [[ $1 = -* && ${#files[@]} -lt 1 ]]; then
options+=("$1")
elif [[ $1 = +* && ${#files[@]} -lt 1 ]]; then
# This could be a command OR the line start parameter
if [[ $1 = +*[!0-9]* ]]; then
cmd="$1"
else
options+=("$1")
fi
else
files+=("$1")
fi
shift
done
# Pass our command line to mvim in the right order
$(which mvim) "${options[@]}" "$remote_option" "$cmd" "${files[@]}"
}
alias mvim='remote_mvim --remote-silent'
if [[ -n "$(which mvim)" ]]; then
alias vim='mvim'
fi