Skip to content

dburian/cmp-markdown-link

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmp-markdown-link

nvim-cmp source for completing markdown links.

Install

cmp-markdown-link requires plenary.nvim to be installed.

Install with favourite package manager.

E.g. plug:

Plug 'dburian/cmp-markdown-link'

Setup

Add markdown-link to your nvim-cmp sources.

Minimal setup:

require'cmp'.setup {
  sources = {
    { name = 'markdown-link' },
}

More involved setup:

local function png_or_markdown_files(path)
    return string.match(path, '.*%.png') or string.match(path, '.*%.md')
end

require'cmp'.setup {
  sources = {
    {
      name = 'markdown-link',
      option = {
        reference_link_location = 'top',
        searched_depth = 3,
        searched_dirs = {
          '%:h', --always search the current dir
          '~/docs/wiki', --custom path to search as well
        },
        --only offer links to .png or .md files
        search_pattern = png_or_markdown_files,
        wiki_base_url = '',
        wiki_end_url = '.md',
      }
  },
}

Warning for wiki-style links

Your links should always start with wiki_base_url and end with wiki_end_url. Otherwise the link target could become ambiguous. For more info type :help cmp-markdown-link.

Contributing

If you want a certain functionality to be implemented/changed, feel free to create issues and PRs. I will address/merge them when I have time.

About

nvim-cmp source for completing markdown links

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages