1 # docvim: a documentation generator for Vim plug-ins
3 [](https://travis-ci.org/wincent/docvim) [](http://stackage.org/lts/package/docvim) [](http://stackage.org/nightly/package/docvim)
5 docvim is a documentation generator for Vim plug-ins, written in Haskell.
10 # Print Markdown-formatted help documentation for files in current directory
13 # Write Markdown README + Vim help text file for $PLUGIN
14 docvim -c ~/code/$PLUGIN ~/code/$PLUGIN/doc/$PLUGIN.txt ~/code/$PLUGIN/README.md
20 docvim - a documentation generator for Vim plug-ins
22 Usage: docvim [--version] [OUTFILES...] [-d|--debug] [-c|--directory DIRECTORY]
24 Generate documentation for a Vim plug-in
27 -h,--help Show this help text
28 --version Print version information
29 OUTFILES... Target file(s) for generated output (default:
31 -d,--debug Print debug information during processing
32 -c,--directory DIRECTORY Change to DIRECTORY before processing (default: ".")
33 -v,--verbose Be verbose during processing
50 " Docblocks start with a pair of double quotes, followed
51 " by standard Vim comments (with a double quote prefix)
52 " containing Markdown-like text and optional annotations
53 " that look like this:
56 " @command :Ack {pattern} {options}
60 ### Supported Markdown features
66 --- (Horizontal dividers)
73 fenced codeblocks (leading space syntax not supported)
76 
77 (becomes a link in vimdoc, but an image in markdown)
81 ### Unsupported Markdown syntax
84 *foo* (emphasis; turns into Vim doc targets instead)
86 *,+ (list syntax; just use - instead)
88 <html> (we don't want ambiguity with things like <leader> and so on)
108 ### Convenience wrappers
111 bin/accept # Accept current "golden" test output.
112 bin/docvim # Run the docvim executable.
113 bin/golden # Run just the "golden" tests.
114 bin/haddock # Produce Haddock documentation.
115 bin/lint # Run the linter.
116 bin/tasty # Run just the Tasty tests.
117 bin/test # Run all tests, including lints.
120 These are wrappers for the explicit invocations described below.
124 You can set-up a development environment using [Stack] (recommended) or [Cabal]:
128 brew install haskell-stack
132 brew install cabal-install
134 cabal install --only-dependencies --enable-tests
140 Run using `stack exec` (or `cabal run`) and passing in docvim-specific `OPTIONS`:
144 stack exec docvim [OPTIONS]
147 cabal run -- [OPTIONS]
150 You can also run the modules from inside the REPL:
155 > pp "let l:test=1" -- pretty-prints AST
159 > import Text.Docvim.Parse
160 > pp "let l:test=1" -- pretty-prints AST
166 stack build --file-watch
169 ### Building and viewing the code-level documentation
174 open .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/doc/html/docvim/index.html
177 cabal haddock --executables
178 open dist/doc/html/docvim/docvim/index.html
185 stack test # Runs all test suites, including linting.
186 stack test :tasty # Runs just the Tasty test suite.
189 cabal test # Runs all test suites, including linting.
190 cabal test tasty # Runs just the Tasty test suite.
193 #### Updating "golden" files
197 stack test --test-arguments=--accept # Runs all test suites.
198 stack test :tasty --test-arguments=--accept # Runs just the Tasty test suite.
201 cabal test --test-options=---accept # Runs all test suites.
202 cabal test tasty --test-options=---accept # Runs just the Tasty test suite.
209 stack test # Runs linter as part of overall set of suites.
210 stack test :hlint # Runs linter alone.
213 cabal install hlint # (First-time only).
214 cabal test # Runs linter as part of overall set of suites.
215 cabal test hlint # Runs linter alone.
217 hlint src # If you have HLint installed under $PATH.
223 vim docvim.cabal # Update version number in two places.
224 vim CHANGELOG.md # Update, er, changelog.
225 git commit -p # git tag, git push --follow-tags etc...
232 - [Hackage package](https://hackage.haskell.org/package/docvim)
234 ### Examples of plug-ins using docvim
236 - [Ferret](https://github.com/wincent/ferret)
237 - [Pinnacle](https://github.com/wincent/pinnacle)
238 - [Scalpel](https://github.com/wincent/scalpel)
239 - [vim-docvim](https://github.com/wincent/vim-docvim)
243 ### Why a new tool and not an existing one like [Vimdoc]?
245 * I wanted to target multiple output formats (Vim help files and Markdown).
246 * I wanted total control over the presentation of the output.
247 * It's fun to build new things from scratch.
248 * The project is a great fit for my learn-me-a-Haskell goal this year.
250 ### Why is it called "docvim"?
252 "Vimdoc" was the first name that occurred to me when I started this project, but:
254 * The number one hit for "vimdoc" is [this online copy of Vim's own documentation](http://vimdoc.sourceforge.net/).
255 * The name "Vimdoc" is already taken by [a similar project](https://github.com/google/vimdoc).
257 So, in a remarkable flash of profound creativity, I settled on "docvim" instead, which right now yields this pleasing search result:
259 > Did you mean: dacvim
261 [Cabal]: https://www.haskell.org/cabal/
262 [Stack]: http://haskellstack.org/
263 [Vimdoc]: https://github.com/google/vimdoc