forked from mattfoster/zshkit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path03_help
59 lines (57 loc) · 2.08 KB
/
03_help
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
# See From Bash to Z Shell, Page: 101
if [[ $(whence -v run-help) == 'run-help is a shell function' ]]; then
unalias run-help
fi
export HELPDIR='/sw/share/zsh/zsh_help'
autoload -Uz run-help
# From zsh-helpfiles (see fink)
alias help=run-help
# From zsh-lovers
# Function Usage: doc packagename
if [[ -d /sw/share/doc ]]; then
doc() { cd /sw/share/doc/$1 && ls }
gdoc() { cd /sw/share/doc/$1 && gvim . }
_doc() { _files -W /sw/share/doc -/ }
elif [[ -d /usr/share/doc ]]; then
doc() { cd /usr/share/doc/$1 && ls }
gdoc() { cd /usr/share/doc/$1 && gvim . }
_doc() { _files -W /usr/share/doc -/ }
fi
# provide useful information on globbing
H-Glob() {
echo -e "
/ directories
. plain files
@ symbolic links
= sockets
p named pipes (FIFOs)
* executable plain files (0100)
% device files (character or block special)
%b block special files
%c character special files
r owner-readable files (0400)
w owner-writable files (0200)
x owner-executable files (0100)
A group-readable files (0040)
I group-writable files (0020)
E group-executable files (0010)
R world-readable files (0004)
W world-writable files (0002)
X world-executable files (0001)
s setuid files (04000)
S setgid files (02000)
t files with the sticky bit (01000)
print *(m-1) # List files modified today.
print *(a1) # List files accessed one day ago.
print *(@) # Print links.
print *(Lk+50) # List files > 50 Kilobytes.
print *(Lk-50) # List files < 50 Kilobytes.
print **/*.c # Recursively list all c files.
print **/*.c~file.c # List all c files, except file.c
print (foo|bar).* # List files whos names start foo or bar.
print *~*.* #
chmod 644 *(.^x) # make all non-executable files publically readable
print -l *(.c|.h) # List all c and header files on their own lines.
print **/*(g:users:) # Recursively list files with the group 'users'
echo /proc/*/cwd(:h:t:s/self//) # Analogue of >ps ax | awk '{print $1}'<"
}