Fix default behaviour when no input after cursor

This commit is contained in:
Daniel Mathiot
2021-08-28 00:39:13 +02:00
parent d03d4fb4b6
commit 56b20fcd11
2 changed files with 7 additions and 4 deletions

View File

@@ -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)

View File

@@ -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