forked from bkerley/zshkit
-
Notifications
You must be signed in to change notification settings - Fork 8
/
05_editor
31 lines (27 loc) · 601 Bytes
/
05_editor
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
export EDITOR
function not_run_from_ssh () {
ps x|grep "${PPID}.*sshd"|grep -v grep
echo $?
}
if [[ -x `which mvim` && $(not_run_from_ssh) = 1 ]]; then
EDITOR="mvim -f"
elif [[ -x `which nano` ]]; then
EDITOR=nano
elif [[ -x `which pico` ]]; then
EDITOR=pico
else
EDITOR=vi
fi
# Set EDITOR as default for plaintext stuff
for s in txt c cc cxx cpp; do
alias -s $s=$EDITOR
done
# Abuse the "open" command on OS X
if [[ $OSTYPE[1,6] == "darwin" ]]; then
for s in mp3 wav aac \
avi mp4 m4v mov qt mpg mpeg \
jpg png psd bmp gif tif tiff \
ps pdf html dmg; do
alias -s $s=open
done
fi