您当前的位置: 首页 >  vim

ITKEY_

暂无认证

  • 0浏览

    0关注

    732博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

vim代码注释生成插件neogen

ITKEY_ 发布时间:2022-04-08 23:45:00 ,浏览量:0

更好的注释生成器。支持多种语言和注释约定。

项目地址: https://github.com/danymat/neogen

注意事项

nvim版本以大于等于NVIM v0.6.1不然会有报错。

插件安装

插件的运行需要依赖nvim-treesitter/nvim-treesitter

use {
    "danymat/neogen",
    config = function()
        require('neogen').setup {}
    end,
    requires = "nvim-treesitter/nvim-treesitter",
    -- Uncomment next line if you want to follow only stable versions
    -- tag = "*"
}
插件配置

我这我目前的配置:

local status, neogen = pcall(require, "neogen")
if (not status) then
  return
end

neogen.setup()
neogen.generate(
  {
    type = "func" -- the annotation type to generate. Currently supported: func, class, type, file
  }
)

local opts = {noremap = true, silent = true}

vim.api.nvim_set_keymap("n", "nf", ":lua require('neogen').generate()", opts)
vim.api.nvim_set_keymap("n", "nc", ":lua require('neogen').generate({ type = 'class' })", opts)

仅供参考。

踩坑

我用于Java的代码注释生成 在这里插入图片描述

关注
打赏
1665243900
查看更多评论
立即登录/注册

微信扫码登录

0.0512s