Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using gf, etc, for AMD module paths. #11

Open
trusktr opened this issue Nov 11, 2014 · 6 comments · May be fixed by #46
Open

Using gf, etc, for AMD module paths. #11

trusktr opened this issue Nov 11, 2014 · 6 comments · May be fixed by #46

Comments

@trusktr
Copy link

trusktr commented Nov 11, 2014

Hi, I like the idea of being able to use gf to open files from the path in the text, but it'd be nice if this worked for other package systems like AMD, etc.

I've got this:

/**
 * @fileoverview Defines the unit details sub-app
 */
define([
  'js/mpq/subapps/base',
  'js/mpq/layouts/results/unit-details'
],
function(SubApp, Layout) {
  return SubApp.extend({

    Layout: Layout,

    navigation: true

  });
});

If I put my cursor on 'js/mpq/layouts/results/unit-details' then I get an error:

E447: Can't find file "js/mpq/layouts/results/unit-details" in path

Obviously this is because it's not a Node.js module, and the js folder is actually ../../../js.

Is there a way to configure paths for a project so if it doesn't find the file, it can check the path list or similar? Maybe something like

let g:pathsOrWhatever = ['$HOME/src/project/', '/absolute/path', './etc']

and it could be saved in the project folder and I could source it.

@moll
Copy link
Owner

moll commented Nov 23, 2014

Hey! Thanks for the idea. I'll see if I can come up with something. ;-)

@iammerrick
Copy link

Holy smokes I would love this for when I add my source directory to NODE_PATH

@rgrinberg
Copy link

This might be relevant https://github.com/kana/vim-gf-user

@epilande
Copy link

Hi @moll, any update on this feature?

@andreiglingeanu
Copy link

I'd love the integration with NODE_PATH!

@tomarrell
Copy link

tomarrell commented Apr 9, 2018

I've written a small plugin that should help out with this case. It works alongside vim-node and provides configurable resolution for each project as well.

Let me know if there's anything that could be added that could help out! https://github.com/tomarrell/vim-npr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants