From 43f47bace94bea5c7addb93f972cf02c46527e9d Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Sun, 23 Jun 2024 21:54:38 +0300 Subject: [PATCH] refactor: remove hacky workaround for in insert mode Co-authored-by: BonaBeavis --- lua/yazi/config.lua | 7 +++++++ lua/yazi/window.lua | 9 --------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lua/yazi/config.lua b/lua/yazi/config.lua index 7fa2e793..4fea7750 100644 --- a/lua/yazi/config.lua +++ b/lua/yazi/config.lua @@ -1,3 +1,5 @@ +---@module "plenary.path" + local openers = require('yazi.openers') local keybinding_helpers = require('yazi.keybinding_helpers') @@ -42,6 +44,11 @@ function M.default_set_keymappings_function(yazi_buffer, config) vim.keymap.set({ 't' }, '', function() keybinding_helpers.open_file_in_vertical_split(config) end, { buffer = yazi_buffer }) + vim.keymap.set('t', '', '', { buffer = yazi_buffer }) + + -- LazyVim sets to forcibly enter normal mode. This has been + -- confusing for some users. Let's disable it when using yazi.nvim only. + vim.keymap.set({ 't' }, '', '', { buffer = yazi_buffer }) vim.keymap.set({ 't' }, '', function() keybinding_helpers.open_file_in_horizontal_split(config) diff --git a/lua/yazi/window.lua b/lua/yazi/window.lua index c6211a20..1aaca51d 100644 --- a/lua/yazi/window.lua +++ b/lua/yazi/window.lua @@ -90,15 +90,6 @@ function YaziFloatingWindow:open_and_display() self:add_hacky_mouse_support(yazi_buffer) end - vim.api.nvim_create_autocmd('ModeChanged', { - buffer = yazi_buffer, - callback = function() - -- HACK Sometimes pressing "" exits insert mode the first time it's pressed. - -- Work around this by starting insert mode after the first time the mode changes. - vim.cmd('startinsert') - end, - }) - vim.api.nvim_create_autocmd({ 'VimResized' }, { buffer = yazi_buffer, callback = function()