follow_link: reuse existing tabs with tab drop (closes #238)

Replaces :e in `vimwiki#base#follow_link()` with :drop, making this the
default behavior for pressing <CR> on a link.  Checks for the existence
of :drop first, since this isn't available in some builds.

Adds a new :VimwikiTabDropLink and makes this a default for the keybindings
formerly occupied by :VimwikiTabnewLink; leaving :VimwikiTabnewLink
available for backwards compatibility and anyone who still wants the old
behavior.

Doesn't touch the split window reuse functionality, or the
:VimwikiGoBackLink behavior, although I can see an argument for adding
:drop to the latter.

I've wanted this for a while and happened to notice @davidlmontgomery's
patch from 2016 in #238.  Code has moved around a little since, but I
think this is correct.
This commit is contained in:
Brennen Bearnes
2022-05-21 17:56:14 -06:00
committed by Brennen Bearnes
parent 3ac8e1ae14
commit 8e4202847f
3 changed files with 25 additions and 5 deletions
+10 -2
View File
@@ -370,8 +370,10 @@ MAP MODE
<C-S-CR>, <D-CR> n Follow wiki link (create target wiki page if needed),
opening in a new tab.
May not work in some terminals. Remapping could help.
Maps to |:VimwikiTabnewLink|.
Remap command: `<Plug>VimwikiTabnewLink`
Maps to |:VimwikiTabDropLink|.
Remap command: `<Plug>VimwikiTabDropLink`
See |:VimwikiTabnewLink| for old behavior which
always opens a new tab.
*vimwiki_<Backspace>*
<Backspace> n Go back to previously visited wiki page.
@@ -810,6 +812,11 @@ Vimwiki file.
*:VimwikiTabnewLink*
Follow wiki link in a new tab (create target wiki page if needed).
*:VimwikiTabDropLink*
Follow wiki link with tab drop, reusing any existing tabs with the page.
Creates a new tab if the page isn't already open (create target wiki page
if needed).
*:VimwikiNextLink*
Find next link on the current page.
@@ -3985,6 +3992,7 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from
https://github.com/vimwiki-backup/vimwiki/issues.
New:~
* Feature: #238: Reuse existing tabs with tab drop
* Issue #621: Feature request: Highlight code listings in HTML
* Issue #290: Calendar plugin, do not sign if no wiki
* Issue #281: Permit `\|` in tables