1

I would like to have a key bindings on <C-l> and on <C-L>. But it seems that Vim is case-insensitive regarding this.

For example, if I have a Vim script like this:

imap <C-l> <C-W>l
imap <C-L> <Plug>(copilot-accept-word)

And I use <C-l> I always use the copilot-accept-word command instead of switching to the left window.

Is there a way to make Vim case sensitive?

3
  • 1
    The first mapping doesn’t switch windows, given that it’s an insert-mode mapping
    – D. Ben Knoble
    Feb 7 at 17:08
  • 1
    It is probably not the problem but the correct mapping is indeed: imap <C-l> <C-o><C-w>l Feb 7 at 17:19
  • 1
    @VivianDeSmedt Thanks
    – john
    Feb 7 at 22:52

1 Answer 1

0

If by <C-L> you mean CtrlShiftl I would do:

imap <C-S-l> <Plug>(copilot-accept-word)

Or even:

inoremap <C-S-l> <Plug>(copilot-accept-word)

As @romainl says this may only work if the underlying console sent two differents codes to Vim for CtrlShiftl and Ctrll.

But it should at least work on gVim.

4
  • 2
    This may not work in every context. Won't work in most terminal emulators.
    – romainl
    Feb 7 at 16:26
  • I have made some test on some consoles Windows + cmd, Linux + Kitty, Ubuntu + Terminal and it seems that the <C-S-l> is not very well supported :-| Feb 7 at 17:17
  • Sorry, that does not work for me. But I find it a bit strange that this is not supported. Why is this the case?
    – john
    Feb 7 at 23:01
  • Vim relies on what is sent to it by the console and tries to interpret it. If the same codes are sent Vim is screwed. In GUI version Vim has full access to the keyboard and can interpret it correctly. Feb 8 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.