kis9a / vimsidian

Vim plugin for PKM like obsidian.md
Do What The F*ck You Want To Public License
54 stars 0 forks source link

Insert mode completion of note names not working in Neovim #11

Open mmannes opened 1 year ago

mmannes commented 1 year ago

Plugin seems to be working, it is highlighting links to notes and jumping to them with but it does not suggest the note names while I am typing a new link.

Any suggestion on how to debug to find what is happening?

kis9a commented 1 year ago

@mmannes

Thanks for posting the issue! completefunc is used. Type <C-x><C-u> in insert mode to display a popup with completion suggestions.

vimsidian's completefunc is invoked with the following condition, which displays files in the directory g:vimsidian_complete_paths as candidates for completion.

if g:vimsidian_enable_complete_functions
  au BufNewFile,BufReadPost $VIMSIDIAN_PATH_PATTERN setlocal completefunc=vimsidian#CompleteNotes
endif

Depends on the following variables, compare the contents displayed by :echo with the assumed variables

:echo g:vimsidian_enable_complete_functions
:echo $VIMSIDIAN_PATH_PATTERN
:echo g:vimsidian_complete_paths
:echo g:vimsidian_path

Here is an example of a simple setup for using compltefunc Please refer to it.

let g:vimsidian_enable_complete_functions = 1
let g:vimsidian_path = "/root/obsidian"
let g:vimsidian_complete_paths = [g:vimsidian_path . "/notes", g:vimsidian_path . "/articles"]
let $VIMSIDIAN_PATH_PATTERN = g:vimsidian_path . "/*.md"