1

The ergodox keyboard I use has two dedicated modifier keys ( Alt - Shift - Ctrl ) and ( Alt - Shift - Ctrl - Windows)

I would like to use the modifiers in my vimrc to do more specific tasks.

nnoremap <A-S-C-P> ihello

Was my initial test, it did not seem to work, however I didn't find too many example of multiple modifier keys in vim.

Is this possible/is there a better way to do this?

1
1

It depends:

  • If this is terminal-bound Vim (i.e. the good old traditional way) then it will only work if the terminal type you're using has a way to encode multiple modifier keys when delivering them through curses to Vim.

    The most common sort of terminal can't do that, so chances are excellent that this is what's causing your symptom.

  • GUI Vim front-ends will usually get you around this problem because the operating system's GUI layer does have a way to pass multiple modifier keys down to the GUI Vim front end, and it will pass them down to Vim.

    In this case, you can add a if has("gui_running") conditional around your map calls in your .vimrc file to create mappings intended to work only while under a GUI version of Vim. I will usually create an alternate mapping in the "else" clause so I have another way to get the same function.

4
  • I can do it in xterm Jul 16 '20 at 18:06
  • @Jorengarenar: I'm pretty sure the ANSI X3.64 protocol -- of which the xterm protocols are descendants -- doesn't have a way to distinguish S-A from capital A. Thus the OP's problem. You might be able to define C-A-A, but not a distinct C-A-S-A that does something different. Jul 16 '20 at 18:25
  • I've mapped <C-A-S-A> to :echo 1<CR> and <C-A-A> to :echo 2<CR>. Got 1 and 2 respectively. I use XTerm(357) Jul 16 '20 at 18:31
  • @Jorengarenar: That sounds like one of the extensions that xterm made over ANSI, then. Jul 16 '20 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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