-
Notifications
You must be signed in to change notification settings - Fork 250
Conversation
Can't comment on the testing but the PR could be improved by rebasing all the commits into 1. Or maybe 2: one for the initial implementation, and one for implementing multiple file selections. |
3278a72
to
8e74d04
Compare
Hi, looks good. Any chance of reusing getCurrentWord instead of re-implementing it here? That might require some refactoring... but it might be worth it since Vim seems to need the current word quite a bit. |
I imagine that would be doable. Probably move it into a base class or utilities somewhere? I'll take a look. |
…files-under-cursor to support
I've refactored it into the utils file. It can be used from any component now and supports any cursor(s) and word regular expressions! |
Looks excellent!! Now it just needs some testing. :) I can try to help with that if you want. Got a few things I need to tie down first though. |
That'd be awesome, thanks! I tried to get some stuff working, but no go. The problem is that it needs to have an actual file loaded since the relative path testing needs to be relative to the loaded file. Any thoughts you have would be great! |
# range = cursor.getCurrentWordBufferRange wordRegex: wordRegex | ||
# selectedPath = @editor.getTextInRange range | ||
range = currentWord.range | ||
selectedPath = currentWord.word |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would {range, selectedPath} = utils.getCurrentWord(...)
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to be able to use selectedPath, but keep the getCurrentWord
method as generic as possible, so i'd end up with an extra declaration anyways or I'd have to use word
in the remaining code! Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oop, you're right. renaming word to selectedPath takes another line anyway so this change wouldn't buy much. Never mind!
Fore reference, I also implemented similar feature with open-this, the diff of this PR is.
https://github.com/t9md/atom-open-this/blob/master/lib/main.coffee#L18-L24 And not include opening URL. |
As stated in the README, this package is no longer maintained and is deprecated. We recommend that people use the vim-mode-plus package instead. Because of this, we are archiving this repository and closing all issues and pull requests. Thanks very much for your support and contributions! |
This implements the gf keybinding which will allow the editor to open the file or url under the cursor. It supports absolute file paths, relative file paths, and even paths without an extension. If no extension is found, but multiple files are found with the same name (i.e. main.js or main.coffee), it will look to the currently loaded file for advice on the extension to use.
I've run into an issue where I can't seem to get tests to work properly. The situation is that in order for relative paths to work, there needs to be an actual file (from the file system) loaded into the editor. Any suggestions on how to get that working? I'd also need to be able to test that once the command is entered new files open as well.