Nedra1998/nvim-mdlink

github github
programming-languages-supportmarkdown-and-latex
stars 14
issues 1
subscribers 1
forks 1
CREATED

2022-12-30

UPDATED

11 days ago


nvim-mdlink

nvim-mdlink provides additional functionality when working with markdown links.

:sparkles: Features

  • Follow link under cursor
  • Create new link from selected text
  • Open links in the default browser
  • Open binary files in the system default application
  • nvim-cmp markdown link completion integration

:zap: Requirements

:package: Installation

Install with vim-plug:

Plug 'Nedra1998/nvim-mdlink'

or with packer.nvim:

use { 'Nedra1998/nvim-mdlink' }

or with lazy.nvim:

{ 'Nedra1998/nvim-mdlink' }

:gear: Configuration

require('nvim-mdlink').setup({
  keymap = true,
  cmp = true
})

For a complete list of available configuration options see :help nvim-mdlink-configuration.

Each option is documented in :help nvim-mdlink.OPTION_NAME.

:rocket: Usage

Keybinding

See :help nvim-mdlink-mappings.

Keybinding Description
<CR> Follow the link under the cursor, or create a new link
<BS> After following a link, go back to the previous file

nvim-cmp Integration

If nvim-mdlink.cmp is true, then the mdlink completion source will be registered in nvim-cmp is available (i.e. if nvim-cmp has already been loaded by your plugin manager). If nvim-mdlink is loaded before nvim-cmp, then you will need to manually register the completion source in the configuration for nvim-cmp, by using the following snippet.

local has_mdlink, mdlink = pcall(require, "nvim-mdlink.cmp")
if has_mdlink then
  require('cmp').register_source("mdlink", mdlink.new())
end

Then you are able to make use the the mdlink completion source in your nvim-cmp configuration.

require('cmp').setup {
  sources = {
    { name = 'mdlink' }
  }
}