Skip to content

Commit 13cafc6

Browse files
XXiaoARobitx
authored andcommitted
fix: set feedkeys mode to xn (resolve #100)
1 parent 607f94d commit 13cafc6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lua/gp/init.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ M.prep_md = function(buf)
13671367

13681368
-- ensure normal mode
13691369
vim.api.nvim_command("stopinsert")
1370-
M._H.feedkeys("<esc>", "x")
1370+
M._H.feedkeys("<esc>", "xn")
13711371
end
13721372

13731373
M.is_chat = function(buf, file_name)
@@ -1432,7 +1432,7 @@ M.prep_chat = function(buf, file_name)
14321432
vim.api.nvim_command(M.config.cmd_prefix .. rc.command)
14331433
-- go to normal mode
14341434
vim.api.nvim_command("stopinsert")
1435-
M._H.feedkeys("<esc>", "x")
1435+
M._H.feedkeys("<esc>", "xn")
14361436
end, rc.comment)
14371437
else
14381438
_H.set_keymap({ buf }, mode, rc.shortcut, ":<C-u>'<,'>" .. cmd, rc.comment)
@@ -1570,7 +1570,7 @@ M.open_buf = function(file_name, target, kind, toggle)
15701570
vim.api.nvim_command("silent file " .. file_name)
15711571
else
15721572
-- move cursor to the beginning of the file and scroll to the end
1573-
M._H.feedkeys("ggG", "x")
1573+
M._H.feedkeys("ggG", "xn")
15741574
end
15751575

15761576
-- delete whitespace lines at the end of the file
@@ -1699,7 +1699,7 @@ M.new_chat = function(params, model, system_prompt, toggle)
16991699
if params.range == 2 then
17001700
M.append_selection(params, cbuf, buf)
17011701
end
1702-
M._H.feedkeys("G", "x")
1702+
M._H.feedkeys("G", "xn")
17031703
return buf
17041704
end
17051705

@@ -1785,7 +1785,7 @@ M.cmd.ChatPaste = function(params)
17851785
buf = win_found and buf or M.open_buf(last, target, M._toggle_kind.chat, true)
17861786

17871787
M.append_selection(params, cbuf, buf)
1788-
M._H.feedkeys("G", "x")
1788+
M._H.feedkeys("G", "xn")
17891789
end
17901790

17911791
M.cmd.ChatDelete = function()
@@ -2479,7 +2479,7 @@ M.cmd.Context = function(params)
24792479
M.append_selection(params, cbuf, buf)
24802480
end
24812481

2482-
M._H.feedkeys("G", "x")
2482+
M._H.feedkeys("G", "xn")
24832483
end
24842484

24852485
M.Prompt = function(params, target, prompt, model, template, system_template, whisper)
@@ -2657,7 +2657,7 @@ M.Prompt = function(params, target, prompt, model, template, system_template, wh
26572657
table.insert(messages, { role = "user", content = user_prompt })
26582658

26592659
-- cancel possible visual mode before calling the model
2660-
M._H.feedkeys("<esc>", "x")
2660+
M._H.feedkeys("<esc>", "xn")
26612661

26622662
local cursor = true
26632663
if not M.config.command_auto_select_response then

0 commit comments

Comments
 (0)