Fix first time insert mode

I did a silly workaround because when at normal mode and going to insert
mode, it is not the same as being in insert mode and going to insert
mode. Somehow the cursor jumping is broken.

So what i did was to call a insert_mode a first time before any actual
jumping.
This commit is contained in:
Daniel Mathiot
2021-08-28 01:31:51 +02:00
parent 56b20fcd11
commit 499a4301fa
2 changed files with 25 additions and 12 deletions

View File

@@ -65,14 +65,12 @@ neogen.generate = function(opts)
if matched then
local split = vim.split(matched, "|", true)
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, "")
return string.gsub(v, jump_text .. "|", "")
end
else
return string.gsub(v, jump_text, "")
end
return string.gsub(v, pattern, "")
end
@@ -93,7 +91,9 @@ neogen.generate = function(opts)
neogen.utilities.cursor.create(to_place + i, input_start)
end
end
neogen.utilities.cursor.jump()
if neogen.utilities.cursor.jumpable() then
neogen.utilities.cursor.jump({ first_time = true })
end
end
end
end
@@ -129,7 +129,7 @@ neogen.setup = function(opts)
if neogen.configuration.enabled == true then
neogen.generate_command()
vim.api.nvim_set_keymap("i", neogen.configuration.jump_map, "<cmd>lua require('neogen').jump_next()<CR>", { })
vim.api.nvim_set_keymap("i", neogen.configuration.jump_map, "<cmd>lua require('neogen').jump_next()<CR>", {})
end
end