From ac8949ce4fb2a3e4ae260ea8fd2d8d029d50815c Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Mon, 1 Sep 2025 18:46:27 +0200 Subject: [PATCH] feat: add terminal ESC mapping --- lua/ow/core/mappings.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/ow/core/mappings.lua b/lua/ow/core/mappings.lua index d72582b..f311aad 100644 --- a/lua/ow/core/mappings.lua +++ b/lua/ow/core/mappings.lua @@ -19,6 +19,15 @@ vim.keymap.set({ "n", "x", }, "+", ":call setreg('+', @\")") -- Allow exiting insert mode in terminal by hitting vim.keymap.set("t", "", "") +-- Feed ESC in terminal mode using +vim.keymap.set("t", "", function() + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes("", true, false, true), + "n", + false + ) +end) + -- Use :diffput/get instead of normal one to allow staging visual selection vim.keymap.set({"n", "x"}, "dp", ":diffput") vim.keymap.set({"n", "x"}, "do", ":diffget")