Ctrl-[ is not working on CtrlSpace buffer with Kitty terminal.
Describe the bug
Ctrl-[ is alternative key of ESC. If I hit Ctrl-[, it should work as if I pressed ESC key. But on CtrlSpace buffer, e.g. file searching mode, if I am using Kitty terminal, Ctrl-[ does not work.
It is weird. Kitty looks like working as it should because CTRL-[ is working on insert, normal, visual mode. But on CtrlSpace mode, (or CtrlSpace buffer?) it does not work. But on same environment, but with Alacritty terminal, it works.
To Reproduce Steps to reproduce the behavior:
- Open Kitty terminal and launch Neovim.
- Open CtrlSpace window. e.g. CTRL-Space
- Hit
CTRL-[
Expected behavior CtrlSpace window should close.
Version(s) (please complete the following information):
- OS: Archlinux
- Version: Neovim v0.7.2, Kitty 0.25.2, Alacritty 0.10.1
Hello, I can't reproduce with Vim 9.0.313 in Urxvt, but in Xterm it sends ␛[27;5;91~ (instead of closing the ctrlspace buffer) as documented here/
Maybe this can help you configuring Kitty suitably?
For what it's worth, I tried
diff --git a/autoload/ctrlspace/keys/common.vim b/autoload/ctrlspace/keys/common.vim
index ad985b5..b060df8 100644
--- a/autoload/ctrlspace/keys/common.vim
+++ b/autoload/ctrlspace/keys/common.vim
@@ -27,7 +27,7 @@ function! ctrlspace#keys#common#Init() abort
call s:map("ScrollUp", 'C-b')
call s:map("HalfScrollDown", 'C-d')
call s:map("HalfScrollUp", 'C-u')
- call s:map("Close", "q", "Esc", 'C-c')
+ call s:map("Close", "q", "Esc", 'C-c', 'C-[')
call s:map("Quit", "Q")
call s:map("EnterSearchMode", "/")
call s:map("RestorePreviousSearch", 'C-p')
diff --git a/autoload/ctrlspace/keys/help.vim b/autoload/ctrlspace/keys/help.vim
index 06aaa7c..3efc090 100644
--- a/autoload/ctrlspace/keys/help.vim
+++ b/autoload/ctrlspace/keys/help.vim
@@ -3,7 +3,7 @@ let s:modes = ctrlspace#modes#Modes()
function! ctrlspace#keys#help#Init() abort
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#ToggleHelp", "Help", ["BS", "?"])
- call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Close", "Help", ["q", "Esc", "C-c"])
+ call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Close", "Help", ["q", "Esc", "C-c", "C-["])
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Quit", "Help", ["Q"])
call s:map("Down", "j")
diff --git a/autoload/ctrlspace/keys/nop.vim b/autoload/ctrlspace/keys/nop.vim
index fb4e1bf..4b6b64b 100644
--- a/autoload/ctrlspace/keys/nop.vim
+++ b/autoload/ctrlspace/keys/nop.vim
@@ -15,7 +15,7 @@ function! ctrlspace#keys#nop#Init() abort
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#ToggleTabModeAndSearch", "Nop", ["L"])
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#ToggleBookmarkMode", "Nop", ["b"])
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#ToggleBookmarkModeAndSearch", "Nop", ["B"])
- call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Close", "Nop", ["q", "Esc", 'C-c'])
+ call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Close", "Nop", ["q", "Esc", 'C-c', 'C-['])
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Quit", "Nop", ["Q"])
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#RestorePreviousSearch", "Nop", ['C-p'])
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#RestoreNextSearch", "Nop", ['C-n'])
diff --git a/autoload/ctrlspace/keys/search.vim b/autoload/ctrlspace/keys/search.vim
index 835c9fc..448845f 100644
--- a/autoload/ctrlspace/keys/search.vim
+++ b/autoload/ctrlspace/keys/search.vim
@@ -3,7 +3,7 @@ let s:modes = ctrlspace#modes#Modes()
function! ctrlspace#keys#search#Init() abort
call ctrlspace#keys#AddMapping("ctrlspace#keys#common#ToggleHelp", "Search", ["?"])
- call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Close", "Search", ["Esc", 'C-c'])
+ call ctrlspace#keys#AddMapping("ctrlspace#keys#common#Close", "Search", ["Esc", 'C-c', 'C-['])
call ctrlspace#keys#AddMapping("ctrlspace#keys#search#ClearOrRemoveLetter", "Search", ["BS", 'C-h'])
call ctrlspace#keys#AddMapping("ctrlspace#keys#search#SwitchOff", "Search", ["/", "CR"])
call ctrlspace#keys#AddMapping("ctrlspace#keys#search#SwitchOffCR", "Search", ["Tab"])
to no avail.
Maybe you can check what happens if you edit one of those files as well, say in common.vim?
@Konfekt Sorry for late reply.
I have checked this today, and it works now without any issue. Maybe my environment or something has been updated.
Thanks