Skip to content

Useful functionality for working with links in markdown

License

Notifications You must be signed in to change notification settings

Nedra1998/nvim-mdlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvim-mdlink

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

✨ 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

⚡ Requirements

📦 Installation

Install with vim-plug:

Plug 'Nedra1998/nvim-mdlink'

or with packer.nvim:

use { 'Nedra1998/nvim-mdlink' }

or with lazy.nvim:

{ 'Nedra1998/nvim-mdlink' }

⚙️ 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.

🚀 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' }
  }
}

About

Useful functionality for working with links in markdown

Topics

Resources

License

Stars

Watchers

Forks

Languages