obsidian.nvim icon indicating copy to clipboard operation
obsidian.nvim copied to clipboard

Match link following with deafault vim bindings.

Open Natr1x opened this issue 1 year ago • 2 comments

🚀 The feature, motivation and pitch

It would be awesome if the funcionality of the follow link command, gf, could be expanded to mirror all of vim's builtin "go to file" commands.

I.e:

  • gF which opens at a line number could open at an anchor tag.
  • C-w f and C-w F to open in a new window.
  • C-w gf and C-w gF to open in a new tab.

Alternatives

An alternative to the gf could be to mirror vims "tag" commands and making use of the builtin jumplist. It would make sense for navigating markdown to work the same as when navigating the vim help docs.

But since the gf binding is already used and that one as far as I know does not use vims jumplist it's probably more intuitive if the same binding does the "same" thing so to speak.

Additional context

#99 Seems to address the capital F functionality of this feature. However if that pull request is implemented and applied to the gf command (making gf now follow anchor links) and then this feature implemented (making gF follow anchor links and gf revert to previous behavior) it might break users own custom configs twice if they are relying on gf having consistent behaviour.

Natr1x avatar Jan 01 '24 14:01 Natr1x

Hey @Natr1x this would be to have. Personally I'd be fine with gf following anchor links, in which case I'd probably never use gF (though I don't use it anyway). But I'm happy to hear other opinions. Of course users could always customize to their liking, so we're talking about what the default behavior should be.

epwalsh avatar Jan 03 '24 00:01 epwalsh

C-w f and C-w gf should be straight-forward to implement already.

epwalsh avatar Jan 03 '24 00:01 epwalsh