dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit bb63096d4da9e2221590b5fdf77d41ab8fe9ecfb
parent ac100b078306d74bf10840b3e8b58a9884bffde7
Author: Chris Bracken <chris@bracken.jp>
Date:   Thu, 19 Dec 2024 11:07:56 -0800

vim: remap <C-]> to <C-\\><C-n> in terminals

In neovim terminals, C-] (ESC) is passed through to the terminal, so the
only way to return to normal mode is <C-\><C-n>, which is particularly
difficult on a japanese keyboard, since there is no physical \ key, just
a ¥ key.

Instead, map C-] to behave as C-] would in non-terminal contexts.

Diffstat:
M.config/nvim/lua/config/keymaps.lua | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua @@ -7,8 +7,9 @@ vim.keymap.set('n', '<Down>', '<NOP>') vim.keymap.set('n', '<Left>', '<NOP>') vim.keymap.set('n', '<Right>', '<NOP>') --- In terminal, ESC returns to normal mode. -vim.keymap.set('t', '<Esc>', '<C-\\><C-n>') +-- In terminal, C-[ (ESC) is passed through to the terminal by default. +-- Remap C-] to return to normal mode like C-[ does by default. +vim.keymap.set('t', '<C-]>', '<C-\\><C-n>') -- Retain selection on <,>. vim.keymap.set('v', '<', '<gv')