diff --git a/lua/neogen.lua b/lua/neogen.lua index 159a76c..c64289d 100644 --- a/lua/neogen.lua +++ b/lua/neogen.lua @@ -64,12 +64,16 @@ neogen.generate = function(opts) if matched then local split = vim.split(matched, "|", true) - if #split == 2 then + if #split == 2 and neogen.configuration.input_after_comment == false then return string.gsub(v, jump_text .. "|", "") .. " " + elseif #split == 1 then + string.gsub(v, jump_text, "") end else return string.gsub(v, jump_text, "") end + + return string.gsub(v, pattern, "") end local content_with_marks = vim.deepcopy(content) diff --git a/lua/neogen/utilities/cursor.lua b/lua/neogen/utilities/cursor.lua index dae4fa4..e6616ce 100644 --- a/lua/neogen/utilities/cursor.lua +++ b/lua/neogen/utilities/cursor.lua @@ -15,9 +15,7 @@ end neogen.utilities.cursor.go_next_extmark = function() local extm_list = vim.api.nvim_buf_get_extmarks(0, neogen_ns, 0, -1, {}) if #extm_list ~= 0 then - vim.api.nvim_win_set_cursor(0, { extm_list[1][2] + 1, extm_list[1][3] }) - if #extm_list ~= 0 then vim.api.nvim_buf_del_extmark(0, neogen_ns, extm_list[1][1]) end @@ -30,7 +28,7 @@ end --- Goes to next extmark and start insert mode neogen.utilities.cursor.jump = function() if neogen.utilities.cursor.go_next_extmark() then - vim.api.nvim_command("startinsert!") + vim.api.nvim_command("startinsert") end end @@ -42,6 +40,7 @@ neogen.utilities.cursor.del_extmarks = function() end end +--- Checks if there are still possible jump positions to perform neogen.utilities.cursor.jumpable = function () local extm_list = vim.api.nvim_buf_get_extmarks(0, neogen_ns, 0, -1, {}) if #extm_list ~= 0 then