From 4d3950fc8372a52be504d6dad34ff613ce76ca42 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 23 Feb 2024 23:35:05 -0500 Subject: [PATCH] Adding neogen and luasnip remaps for doxygen commenting --- after/plugin/neogen.lua | 10 ++++++++++ lua/pippy/init.lua | 2 +- lua/pippy/lazy.lua | 2 +- lua/pippy/remap.lua | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 after/plugin/neogen.lua diff --git a/after/plugin/neogen.lua b/after/plugin/neogen.lua new file mode 100644 index 0000000..93792a3 --- /dev/null +++ b/after/plugin/neogen.lua @@ -0,0 +1,10 @@ +require('neogen').setup { + enabled = true, --if you want to disable Neogen + input_after_comment = true, -- (default: true) automatic jump (with insert mode) on inserted annotation + snippet_engine = "luasnip", + languages = { + ['cpp.doxygen'] = require('neogen.configurations.cpp'), + ['python.numpydoc'] = require('neogen.configurations.python'), + } + -- jump_map = "" -- (DROPPED SUPPORT, see [here](#cycle-between-annotations) !) The keymap in order to jump in the annotation fields (in insert mode) +} diff --git a/lua/pippy/init.lua b/lua/pippy/init.lua index f43315e..cf99f4c 100644 --- a/lua/pippy/init.lua +++ b/lua/pippy/init.lua @@ -1,5 +1,5 @@ -require("pippy.remap") require("pippy.lazy") +require("pippy.remap") vim.opt.nu = true vim.opt.relativenumber = true diff --git a/lua/pippy/lazy.lua b/lua/pippy/lazy.lua index 998e571..b0d77b9 100644 --- a/lua/pippy/lazy.lua +++ b/lua/pippy/lazy.lua @@ -48,8 +48,8 @@ require("lazy").setup({ "folke/neoconf.nvim", cmd = "Neoconf" }, - "folke/neodev.nvim", + {"danymat/neogen", dependencies = "nvim-treesitter/nvim-treesitter", config = true}, {'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, {'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, diff --git a/lua/pippy/remap.lua b/lua/pippy/remap.lua index 60fff83..f5843ae 100644 --- a/lua/pippy/remap.lua +++ b/lua/pippy/remap.lua @@ -16,3 +16,8 @@ vim.keymap.set("n", "sg", [[:%s/\<\>//gI vim.keymap.set("n", "ss", [[:.,$s/\<\>//gIc]]) --Search and replace incremental vim.keymap.set("n", "", [[/\<\>/]]) -- ctrl find +local opts = { noremap = true, silent = true } +local ls = require("luasnip") +vim.api.nvim_set_keymap("n", "nf", ":lua require('neogen').generate()", opts) +vim.keymap.set({"i", "s"}, "", function() ls.jump( 1) end, {silent = true}) +vim.keymap.set({"i", "s"}, "", function() ls.jump(-1) end, {silent = true})