Skip to content

Commit

Permalink
fix: user autocmd for TermOpen|startinsert (closes #1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Dec 31, 2024
1 parent 43c3a47 commit c054a21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/fzf-lua/fzf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ function M.raw_fzf(contents, fzf_cli_args, opts)
-- reason, for example, running `builtin` and opening another picker
vim.defer_fn(function()
-- Prevents inserting "i" when spamming `ctrl-g` in `grep_lgrep`
if vim.api.nvim_buf_is_valid(e.buf) then
-- Also verify we're not already in TERMINAL mode, could happen
-- if the user has an autocmd for TermOpen with `startinsert`
if vim.api.nvim_buf_is_valid(e.buf)
and vim.api.nvim_get_mode().mode ~= "t"
then
utils.feed_keys_termcodes("i")
end
end, 0)
Expand Down

0 comments on commit c054a21

Please sign in to comment.