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

expand line command actions #1449

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

fidgetingbits
Copy link
Collaborator

@fidgetingbits fidgetingbits commented Jun 2, 2024

This adds two new actions for lines that allow for something like f<key> in vim (and other places) which will just jump to the first occurrence of that character.

The only debatable bit is likely the use of find as the command. Open to suggestions though.

@jaresty
Copy link
Contributor

jaresty commented Jun 2, 2024

I dig it. I'd be interested in your feedback on this one too: #1424 (similar to vim's gm). An alternative word that could work maybe would be char (last char). Or go char and go last char.

@fidgetingbits
Copy link
Collaborator Author

I dig it. I'd be interested in your feedback on this one too: #1424 (similar to vim's gm). An alternative word that could work maybe would be char (last char). Or go char and go last char.

Ya, I'm a bit iffy on using find here, just happens to be what I had used in vim. I'd be fine with go char and go last char I think.

Copy link
Contributor

@jaresty jaresty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@jaresty
Copy link
Contributor

jaresty commented Jun 14, 2024

I wanted to share an idea that I just had about this: it would be really cool if we could add a similar command for adding a cursor at the next glyph (meaning: leave a cursor where you are now and then add another one at the next instance of this glyph)

@jaresty
Copy link
Contributor

jaresty commented Jun 14, 2024

I wish I could merge this for you 😄

@fidgetingbits
Copy link
Collaborator Author

fidgetingbits commented Jun 15, 2024

I wanted to share an idea that I just had about this: it would be really cool if we could add a similar command for adding a cursor at the next glyph (meaning: leave a cursor where you are now and then add another one at the next instance of this glyph)

can file an issue or open a separate PR for it. you'd want that to only add a cursor to the next glyph on the same line or next in the file?

makes me wonder if there should be a file for 'multiple cursor' related commands. I don't ever use them aside from with cursorless, but I suspect lots of others do. would need some common command to indicate you want to add a cursor too.

"curse" would be good but curse on/off is used for mouse cursor, so a bit confusing. but something like "curse add next char this"?

You could just do what you want in cursorless already with something like (untested) "pre char this and next view char this", but it's a bit wordy.
edit: Also I use view instead of instance.

anyway probably better to discuss in a different issue or PR if you prefer not to use cursorless for that.

@jaresty
Copy link
Contributor

jaresty commented Jun 15, 2024

👍fwiw you can also use cursorless to navigate to the next glyph. I use multi cursor most often when I don't have access to cursorless because I'm having to work in IntelliJ.

@AndreasArvidsson
Copy link
Collaborator

We discussed this in the latest community session.

  • We think the action name and description should probably reflect that this is not a normal find/search command and is more like a cursor jump. Something like jump cursor to next instance of character.
  • We probably should have an implementation for vim. If we add an implementation of these actions to vimscript.py

@fidgetingbits
Copy link
Collaborator Author

We discussed this in the latest community session.

* We think the action name and description should probably reflect that this is not a normal find/search command and is more like a cursor jump. Something like jump cursor to next instance of character.

Changed the names and doc strings to reflect the feedback.

* We probably should have an implementation for vim. If we add an implementation of these actions to `vimscript.py`

vimscript.py is for the vimscript language, not for the vim app, so not applicable there. community doesn't have any native support for vim atm. Adding it is non-trivial because of mode switching, so it's not as simple as just enabling it if vim is active somewhere.

Most people using vim (afaik) used to use my personal repo, which then got broken out into talon-vim, and then partially got broken into a much simpler implementation neovim-talon, which is what will be paired with cursorless in neovim.

The neovim-talon repo will use these actions being added in this PR, so I don't think there needs to be something in community using them right away. I suspect there is probably some emacs equivalent that could be added if you think there really should be something. Or we could add something for https://marketplace.visualstudio.com/items?itemName=ArturoDent.jump-and-select, but I doubt many people are using that in vscode (could be wrong).

@fidgetingbits
Copy link
Collaborator Author

I did notice that zsh by default seems to bind a readline shortcut for doing this, but bash doesn't. So will need shell-specific readline overrides, which we don't support atm. I plan to add this to my branch and then port it over eventually after a bunch of testing, but not sure if it needs to be part of this PR.

I don't mind to wait though if it's preferred to have some real use cases in community.

I guess maybe of note, I have a vscode plugin scope in my branch so can enable certain commands if a vscode plugin is installed, which could be used to enable jump-and-select extension mentioned above to more cleanly add support for this into vscode as well. I haven't opened a PR to add that to community yet though.

@AndreasArvidsson
Copy link
Collaborator

Update from the community session. We think that we should probably wait with this until we actually have an implementation in community that utilizes the spoken forms.

@fidgetingbits
Copy link
Collaborator Author

No worries. I'll add something that uses it as part of this PR then.

@fidgetingbits
Copy link
Collaborator Author

Ok the scope of this is expanding now... but this implements a plugins tag and associated scope so that you can now specify if an app has a specific plugin installed. I also include action implementation for the new line command if the jump-and-select plugin is installed in vscode.

I haven't bothered moving all of the other plugin usage from vscode.talon to use this new user.plugin_installed scope, as I think it can be a follow up. But can add it here if preferred.

Also atm the test if the plugin is installed is tested on Linux only. Will test on Mac later, but if someone on Windows can hopefully chime in about where the settings file is located I'll add that too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants