Generate and open your HTML code documentation inside Neovim.
- Why
- Should I use doge or dooku?
- Supported languages
- Required system dependencies
- How to install
- Commands
- Options
- Basic usage
- FAQ
Because the easier it is for you to access you code documentation, the more likely you are to use it. And with this plugin you have it one keypress away.
- What is vim-doge: Helper to write code comments inside your code.
- What is dooku.nvim: It generates the actual
html
documentation, and open it on your internet browser. Depending the language it will usedoxygen
,typedoc
,jsdoc
,rustdoc
,godoc
,ldoc
, oryard
.
Language | Generator |
---|---|
c |
doxygen |
c++ |
doxygen |
c# |
doxygen |
objective-c |
doxygen |
java |
doxygen |
python |
doxygen |
php |
doxygen |
typescript |
typedoc |
javascript |
jsdoc |
rust |
rustdoc |
go |
godoc |
lua |
ldoc |
ruby |
yard |
# Pacman is the arch linux package manager.
# Use the equivalent command of your distro.
sudo pacman -S git doxygen rust go ldoc ruby-yard
npm install -g typedoc jdoc
go install golang.org/x/tools/cmd/godoc@latest
Then run :checkhealth dooku
to check if everything is OK.
lazy.nvim
{
"Zeioth/dooku.nvim",
event = "VeryLazy",
opts = {
-- your config options here
},
},
Command | Description |
---|---|
:DookuAutoSetup |
It will download a config file in your project root directory, so you can run :DookuGenerate without having to configure anything. Not necessary for rust and go . |
:DookuGenerate |
Generate the HTML documentation using the adecuated generator for the current filetype. |
:DookuOpen |
Open the HTML documentation using the specified program, or the default internet browser. |
project_root = { '.git', '.hg', '.svn', '.bzr', '_darcs', '_FOSSIL_', '.fslckout' } -- when one of these files is found, consider that directory the project root. Search starts upwards from the current buffer.
browser_cmd = "xdg-open" -- write your internet browser here. If unset, it will attempt to detect it automatically.
-- automations
on_bufwrite_generate = false -- auto run :DookuGenerate when a buffer is written.
on_generate_open = true -- auto open when running :DookuGenerate. This options is not triggered by on_bufwrite_generate.
auto_setup = true -- auto download a config for the generator if it doesn't exist in the project.
-- notifications
on_generate_notification = true
on_open_notification = true
- (Optional) These options can be accessed from anywhere with
vim.g.dooku_config
- (Optional) We also expose debug options to control how the plugin work internally.
Run the commands in this order
:DookuAutoSetup
:DookuGenerate
:DookuOpen
Or if you prefer run :DookuGenerate
three times. This is only necessary the first time.
- Doesn't work? Make sure you have installed the required dependencies.
- Still doesn't work? Make sure you have one of the items defined in the option
project_root
in your project root directory, or dooku.nvim might end up on the wrong directory silently. - Still doesn't work? If you are on
rust / go
you must initialize your project withcargo new your_project_name
orgo mod init your_module_name
. Also ensure the generatedCargo.toml
orgo.mod
are in the same dir as theproject_root
. Also ensure the main directory of the project has the same name as the main module. - Still doesn't work? If you are on
lua
, make sure you can runldoc .
in your project directory.ldoc
can refuse to generate the docs if they are formatted incorrectly, so go and see what's going on. - STILL doesn't work? Then congratulations, you found a bug. Please report it here so I can fix it.
- How can I add support for a new language? On the
backends
directory, copy the filedoxygen.lua
, and and use it as base to add your new documentation generator. Onoptions.lua
, copy all the doxygen specific options, and rename them to the language you are adding. Finally, onutils.lua
, add your language to the functionget_backends
so your backend is recognized and loaded. Don't forget to send your PR so everyone can benefit from it! - Windows compatibility: On windows dooku.nvim run directly on the operative system to avoid spawning terminals. So if you find errors when trying to run dooku, make sure you have the doc generators added to the windows PATH.
- Where do that cheesy name come from? From Star Wars.
- Is this plugin based on some other This is a lua port of the vim plugin vim-dooku.