Daniel Mathiot 429fec6e3d Update README.md
2021-08-23 09:13:28 +02:00
2021-08-18 17:03:18 +02:00
2021-08-21 18:20:29 +02:00
2021-08-18 17:03:18 +02:00
2021-08-15 22:03:20 +02:00
2021-08-23 09:13:28 +02:00
2021-08-19 16:43:35 +02:00


Neogen - Your Annotation Toolkit

Table Of Contents

Features

  • Create annotations with one keybind
  • Defaults for multiple languages and annotation conventions
  • Extremely customizable and extensible
  • Written in lua

Requirements

Installation

Use your favorite package manager to install Neogen, e.g:

use { 
    "danymat/neogen", 
    config = function()
        require('neogen').setup {
            enabled = true
        }
    end,
    requires = "nvim-treesitter/nvim-treesitter"
}

Configuration

require('neogen').setup {
        enabled = true,             -- required for Neogen to work
        input_after_comment = true, -- automatic jump (with insert mode) on inserted annotation
    }
}

The configuration file a language is in lua/configurations/{lang}.lua.

Note: Be aware that Neogen uses Treesitter to operate. You can install TSPlayground to check the AST.

If you're not satisfied with the default configuration for the language, you can change the defaults like this:

require('neogen').setup {
        enabled = true,             -- required for Neogen to work
	languages = {
	    lua = {
	        template = {
		    { nil, "- " }, -- First annotation line will be {default_comment}- (in lua ---)
        	    { "parameters", "- @param %s any" }, -- If matching parameters, will ouput --- @param {param} any
	            { "vararg", "- @vararg any" },
	            { "return_statement", "- @return any" }
		}
	    }
	}
    }
}

Supported Languages

There is a list of supported languages and fields, with their annotation style

Language Annotation conventions Supported fields
lua Emmylua @param, @varargs, @return

Usage

I exposed a command :Neogen to generate the annotations. You can bind it to your keybind of choice, like so:

vim.api.nvim_set_keymap("n", "<Leader>ng", ":Neogen<CR>", {})

It'll generate the annotations provided by neogen.

GIFS

Contributing

Adding support for new languages is quite easy, and a documentation will be available soon!

Credits

  • Binx, for making that gorgeous logo for free!
Description
A better annotation generator. Supports multiple languages and annotation conventions.
Readme GPL-3.0 5.8 MiB
Languages
Lua 99.2%
Shell 0.4%
Vim Script 0.2%
Makefile 0.2%