@Ajnasz this does not answer the question. I imagine this for situations in which for instance you want to open your file browser (whether it is something like neovim-tree, netrw, telescope-file-browser) with another plugin, but you do not want to couple that to any specific file browser, but you know for sure that it opens when you press “ff”, so you need to give your other plugin a function which simulates pressing the relevant keymap.
@rogtino I am not super sure, but I think it has to do with the “n” in your nvim_feedkeys call. It does not refer to “normal mode” as it may appear at first sight, but rather to the mode of the feedkeys call (see here and here), so you actually need to pass “m” as a parameter instead. So what you want is something like this:
local keys = vim.api.nvim_replace_termcodes("<esc><leader>f", true, false, true)
vim.api.nvim_feedkeys(keys, "m", false)