Skip to content

Instantly share code, notes, and snippets.

@g0xA52A2A
Last active June 18, 2020 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g0xA52A2A/7cb1be24a078724f4522444a0da5de0a to your computer and use it in GitHub Desktop.
Save g0xA52A2A/7cb1be24a078724f4522444a0da5de0a to your computer and use it in GitHub Desktop.

Many people (myself included) have set wildcharm=<C-Z> as suggested by :help 'wildcharm' in their config. However in mappings I often see this is repeated explicitly, e.g.

nnoremap <key> :buffer<Space><C-Z><S-Tab>

I prefer to refer to the setting itself, avoiding repetition and also making things more portable. A conversion of the above would be as follows.

nnoremap <key> :buffer<Space><C-R>=nr2char(&wildcharm)<CR><S-Tab>

Note the value of wildcharm is stored as a number, so whilst it may have been set using Vim's key code notation we'll need to convert it back to a character to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment