Giter Club home page Giter Club logo

dooku.nvim's Introduction

dooku.nvim

Generate and open your HTML code documentation inside Neovim.

screenshot_2023-08-07_18-56-31_067791379

Table of contents

Why

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.

Should I use doge or dooku?

  • 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 use doxygen, typedoc, jsdoc, rustdoc, godoc, ldoc, or yard.

Supported languages

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

Required system dependencies

# 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.

How to install

lazy.nvim

{
  "Zeioth/dooku.nvim",
  event = "VeryLazy",
  opts = {
    -- your config options here
  },
},

Commands

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.

Options

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.

Basic usage

Run the commands in this order

  • :DookuAutoSetup
  • :DookuGenerate
  • :DookuOpen

Or if you prefer run :DookuGenerate three times. This is only necessary the first time.

FAQ

  • 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 with cargo new your_project_name or go mod init your_module_name. Also ensure the generated Cargo.toml or go.mod are in the same dir as the project_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 run ldoc . 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 file doxygen.lua, and and use it as base to add your new documentation generator. On options.lua, copy all the doxygen specific options, and rename them to the language you are adding. Finally, on utils.lua, add your language to the function get_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.

dooku.nvim's People

Contributors

zeioth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dooku.nvim's Issues

Bug in the config

Because we are defining options like:

M.on_generate_notification = opts.on_generate_notification or true

If we try to set a option to false, it will default to true. We need a better design.

Error on setup

Hello, I had problem with setup using :DookuAutoSetup. I have installed doxygen and tried it on some python and c++ projects. I have encountered this error every time.

Auto setup is enabled. Creating:                                                                                                       
/home/jirka/projects/whos_that_pokemon/doxygen                                                                                         
                                                                                                                                       
You can run the command now.                                                                                                           
Error executing Lua callback: ...hare/nvim/lazy/dooku.nvim/lua/dooku/backends/doxygen.lua:94: attempt to concatenate field 'doxygen_clone_cmd_post' (a nil value)                                                                                                             
stack traceback:                                                                                                                       
        ...hare/nvim/lazy/dooku.nvim/lua/dooku/backends/doxygen.lua:94: in function 'auto_setup'                                       
        ....local/share/nvim/lazy/dooku.nvim/lua/dooku/commands.lua:73: in function 'auto_setup'                                       
        ...rka/.local/share/nvim/lazy/dooku.nvim/lua/dooku/init.lua:20: in function <...rka/.local/share/nvim/lazy/dooku.nvim/lua/dooku
/init.lua:20>   

Not sure if I did something wrong, but I managed to find a simple fix. I just added doxygen_clone_cmd_post = " " to my config. Changing "" to " " on line 54 in ~/.local/share/nvim/lazy/dooku.nvim/lua/dooku/config.lua also works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.