| 1 |
{- Web Of Code -} |
|---|
| 2 |
|
|---|
| 3 |
Vim client |
|---|
| 4 |
|
|---|
| 5 |
http://freaknet.org/alpt/src/utils/woc/readme |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
This is the WoC client for Vim. |
|---|
| 9 |
If you don't know what WoC is, read doc/woc_protocol, or see |
|---|
| 10 |
http://dev.dyne.org/trac.cgi/wiki/Woc |
|---|
| 11 |
|
|---|
| 12 |
Download the latest WoC-vim tarball from: |
|---|
| 13 |
http://www.freaknet.org/alpt/src/utils/woc/tarball/ |
|---|
| 14 |
|
|---|
| 15 |
* |
|---|
| 16 |
** Installation |
|---|
| 17 |
* |
|---|
| 18 |
|
|---|
| 19 |
Read INSTALL |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
* |
|---|
| 23 |
** Usage |
|---|
| 24 |
* |
|---|
| 25 |
|
|---|
| 26 |
First of all, try the demo: demo/README |
|---|
| 27 |
|
|---|
| 28 |
*** Browsing |
|---|
| 29 |
|
|---|
| 30 |
Read the initial comment of woc.vim. You'll find the description of the |
|---|
| 31 |
commands and mappings defined by woc.vim. |
|---|
| 32 |
|
|---|
| 33 |
For a tutorial on WoC, try the demo: demo/README |
|---|
| 34 |
|
|---|
| 35 |
*** Linking |
|---|
| 36 |
|
|---|
| 37 |
You can define a generic WoC tag by placing, anywhere in a text, |{mytag}| . |
|---|
| 38 |
You can refer to that tag using {-mytag-} . |
|---|
| 39 |
In the location where the tags are defined you must generate the WoC tags |
|---|
| 40 |
files. Use woctags.sh for that. |
|---|
| 41 |
For example: |
|---|
| 42 |
|
|---|
| 43 |
echo '|{mytag}|' >> dir/file # A a tag definition in dir/file |
|---|
| 44 |
cd dir |
|---|
| 45 |
woctags.sh . |
|---|
| 46 |
cd .. |
|---|
| 47 |
|
|---|
| 48 |
# {-dir/mytag-} refers to the tag ``mytag'' defined inside a |
|---|
| 49 |
# file present in the directory ``dir/'' |
|---|
| 50 |
echo '{-dir/mytag-}' >> anotherfile |
|---|
| 51 |
|
|---|
| 52 |
If you are editing source files, then cscope and ctags can be used to |
|---|
| 53 |
automatically generate the tags files for the sources. However if you're |
|---|
| 54 |
also using WoC tags, you have to run woctags.sh. |
|---|
| 55 |
Example: |
|---|
| 56 |
|
|---|
| 57 |
cd src/ |
|---|
| 58 |
echo 'int main() { }' > file.c |
|---|
| 59 |
echo '/* |{comment_tag}| */' >> file.c |
|---|
| 60 |
cscope -b; ctags * # At least execute one of the two |
|---|
| 61 |
woctags.sh *.[ch] |
|---|
| 62 |
cd ../ |
|---|
| 63 |
echo '{-src/main-}' > anotherfile # a tag referring to the function |
|---|
| 64 |
# main |
|---|
| 65 |
echo '{-comment_tag-}' >> anotherfile # a tag referring to the tag |
|---|
| 66 |
# placed in the comment |
|---|
| 67 |
|
|---|
| 68 |
Note: always run woctags.sh after cscope/ctags |
|---|
| 69 |
|
|---|
| 70 |
Read doc/woc_protocol for more information on the WoC tags syntax. |
|---|
| 71 |
|
|---|
| 72 |
*** Remote linking |
|---|
| 73 |
|
|---|
| 74 |
The best way to link a remote tag is to: |
|---|
| 75 |
|
|---|
| 76 |
1) define the URL alias in index.woc |
|---|
| 77 |
Copy the ./index.woc file and use it as a stub, or use |
|---|
| 78 |
demo/index.woc which is a working example. |
|---|
| 79 |
|
|---|
| 80 |
In short: |
|---|
| 81 |
|
|---|
| 82 |
echo 'alias myurlalias http://url/to/remote/tag/' > index.woc |
|---|
| 83 |
|
|---|
| 84 |
2) Use {-myurlalias/TAG-}. Where TAG is the remote tag. |
|---|
| 85 |
|
|---|
| 86 |
*** Publishing |
|---|
| 87 |
|
|---|
| 88 |
If you want to add WoC support in your online texts/sources you have several |
|---|
| 89 |
options: |
|---|
| 90 |
|
|---|
| 91 |
* just include the tags files (tags, cscope.out, ...) in your online |
|---|
| 92 |
repository. This option is valid only if you aren't using generic |
|---|
| 93 |
WoC tags (one like {-this-}). |
|---|
| 94 |
|
|---|
| 95 |
* use the woctags.sh script to generate the .woc/ directory |
|---|
| 96 |
and the tags.woc, tags.rev.woc files. |
|---|
| 97 |
(remeber to execute woctags.sh _after_ cscope/ctags) |
|---|
| 98 |
Include the .woc/ directory in your online repository. |
|---|
| 99 |
For example: |
|---|
| 100 |
|
|---|
| 101 |
cd src/ |
|---|
| 102 |
cscope -b; ctags * |
|---|
| 103 |
woctags.sh *.[ch] |
|---|
| 104 |
|
|---|
| 105 |
rsync .woc my_online_repository:src/ |
|---|
| 106 |
|
|---|
| 107 |
# Or if you are using ViewVC/ViewCVS |
|---|
| 108 |
cvs add .woc/ |
|---|
| 109 |
cvs add .woc/* |
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
Note: If the index.woc has been used, then it must be included in the online |
|---|
| 113 |
repository, because the aliases defined in it, will be loaded by the WoC |
|---|
| 114 |
clients when reading the online texts. |
|---|
| 115 |
It is sufficient to execute woctags.sh, which will compress index.woc |
|---|
| 116 |
and copy it in .woc/ |
|---|
| 117 |
|
|---|
| 118 |
* |
|---|
| 119 |
** woctags.sh |
|---|
| 120 |
* |
|---|
| 121 |
|
|---|
| 122 |
When woctags.sh is executed, it will: |
|---|
| 123 |
|
|---|
| 124 |
1) Generate tags.woc and tags.rev.woc for all the files specified. |
|---|
| 125 |
tags.woc and tags.rev.woc contains the generic WoC tags. |
|---|
| 126 |
(defined with |{mytag}|) |
|---|
| 127 |
|
|---|
| 128 |
2) Compress index.woc, tags.woc, tags.rev.woc, cscope.out, tags, TAGS |
|---|
| 129 |
The compressed file will be put in .woc/ (which is created inside |
|---|
| 130 |
the current directory). |
|---|
| 131 |
|
|---|
| 132 |
The usage of woctags.sh is simple: |
|---|
| 133 |
|
|---|
| 134 |
woctags [dir|files] [options to 'find'] |
|---|
| 135 |
|
|---|
| 136 |
Note: By default, 'find' searches recursively the current |
|---|
| 137 |
directory. To disable this behaviour use -maxdepth 1 |
|---|
| 138 |
|
|---|
| 139 |
If the WOC_FILE_LIST enviroment variable has been defined, woctags.sh |
|---|
| 140 |
will examine only the files listed in the $WOC_FILE_LIST file. |
|---|
| 141 |
|
|---|
| 142 |
Examples: |
|---|
| 143 |
|
|---|
| 144 |
# Parse everything in the current directory, except the tags files. |
|---|
| 145 |
# Generate .woc/, tags.woc and tags.rev.woc |
|---|
| 146 |
./woctags.sh |
|---|
| 147 |
|
|---|
| 148 |
# Generate the WoC tags file, parsing only C sources present in the |
|---|
| 149 |
# current directory and in all the subdirs |
|---|
| 150 |
./woctags.sh ./ -name *.[ch] |
|---|
| 151 |
|
|---|
| 152 |
# The same of above, but limiting the search in the current directory, |
|---|
| 153 |
# i.e without descending on any subdir |
|---|
| 154 |
./woctags.sh ./ -name *.[ch] -maxdepth 1 |
|---|
| 155 |
|
|---|
| 156 |
# Use WOC_FILE_LIST |
|---|
| 157 |
find ./ -name *.[ch] -maxdepth 1 > FileList |
|---|
| 158 |
|
|---|
| 159 |
WOC_FILE_LIST="FileList" ./woctags.sh |
|---|
| 160 |
# or |
|---|
| 161 |
export WOC_FILE_LIST="FileList" |
|---|
| 162 |
./woctags.sh |
|---|