Replies: 1 comment
-
vim.keymap.set('c', '<C-R>', function()
if (fn.getcmdline() == '') and (fn.getcmdtype() == ':') then
-- switch to normal mode first
api.nvim_feedkeys(vim.keycode('<Esc>'), 'nt', false)
vim.schedule(function() require('fzf-lua').command_history() end)
else
api.nvim_feedkeys(vim.keycode('<C-R>'), 'nt', false)
end
end) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I defined such kind of mapping that reacts to Ctrl-R in command line when it's empty to open Fzf command history (and passes Ctr-R regularly if the command line is not empty):
It works, but I've been trying to turn it into more pure Lua avoiding vim command and using
command_history()
function instead, but I got stuck making it work. Here is my current WIP:It has two problems:
Ctr-R does call
require('fzf-lua').command_history()
which opens the UI with command history, but it doesn't get focused and doing anything next remains in the command line, not in the opened window.The other issue is that pressing Ctrl-R with non empty command line uses suggests
"
register only 50% of the time, while with the first solution it always works.Do you have any suggestions how this can be done correctly? I assume
nvim_feedkeys
isn't doing enough for it, or I missed something there.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions