Skip to content

PsychoLlama/further.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Further.vim

Follow JavaScript imports to their source.

Purpose

The gf mapping in vim edits the file under your cursor, but it doesn't work in JavaScript. Node's module resolution is too complex for Vim to generalize.

further.vim teaches Vim how to navigate JavaScript modules by replacing the built-in gf mapping with a full Vimscript implementation of Node's module resolution algorithm.


TL;DR:

  • Put cursor over JavaScript import
  • Press gf
  • Vim opens the file

Installation

vim-plug

Plug 'PsychoLlama/further.vim'

vundle

Plugin 'PsychoLlama/further.vim'

pathogen

git clone https://github.com/psychollama/further.vim ~/.vim/bundle/

FAQ

Does it work with TypeScript?
Yeah
How do I add support for new file extensions?
let g:further#extensions = ['.like-this']
How do I open a file in a new split?
Try <c-w>gf
Is there a programmatic API?
:help further-functions
Does it work with Plug'n'Play?
No.
Anything else I should know?
Sometimes dolphins use pufferfish to get high.

Documentation

All the docs are in the further help page. Install the plugin then run:

:help further.vim

Customization

Further works out of the box, but if you want, you can completely customize resolution on a global or per-module basis. For instance: you could open src/ instead of dist/, rewrite monorepo imports, or resolve paths to a different repository entirely.

Check out :help further-advanced for details.

Help

If something isn't working, send me an issue and I'll do my best to help.