[vim/vim] Can't map ctrl slash in nightly gVIM build on Windows (Issue #9895)

113 views
Skip to first unread message

Alvin

unread,
Mar 5, 2022, 4:37:25 PM3/5/22
to vim/vim, Subscribed

Steps to reproduce

I tried both noremap <C-/> and `noremap <C-_>' to map ctrl slash but neither worked. Press Ctrl+V followed by Ctrl+/ in insert mode does nothing.

Expected behaviour

Map ctrl slash

Version of Vim

v8.2.4501 64 bit windows installer from https://github.com/vim/vim-win32-installer/releases

Environment

Windows

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895@github.com>

lacygoill

unread,
Mar 6, 2022, 1:19:38 AM3/6/22
to vim/vim, Subscribed

Press Ctrl+V followed by Ctrl+/ in insert mode does nothing.

  • Which terminal are you using?
  • Do you get the same result in the terminal? Execute a cat(1) command then press Ctrl+/.
  • Can you reproduce without config (vim -Nu NONE)?


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059903415@github.com>

lacygoill

unread,
Mar 6, 2022, 1:22:53 AM3/6/22
to vim/vim, Subscribed

Which terminal are you using?

Ah my bad, your issue is in the GUI.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059903733@github.com>

lacygoill

unread,
Mar 6, 2022, 1:32:34 AM3/6/22
to vim/vim, Subscribed

FWIW, on Ubuntu, I can map <C-/> like this:

nnoremap <C-S-/> <Cmd>echomsg "Ctrl-/ was hit"<CR>

Test:

$ vim -Nu NONE -g +'nnoremap <C-S-/> <Cmd>echomsg "Ctrl-/ was hit"<CR>'

Note that I need to specify the shift modifier in the lhs of the mapping because I need to press it to produce a slash with my keyboard layout. But your keyboard layout might be different and not require shift.


Did it work in the past, and broke at some point? If so bisecting the regression might help.


Also, make sure to do a test without any config. If you can still reproduce, and nothing is inserted when you press Ctrl-V followed by Ctrl-/, then it might be that the keypress is intercepted before reaching Vim, by some other program (window manager, OS, ...).


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059904606@github.com>

lacygoill

unread,
Mar 6, 2022, 1:34:55 AM3/6/22
to vim/vim, Subscribed

Did it work in the past, and broke at some point? If so bisecting the regression might help.

If it's a regression, it might have been caused by the patch 8.2.4502.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059904800@github.com>

lacygoill

unread,
Mar 6, 2022, 2:07:55 AM3/6/22
to vim/vim, Subscribed

If it's a regression, it might have been caused by the patch 8.2.4502.

Never mind, that patch can't be the issue, because your Vim version is 8.2.4501.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059908637@github.com>

Alvin

unread,
Mar 6, 2022, 9:10:04 AM3/6/22
to vim/vim, Subscribed

Thank you for the prompt reply. I launched gVIM using `gvim --clean' and still didn't see anything after pressing Ctrl+V followed by Ctrl+/. I presume my keyboard is working fine since Ctrl+/ works in Visual Studio, I could be wrong though.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059969670@github.com>

Bram Moolenaar

unread,
Mar 6, 2022, 9:38:40 AM3/6/22
to vim/vim, Subscribed

This must be a Windows specific issue, on Linux it works fine. Without mapping CTRL-/ inserts a slash.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059974392@github.com>

lacygoill

unread,
Mar 6, 2022, 9:51:14 AM3/6/22
to vim/vim, Subscribed

still didn't see anything after pressing Ctrl+V followed by Ctrl+/

If Vim doesn't receive any keycode, then it can't do anything. The only explanation I can see is that something else intercepts the keypress.

Can you reproduce the issue in a terminal?

If so, try to get a log file:

$ vim --clean -g +'call ch_logfile("/tmp/logfile", "w")'


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059976374@github.com>

Alvin

unread,
Mar 6, 2022, 11:06:20 AM3/6/22
to vim/vim, Subscribed

I can map Ctrl+/ using vim launched through cmd.exe. I think it's a gVIM specific issue.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1059989815@github.com>

Christian Brabandt

unread,
Mar 12, 2022, 11:05:28 AM3/12/22
to vim/vim, Subscribed

I cannot use ctrl+/ in either cmd vim nor in gvim. Could that be a windows specific issue? perhaps you need to configure windows keyboard language?


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1065908728@github.com>

Christian Brabandt

unread,
Mar 12, 2022, 11:28:55 AM3/12/22
to vim/vim, Subscribed

also please see the following: https://vimhelp.org/vim_faq.txt.html#faq-20.5


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1065912858@github.com>

mattn

unread,
Apr 10, 2022, 3:41:14 AM4/10/22
to vim/vim, Subscribed

As far as I looked this, is not possible to handle with WM_CHAR or WM_SYSCHAR. Only WM_KEYUP can handle this.

diff --git a/src/gui_w32.c b/src/gui_w32.c
index 584e4ef3e..d088cf7a9 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -4635,6 +4635,18 @@ _WndProc(
 	}
 	break;
 
+    case WM_KEYUP:
+	// handle CTRL-/
+	if ((GetKeyState(VK_CONTROL) & 0x8000) != 0 && (wParam == 0xBF)) {
+	    char_u string[4];
+	    string[0] = CSI;
+	    string[1] = KS_MODIFIER;
+	    string[2] = 4;
+	    string[3] = 0x2F;
+	    add_to_input_buf(string, 4);
+	}
+	return 0L;
+
     case WM_CHAR:
 	// Don't use HANDLE_MSG() for WM_CHAR, it truncates wParam to a single
 	// byte while we want the UTF-16 character value.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1094207991@github.com>

mattn

unread,
Apr 10, 2022, 4:13:42 AM4/10/22
to vim/vim, Subscribed

At the least, <c-_> insert some thing characters (^_), it is different issue from <c-/>.

Issue of <c-/> fixes with #10141


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1094214178@github.com>

Christian Brabandt

unread,
May 28, 2022, 3:42:13 AM5/28/22
to vim/vim, Subscribed

fixed by e08fde0


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1140197206@github.com>

Christian Brabandt

unread,
May 28, 2022, 3:42:15 AM5/28/22
to vim/vim, Subscribed

Closed #9895 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/9895/issue_event/6696613766@github.com>

Alvin

unread,
May 29, 2022, 2:45:09 AM5/29/22
to vim/vim, Subscribed

Thank you @mattn and @chrisbra for fixing it, I confirm it works. You guys are real champs.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/1140388699@github.com>

zhyzky

unread,
Oct 14, 2024, 2:57:09 AM10/14/24
to vim/vim, Subscribed

With current version 9.1.0781, seems brocken again


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/2410192123@github.com>

Christian Brabandt

unread,
Oct 14, 2024, 4:26:52 AM10/14/24
to vim/vim, Subscribed

https://github.com/vim/vim/blob/7d755d8ef328a3eced18c57ea1b569898cc448a2/runtime/doc/version9.txt#L41658-L41659


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/2410419280@github.com>

zhyzky

unread,
Oct 14, 2024, 5:02:16 AM10/14/24
to vim/vim, Subscribed

https://github.com/vim/vim/blob/7d755d8ef328a3eced18c57ea1b569898cc448a2/runtime/doc/version9.txt#L41658-L41659

Thanks. I've find this.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9895/2410511921@github.com>

Reply all
Reply to author
Forward
0 new messages