jghauser / follow-md-links.nvim

Easily follow markdown links with this neovim plugin
GNU General Public License v3.0
140 stars 15 forks source link
links lua markdown neovim nvim plugin

follow-md-links.nvim

This neovim plugin allows you to follow markdown links by pressing enter when the cursor is positioned on a link. It supports:

Local files are opened in neovim and web links are opened with the default browser. Web links need to start with https:// or http:// to be identified properly.

This plugin is tested against the latest stable version of neovim. It might work with other versions, but this is not guaranteed.

Installation

Packer:

use {
  'jghauser/follow-md-links.nvim'
}

As this plugin uses nvim-treesitter to identify links, you will need that plugin, and you will need to make sure you have the treesitter markdown and markdown_inline parsers installed. You can check whether that is the case by looking at the entries in :checkhealth nvim-treesitter (there should be a tick in the "H" column). If the markdown parsers are missing, install it with TSInstall markdown markdown_inline or by adding them to ensure_installed in your nvim-treesitter setup function.

Configuration

The plugin maps <cr> in normal mode to open links in markdown files. You might also want to add the following keymap to easily go back to the previous file with backspace:

vim.keymap.set('n', '<bs>', ':edit #<cr>', { silent = true })