Skip to content

Using ncm2 for link completion #163

@j-hui

Description

@j-hui

The docs only discuss making ncm2 aware of the syntax subscopes in a wiki, but don't say anything about using ncm2 for completing links.

In case this is of any value to others, the following registers wiki.vim's omnicomplete function as a source for ncm2:

autocmd User WikiBufferInitialized call ncm2#register_source({
            \ 'name': 'wiki',
            \ 'priority': 9,
            \ 'scope': ['wiki'],
            \ 'word_pattern': '\w+',
            \ 'complete_pattern': '\[\[',
            \ 'on_complete': ['ncm2#on_complete#delay', 200,
            \                 'ncm2#on_complete#omni',
            \                 'wiki#complete#omnicomplete'],
            \ })

This allows wiki-style links to be autocompleted (but not markdown-style links). Perhaps this could be added to the documentation? Or should this be put into a separate ncm2-wiki.vim plugin (like many ncm2 plugin sources are)?

(This is also my first time adding a source to ncm2 so any feedback is appreciated.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions