From 2cf605783e66523d1ac83cc65b2196193d81adcd Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Sun, 5 May 2024 19:55:49 +0300 Subject: [PATCH] fix: when opening a directory, insert mode is not activated Might fix https://github.com/mikavilpas/yazi.nvim/issues/58 --- lua/yazi.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/yazi.lua b/lua/yazi.lua index f7ad24cd..3a62af2b 100644 --- a/lua/yazi.lua +++ b/lua/yazi.lua @@ -85,6 +85,11 @@ function M.setup(opts) -- Remove the buffer as we want to show yazi instead vim.api.nvim_buf_delete(bufnr, { force = true }) M.yazi(M.config, file) + + -- HACK: for some reason, the cursor is not in insert mode when opening + -- yazi, so just simulate pressing "i" to enter insert mode :) + -- It did nothing when when I tried using vim.cmd('startinsert') or vim.cmd('normal! i') + vim.api.nvim_feedkeys('i', 'n', false) end end