0

I have this idea of binding b pressed after control (which would preserve original C-b behaviour to Denite buffer and C f to Denite file_rec. But nnoremap <silent> <C>f :Denite file_rec<CR> doesn't work.

Oh, and I know all about leader key. I don't need any workaround.

1
  • I am not sure you can use Control as a standalone key. Sorry for bothering you with a workaround, but you can do something like <C-B>b. This way, when you press Control+b it will wait for the second 'b', if time goes out you'll get the original control+b function.
    – lsrdg
    Commented Mar 18, 2017 at 7:51

2 Answers 2

2

The answer is no, you can't. That is because Ctrl on its own is not mappable. Ctrl key works by substracting some value from the key code that is pressed with it, so for example Esc has same value and meaning in Vim as Ctrl[.

3
  • Not even in GUI versions? Commented Mar 18, 2017 at 8:10
  • Nope, there are hacks to remap it to capslock to ctrl and or ctrl to esc: github.com/mhinz/vim-galore#map-capslock-to-control . But nothing as free as you want. The closest I could find was the <C-b>b on the other comment.
    – lsrdg
    Commented Mar 18, 2017 at 9:02
  • I would need to think about it, but since I never use C-b and C-f I've decided to remap them for now. However on my main keyboard ergodox control pressed without other keys acts as ESC already, so maybe with right delays I can use <Esc>b. Interesting idea. Commented Mar 18, 2017 at 10:17
0

While Vim (or the Terminal) do not support this, you can get this effect by using something like Karabiner (Mac) or Autohotkey (Windows).

You would use it to map a single control press to some key you are not using (like F12) and then use that for the mapping in Vim.

1
  • you can add hammerspoon to that list instead of Karabiner, because Karabiner Elements can't map control tap to escape on sierra. Commented Mar 18, 2017 at 14:00

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.