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

Allow multi-cursor 'smart' goto-file #12095

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emilyyyylime
Copy link
Contributor

@emilyyyylime emilyyyylime commented Nov 19, 2024

The gf (goto_file) command has the ability to automatically detect paths or URLs around the cursor if no selection is active (the cursor's start and end are on the same character).
Personally, my intuition was that the only condition for this mechanism to activate was that the selection width is zero, so I was surprised that I couldn't make use where I had a list of files in source code that I multi-selected with C.

This patch allows for gf to intelligently detect file names even with multiple selections active, with the condition that they must all be a single character wide.

@the-mikedavis
Copy link
Member

The current behavior is very specific since I think it can be surprising when a command has two pretty different behaviors. (Opening only what's selected vs. detecting the file / URL.) I'm not necessarily against making this work when you have multiple cursors though (as this PR does) - I think this could be quite useful if you have a list of links or if we had a way of adding selections with the mouse.

@the-mikedavis the-mikedavis added the A-command Area: Commands label Nov 21, 2024
@emilyyyylime
Copy link
Contributor Author

@the-mikedavis it's already possible to add selections with alt+click isn't it?

@the-mikedavis
Copy link
Member

Ah yep alt+click already works. (I'm not a big mouse user 😅)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants