nvim-mdlink provides additional functionality when working with markdown links.
- 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
Install with vim-plug:
Plug 'Nedra1998/nvim-mdlink'
or with packer.nvim:
use { 'Nedra1998/nvim-mdlink' }
or with lazy.nvim:
{ 'Nedra1998/nvim-mdlink' }
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
.
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 |
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' }
}
}