Fix default behaviour when no input after cursor
This commit is contained in:
@@ -64,12 +64,16 @@ neogen.generate = function(opts)
|
|||||||
|
|
||||||
if matched then
|
if matched then
|
||||||
local split = vim.split(matched, "|", true)
|
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 .. "|", "") .. " "
|
return string.gsub(v, jump_text .. "|", "") .. " "
|
||||||
|
elseif #split == 1 then
|
||||||
|
string.gsub(v, jump_text, "")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return string.gsub(v, jump_text, "")
|
return string.gsub(v, jump_text, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return string.gsub(v, pattern, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
local content_with_marks = vim.deepcopy(content)
|
local content_with_marks = vim.deepcopy(content)
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ end
|
|||||||
neogen.utilities.cursor.go_next_extmark = function()
|
neogen.utilities.cursor.go_next_extmark = function()
|
||||||
local extm_list = vim.api.nvim_buf_get_extmarks(0, neogen_ns, 0, -1, {})
|
local extm_list = vim.api.nvim_buf_get_extmarks(0, neogen_ns, 0, -1, {})
|
||||||
if #extm_list ~= 0 then
|
if #extm_list ~= 0 then
|
||||||
|
|
||||||
vim.api.nvim_win_set_cursor(0, { extm_list[1][2] + 1, extm_list[1][3] })
|
vim.api.nvim_win_set_cursor(0, { extm_list[1][2] + 1, extm_list[1][3] })
|
||||||
|
|
||||||
if #extm_list ~= 0 then
|
if #extm_list ~= 0 then
|
||||||
vim.api.nvim_buf_del_extmark(0, neogen_ns, extm_list[1][1])
|
vim.api.nvim_buf_del_extmark(0, neogen_ns, extm_list[1][1])
|
||||||
end
|
end
|
||||||
@@ -30,7 +28,7 @@ end
|
|||||||
--- Goes to next extmark and start insert mode
|
--- Goes to next extmark and start insert mode
|
||||||
neogen.utilities.cursor.jump = function()
|
neogen.utilities.cursor.jump = function()
|
||||||
if neogen.utilities.cursor.go_next_extmark() then
|
if neogen.utilities.cursor.go_next_extmark() then
|
||||||
vim.api.nvim_command("startinsert!")
|
vim.api.nvim_command("startinsert")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -42,6 +40,7 @@ neogen.utilities.cursor.del_extmarks = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Checks if there are still possible jump positions to perform
|
||||||
neogen.utilities.cursor.jumpable = function ()
|
neogen.utilities.cursor.jumpable = function ()
|
||||||
local extm_list = vim.api.nvim_buf_get_extmarks(0, neogen_ns, 0, -1, {})
|
local extm_list = vim.api.nvim_buf_get_extmarks(0, neogen_ns, 0, -1, {})
|
||||||
if #extm_list ~= 0 then
|
if #extm_list ~= 0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user