Tags: improve VimwikiSearchTags which was not using user configuration (issue #1316) (v2)

This commit is contained in:
Tinmarino
2023-03-17 22:05:47 -03:00
parent 5eb5c9c71f
commit f4bd841a4c
4 changed files with 92 additions and 2 deletions
+18
View File
@@ -449,3 +449,21 @@ function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
let taglist = vimwiki#tags#get_tags()
return join(taglist, "\n")
endfunction
function! vimwiki#tags#search_tags(tag_pattern) abort
" See #1316 and rxTags in vars.vim
let tf = vimwiki#vars#get_syntaxlocal('tag_format')
" Craft regex
let rx_this_tag = '/'
let rx_this_tag .= tf.pre . '\@<=' . tf.pre_mark
let rx_this_tag .= '\%(' . tf.in . tf.sep . '\)*'
let rx_this_tag .= a:tag_pattern
let rx_this_tag .= '\%(' . tf.sep . tf.in . '\)*'
let rx_this_tag .= tf.post_mark . tf.post . '\@='
let rx_this_tag .= '/'
" Search in current wiki folder
return vimwiki#base#search(rx_this_tag)
endfunction