11
11
# your own fork of the quickstart kit
12
12
13
13
# Add some quickstart toggle functions
14
- zsh-quickstart-select-bullet-train () {
14
+ function zsh-quickstart-select-bullet-train() {
15
15
touch ~ /.zsh-quickstart-use-bullet-train
16
16
rm -f ~ /.zgen/init.zsh
17
17
}
18
18
19
- zsh-quickstart-select-powerlevel10k () {
19
+ function zsh-quickstart-select-powerlevel10k() {
20
20
rm -f ~ /.zsh-quickstart-use-bullet-train
21
21
rm -f ~ /.zgen/init.zsh
22
22
}
23
23
24
- zsh-quickstart-disable-omz-plugins () {
24
+ function zsh-quickstart-disable-omz-plugins() {
25
25
touch ~ /.zsh-quickstart-no-omz
26
26
rm -f ~ /.zgen/init.zsh
27
27
}
28
28
29
- zsh-quickstart-enable-omz-plugins () {
29
+ function zsh-quickstart-enable-omz-plugins() {
30
30
rm -f ~ /.zsh-quickstart-no-omz
31
31
rm -f ~ /.zgen/init.zsh
32
32
}
33
33
34
- exists () {
34
+ function exists() {
35
35
if (( $+ commands[$1 ] )) ; then return 0; else return 1; fi
36
36
}
37
37
38
38
39
- ff () {
39
+ function ff() {
40
40
find . -type f -iname ' *' $@ ' *' -ls
41
41
}
42
42
43
- hgrep_full () {
43
+ function hgrep_full() {
44
44
history | egrep --color -i " $@ "
45
45
}
46
46
47
47
# easier to type, leaving hgrep_full for backwards compatibility
48
- hgrep-full () {
48
+ function hgrep-full() {
49
49
hgrep_full " $@ "
50
50
}
51
51
52
- envgrep () {
52
+ function envgrep() {
53
53
printenv | grep -i " $@ "
54
54
}
55
55
56
56
# From Dan Ryan's blog - http://danryan.co/using-antigen-for-zsh.html
57
- man () {
57
+ function man() {
58
58
env \
59
59
LESS_TERMCAP_mb=$( printf " \e[1;31m" ) \
60
60
LESS_TERMCAP_md=$( printf " \e[1;31m" ) \
@@ -67,31 +67,31 @@ man() {
67
67
}
68
68
69
69
# From commandlinefu.com
70
- watch () { t=$1 ; shift ; while test : ; do clear; date=$( date) ; echo -e " Every $ts : $@ \t\t\t\t $date " ; $@ ; sleep $t ; done }
70
+ function watch() { t=$1 ; shift ; while test : ; do clear; date=$( date) ; echo -e " Every $ts : $@ \t\t\t\t $date " ; $@ ; sleep $t ; done }
71
71
72
72
# scp file to machine you're sshing into this machine from
73
- mecp () {
73
+ function mecp() {
74
74
scp " $@ " ${SSH_CLIENT%% * } :~ /Downloads/;
75
75
}
76
76
77
- calc () {
77
+ function calc() {
78
78
awk " BEGIN{ print $* }" ;
79
79
}
80
80
81
- get_nr_jobs () {
81
+ function get_nr_jobs() {
82
82
jobs | wc -l
83
83
}
84
84
85
- get_load () {
85
+ function get_load() {
86
86
uptime | awk ' {print $11}' | tr ' ,' ' '
87
87
}
88
88
89
- mtr_url () {
89
+ function mtr_url() {
90
90
host=$( ruby -ruri -e " puts (URI.parse('$1 ').host or '$1 ')" )
91
91
sudo mtr -t $host
92
92
}
93
93
94
- fix_tmux_ssh_agent () {
94
+ function fix_tmux_ssh_agent() {
95
95
for key in SSH_AUTH_SOCK SSH_CONNECTION SSH_CLIENT; do
96
96
if (tmux show-environment | grep " ^${key} " > /dev/null); then
97
97
value=$( tmux show-environment | grep " ^${key} " | sed -e " s/^[A-Z_]*=//" )
@@ -101,28 +101,28 @@ fix_tmux_ssh_agent() {
101
101
}
102
102
103
103
# Probe a /24 for hosts
104
- scan24 () {
104
+ function scan24() {
105
105
nmap -sP ${1} /24
106
106
}
107
107
108
108
# Netjoin - Block until a network connection is obtained.
109
109
# Originally from https://github.com/bamos/dotfiles/blob/master/.funcs
110
- nj () {
110
+ function nj() {
111
111
while true ; do
112
112
ping -c 1 8.8.8.8 & > /dev/null && break
113
113
sleep 1
114
114
done
115
115
}
116
116
117
117
# lists zombie processes
118
- zombie () {
118
+ function zombie() {
119
119
ps aux | awk ' {if ($8=="Z") { print $2 }}'
120
120
}
121
121
alias zombies=zombie
122
122
123
123
# get the content type of an http resource
124
124
# from https://github.com/jleclanche/dotfiles/blob/master/.zshrc
125
- htmime () {
125
+ function htmime() {
126
126
if [[ -z $1 ]]; then
127
127
print " USAGE: htmime <URL>"
128
128
return 1
@@ -132,7 +132,7 @@ htmime() {
132
132
}
133
133
134
134
# Start an HTTP server from a directory, optionally specifying the port
135
- httpserver () {
135
+ function httpserver() {
136
136
local port=" ${1:- 8000} " ;
137
137
sleep 1 && open " http://localhost:${port} /" &
138
138
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
0 commit comments