Skip to content

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

Open

Description

@trusktr

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.

Activity

  1. moll commented on Nov 23, 2014

    @moll
    Owner

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

  2. iammerrick commented on Mar 30, 2015

    @iammerrick

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

  3. rgrinberg commented on Mar 30, 2015

    @rgrinberg
  4. epilande commented on Apr 14, 2016

    @epilande

    Hi @moll, any update on this feature?

  5. andreiglingeanu commented on Aug 23, 2016

    @andreiglingeanu

    I'd love the integration with NODE_PATH!

  6. tomarrell commented on Apr 9, 2018

    @tomarrell

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions