0

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

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Cutú Chiqueño
  • 855
  • 1
  • 10
  • 24
  • I didn't quite get you. do you want to jump to next `[\%110lund]` when you were on the previous one? – Kent Mar 31 '14 at 16:10
  • The second answer in this [post](http://stackoverflow.com/questions/363111/search-for-selection-in-vim) is a workaround and probably more straight forward, but still not 100% the answer to the question, so I leave it open. It uses `q/p` instead of `0` – Cutú Chiqueño Mar 31 '14 at 16:11
  • @Kent No, my cursor is within the link and I want to jump to that line by hitting one key. As written in my previouse comment in the end I found a solution, but this solution works around the question how to refer to these multikey actions like `0` at this place in a keybinding, that means when entering the search mode or command mode – Cutú Chiqueño Mar 31 '14 at 16:15
  • your mapping just try to reach next `\%110lund` . two problems you have:``, not ``, and you may want to use `map expr` cannot help further since I still don't understand your requirement. – Kent Mar 31 '14 at 16:23
  • still thx. (the + character was just misstyped) – Cutú Chiqueño Mar 31 '14 at 19:32

1 Answers1

0

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.

benjifisher
  • 5,054
  • 16
  • 18