From 4698583586bb72640319e88adde90fbee619e80e Mon Sep 17 00:00:00 2001 From: Stephen Solka Date: Thu, 29 Apr 2021 17:06:32 -0400 Subject: [PATCH] create an extension point to let users override wiki page lookups --- autoload/wiki/url/wiki.vim | 4 ++++ doc/wiki.txt | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/autoload/wiki/url/wiki.vim b/autoload/wiki/url/wiki.vim index 26309edc..a6a6fe13 100644 --- a/autoload/wiki/url/wiki.vim +++ b/autoload/wiki/url/wiki.vim @@ -20,6 +20,10 @@ function! wiki#url#wiki#parse(url) abort " {{{1 \ . (l:anchors[0] =~# '/$' ? b:wiki.index_name : '') endif + if exists('*WikiSearchCommand') + let l:fname = WikiSearchCommand(g:wiki_root, l:fname) + endif + " Extract the full path let l:url.path = l:fname[0] ==# '/' \ ? wiki#get_root() . l:fname diff --git a/doc/wiki.txt b/doc/wiki.txt index 790bc4f0..a271cc04 100644 --- a/doc/wiki.txt +++ b/doc/wiki.txt @@ -513,6 +513,13 @@ OPTIONS *wiki-config-options* Default: `'~/.local/zotero'` +*WikiSearchCommand* + Funcref that takes wiki_root and filename and its return is the file to open + relative to the wiki_root. Define function in vimrc to override wiki page + lookup. + + Default: Undefined + ------------------------------------------------------------------------------ EVENTS *wiki-config-events*