-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmktags
executable file
·42 lines (32 loc) · 1 KB
/
mktags
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
#!/bin/bash
if [ -n "$1" ] && [ "$1" != "kernel" ] ; then
echo "usage: $0 [kernel]";
exit 1;
fi
if [ ! -d ~/.vim ] ; then
exit 1;
fi
ignore="-I __THROW -I __attribute_pure__ -I __nonnull -I __attribute__"
comm_dir="/usr/include/linux/*"
# /usr/include/bits/
user_dir="/usr/include/* /usr/include/sys/*"
kern_dir="/usr/src/linux-headers-$(uname -r)/include/linux/*"
kern_dir="${kern_dir} /usr/src/linux-headers-$(uname -r)/include/asm-generic/*"
thrd_dir="/usr/include/netinet/* /usr/include/arpa/*"
if [ "$1" == "kernel" ] ; then
dir="${kern_dir}";
else
dir="${comm_dir} ${user_dir} ${thrd_dir}";
fi
argv="--file-scope=yes --langmap=c:+.h --languages=c,c++ --links=yes"
argv="${argv} --c-kinds=+p --c++-kinds=+p --fields=+iaS --extra=+q"
tags=~/.vim/systags
ctags ${ignore} ${argv} -f ${tags} ${dir}
grep "${tags}" ~/.vimrc
if [ $? -ne 0 ] ; then
printf "\n\nset tags+=%s\n" ${tags} >> ~/.vimrc
fi
#"printf '\n\n"ctags"
#""----------------"
#"set tags+=${tags}
#""----------------"' >> ~/.vimrc