vim-projectionist icon indicating copy to clipboard operation
vim-projectionist copied to clipboard

[feature] Add the ability to execute a command in alternate pattern

Open dsummersl opened this issue 6 years ago • 2 comments

I'd love to be able to specify a command to execute when switching to alternate/related files. something like 'alternate': 'FILEPATH:COMMAND', where COMMAND could make use of the {} expansion:

  \   'app/views/*.html.slim': {
  \     'type': 'view',
  \     'alternate': 'app/controllers/{dirname}_controller.rb:/def {basename}',
  \   },

dsummersl avatar Oct 05 '19 14:10 dsummersl

I want some to add some kind of jump to definition functionality, but I'm not going to allow executing arbitrary code.

tpope avatar Oct 06 '19 03:10 tpope

Hey tpope!

I was wondering what your appetite for this was almost six years later. I've recently found myself really wanting this functionality again (outside of rails.vim).

Jumping to definition could be as simple as providing a search string to run after navigating to the file, but going the other way is more complex—especially if it were to work like rails.vim where having your cursor outside of a function affects the related file. I feel like providing cross-language "is cursor inside a function and if it is, what is it called?" heuristics might be a non-starter, is it? I have ideas of how else it could work but so far they are pretty convoluted. In the spirit of "ask before working on a PR" I'm asking first! But I'm happy to put in the work if you're open to it, or at least get it started.

And of course, there would need to be some kind of token to represent the function name in the related file glob.

sodapopcan avatar Apr 02 '24 15:04 sodapopcan