From: memeplex Date: Wed, 22 Feb 2017 16:52:36 +0000 (-0300) Subject: Follow named anchors with ge X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/256f9f10d3a43dc265ffd0ac8d416d4a33c6dbdc?ds=sidebyside;hp=256f9f10d3a43dc265ffd0ac8d416d4a33c6dbdc Follow named anchors with ge This commit allows ge to follow named anchors in links of the form file#anchor, where file may omit the .md extension as usual. Two global variables control the operation of this feature: vim_markdown_follow_anchor: a flag that tells vim-markdown whether to attempt to follow a named anchor in a link or not. When this is 1, and only if a link can be split in exactly two parts by the pattern '#', then the first part is interpreted as the file and the second one as the named anchor. After the file is opened, the anchor will be searched. vim_markdown_anchorexpr: if available this expression will be evaluated substituting v:anchor with a quoted string that contains the anchor to visit. The result of the evaluation will become the real anchor to search in the target file. This is useful in order to convert anchors of the form my-section-title to searches of the form My Section Title. It needs to be generic since every markdown renderer follows its own conventions to generate "auto-anchors". A dummy example: let vim_markdown_anchorexpr = "'<<'.v:anchor" Note: I've also reformatted EditUrlUnderCursor a bit since it was violating the 4-space tab and single-quoted string conventions that most of the rest of the code seems to follow. ---