1

I'm working on frontend project, we're using root alias, like:

import from '~/src/components/button';

instead of:

import from '../../../../../components/button';

But when I try to import from ~/, my nvim is not able to autocomplete the path.

How can I let my nvim to know from where it should suggest the path?

3
  • This is a bit vague but perhaps you're issue is with the ~. Depending on the context, to get ~ to resolve you have to use expand('~/some/file') rather than just '~/some/file'.
    – B Layer
    Nov 10, 2020 at 18:01
  • oh! actually I defined ~ as my project root, but I can redefine it to @/ or something else.
    – Lai32290
    Nov 10, 2020 at 18:16
  • How/where did you alias the path? (Regardless, ~ is probably a bad choice because of the confusion with home dir ~.)
    – B Layer
    Nov 10, 2020 at 18:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.