vimwiki-backup / vimwiki

Automatically exported from code.google.com/p/vimwiki
1 stars 1 forks source link

Mapping to insert wikilink (backwards link) to previously visited page #373

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

Here's a mapping that inserts a [[-wikilink to the page from which the current 
page was opened

    au FileType vimwiki nmap <Leader>wf i<c-r>=substitute(b:vimwiki_prev_link[0], VimwikiGet('path').'\(.*\)'.VimwikiGet('ext'), '[[\1]]', '')<cr><Esc>

For example, suppose I am on a page named HomePage, and I follow a link to 
Page2.  Then, executing this mapping on Page2 will insert [[HomePage]] at the 
cursors position.

This is different from the VimwikiBacklinks command, because it only inserts a 
backlink to the single page that was visited prior to the current page, and not 
all possible pages that link to the current page.  It is also much faster ...

-s.

Original issue reported on code.google.com by stu.andrews on 5 Sep 2012 at 4:51