How to refer to key combinations in vim keybinding that works on the query line

StackOverflow https://stackoverflow.com/questions/22766563

  •  24-06-2023
  •  | 
  •  

Frage

I use pandoc markdown in text files and want to automate links that refer to internal textnodes. For example I have a link like [\%110lund] going to the word "und" in line 110. To automate the jumping process I defined a keybinding:

nnoremap <Leader>l vi[y/<ctrl+r>0<CR>

Unfortunately <ctrl+r> is written as the query string instead of performed to copy the visual selection.

So my question is how do I have to notate <ctrl+r>0 at this location so that it is actually performed instead of written out

War es hilfreich?

Lösung

Use c+r instead of ctrl+r.

In order to avoid confusion, I am striking out the incorrect edit that someone else made, rather than reverting it. In the context of a vim mapping (such as the :nnoremap of this question) the following should be typed literally. For example, <c-r> really means 5 characters.

Use <c-r> instead of <ctrl+r>.

See :help keycodes for more options.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top