From 0a0c68f8af1cec69ea56128be5796667d0173772 Mon Sep 17 00:00:00 2001 From: Moshe Avni Date: Sat, 28 Dec 2024 11:03:19 +0200 Subject: [PATCH] defer after input --- nvim/.config/nvim/lua/plugins/git.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/plugins/git.lua index 7a352ca..4ef826e 100644 --- a/nvim/.config/nvim/lua/plugins/git.lua +++ b/nvim/.config/nvim/lua/plugins/git.lua @@ -50,14 +50,16 @@ local actions = function() ['Delete tag'] = git_funcs.ui_select_delete_tag, ['Find in all commits'] = function() local rev_list = vim.fn.FugitiveExecute({ 'rev-list', '--all' }).stdout - vim.ui.input({ prompt = 'Enter search term: ' }, function(search_term) - if not search_term then - git_funcs.prnt 'Canceled.' - return - end - git_funcs.prnt('Searching for ' .. search_term .. ' in all commits...') - vim.cmd('silent Ggrep ' .. vim.fn.fnameescape(search_term) .. ' ' .. table.concat(rev_list, ' ')) - end) + vim.defer_fn(function() + vim.ui.input({ prompt = 'Enter search term: ' }, function(search_term) + if not search_term then + git_funcs.prnt 'Canceled.' + return + end + git_funcs.prnt('Searching for ' .. search_term .. ' in all commits...') + vim.cmd('silent Ggrep ' .. vim.fn.fnameescape(search_term) .. ' ' .. table.concat(rev_list, ' ')) + end) + end, 100) end, ['Push (:Gp)'] = git_funcs.push, ['Pull (:Gl)'] = git_funcs.pull,