简体   繁体   中英

Follow local file link in vim with Markdown syntax

When editing markdown files in (neo)vim, I'd like to be able to quickly jump to links pointing to local files. Something like gf or gx . However, gx kinda works, but opens the local file in a different (ie not vim) editor -- gf only works when i click on the actual filename:

[test][1]

[1]: some_file.md

Ie, I literally have to gf on some_file.md but I'd like to be able to do the same one test and 1 as well.

I'm using vanilla (neo)vim without any plugins.

You need to use ge with cursor over the link, as shown in mappings .

You can configure how you wanna open the file in vim defining the variable g:vim_markdown_edit_url_in to one of values:

  • tab - to open in new tab
  • vsplit - to open in a vertical screen split
  • hsplit - to open in a horizontal screen split
  • current - to open in current buffer

Example:

let g:vim_markdown_edit_url_in = 'tab'

More info in " How to open new Files "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM