-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.functions
More file actions
142 lines (122 loc) · 2.68 KB
/
Copy path.functions
File metadata and controls
142 lines (122 loc) · 2.68 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
function Sweave {
R CMD Sweave $*
}
function knit {
R --no-save --no-restore -e "require(knitr); knit('$1')"
}
if type rbenv >/dev/null 2>&1; then
function rbenv {
typeset command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
(rehash|shell)
eval "`rbenv "sh-$command" "$@"`";;
(*)
command rbenv "$command" "$@";;
esac
}
fi
function ssh-fix {
eval $(tmux showenv -s SSH_AUTH_SOCK)
eval $(tmux showenv -s SSH_AGENT_PID)
}
function __ls {
if (( $# > 3 )); then
echo "${argv[3]}:"
__ls_helper "${1}" "${2}" ${argv[3]}
for arg in ${argv[4,$#]}; do
echo
echo "${arg}:"
__ls_helper "${1}" "${2}" "${arg}"
done
else
__ls_helper "${1}" "${2}" "${3:-$PWD}"
fi
}
function __ls_helper {
eval "args=(\"${3}\"/${2})"
if (( ${#args[@]} > 2 )); then
(cd "${3}" && eval "ls ${1} ${2}")
fi
}
function vimh {
vim -c "help $1 | only | bd#"
}
if [[ -f ~/.vim/plugin/manpageview.vim && $TERM != 'dumb' ]]; then
function man {
[[ $# -eq 0 ]] && return 1
vim -c "Man $* | only | bd#"
}
function gman {
[[ $# -eq 0 ]] && return 1
gvim -c "Man $* | only | bd#"
}
fi
function loop {
while true; do
$*
done
}
# calc shortcut {{{1
if [[ -x $(which bc) ]]; then
function calc {
echo "${@}" | bc -l
}
fi
# git ps1 stuff {{{1
function ___git_ps1 { # {{{2
local g p
g=$(git rev-parse --git-dir 2>/dev/null) || return
if [[ ${g} == .git ]]; then
__git_ps1 "$@"
elif [[ ${g} == ~/.git ]]; then
if [[ -f .gitignore ]]; then
__git_ps1 "$@"
else
p=$(git rev-parse --show-prefix 2>/dev/null)
case ${p} in
(.irssi/*|.vim/*|.zsh/*)
__git_ps1 "$@"
;;
esac
fi
else
__git_ps1 "$@"
fi
}
# moin current revision {{{1
function lsmoin {
for page in ${@}; do
[[ -f ${page}/current ]] && echo "${page}/revisions/$(cat ${page}/current)"
done
}
function catmoin {
for page in $(lsmoin ${@}); do
[[ -f ${page} ]] && cat ${page}
done
}
# change PS1 {{{1
function small_ps1 {
PS1=$my_small_ps1
}
function big_ps1 {
PS1=$my_big_ps1
}
# xterm title shortcut {{{1
function __xtermicontitle {
echo -ne "\033]0;${1}\a"
}
function __xtermicon {
echo -ne "\033]1;${1}\a"
}
function __xtermtitle {
echo -ne "\033]2;${1}\a"
}
function __screentitle {
echo -ne "\033k${1}\033\\"
}
# }}}1
# vim: ft=zsh fdm=marker fen