1

I have this line in my .vimrc

nnoremap <C-'> :marks<CR>

and want to use Ctrl-' to show all marks.

Sadly, it never works, be it on ubuntu, cygwin, or windows 10.

After vim 8.0 was launched, type :nn <C-'> echos

n  <C-'>       * :marks<CR>

Thus I wonder, is it possible to reliably remapping <C-'>? or I missed something?

1

2 Answers 2

6

Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. (For <C-'>, I get a ' in GVIM.) This also applies to <Tab> / <C-I>, <CR> / <C-M> / <Esc> / <C-[> etc. (Only exception is <BS> / <C-H>.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8

But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim release.

1

If you're on a mac, download https://karabiner-elements.pqrs.org

This will let you turn any ctrl-key combination into a real character which you can then map. Use the "Complex modification" feature to do so. You can download modifications that others have submitted to a central repo or you can roll your own with a simple-to-use json file. See documentation for guidance.

I'm sure similar programs exist on windows and linux. Anyone?

Your Answer

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

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