diff --git a/after/ftplugin/markdown.vim b/after/ftplugin/markdown.vim index d5367a8..d6d7e46 100644 --- a/after/ftplugin/markdown.vim +++ b/after/ftplugin/markdown.vim @@ -25,7 +25,7 @@ let b:loaded_denote_ftplugin_notes = 1 " Find the column where the completion starts. This must be between 1 and " col('.'). Denote links are of this form: `denote:`. -function s:column() +function DenoteNoteCompleteLinkColumn() " Get the substring from the start of the line until col('.') let l:x = max([1, col('.')-2]) let l:l = getline('.')[:l:x] @@ -48,7 +48,7 @@ function s:column() endfunction " Return completion items given by the base -function s:suggestions(base) +function DenoteNoteCompleteLinkSuggestions(base) let l:prefix = a:base->matchstr('^denote:\zs.*$') let l:flist = glob(g:denote_directory .. '/' .. (l:prefix ? '*' .. l:prefix .. '*' : '*'), 0, v:true) let l:res = [] @@ -68,19 +68,19 @@ function s:suggestions(base) endfunction " Completion function for denote links -function s:complete_link(findstart, base) - return a:findstart == 1 ? s:column() : s:suggestions(a:base) +function DenoteNoteCompleteLink(findstart, base) + return a:findstart == 1 ? DenoteNoteCompleteLinkColumn() : DenoteNoteCompleteLinkSuggestions(a:base) endfunction -setlocal omnifunc=s:complete_link() +setlocal omnifunc=DenoteNoteCompleteLink " Denote links are of the form 'denote:'; we require the column. setlocal isfname+=: " Set the function to resolve the filename under the cursor (see |gf|). -function s:gotofile() +function DenoteNoteGotoFile() return v:fname !~ '^denote:' \ ? v:fname \ : libdenote#scheme_find(g:denote_directory, v:fname[7:]) ?? v:fname endfunction -setlocal includeexpr=s:gotofile() +setlocal includeexpr=DenoteNoteGotoFile() " Back references command let b:meta = libdenote#scheme_metadata(expand('%:t'))