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

Add the ability to adjust the position of the cursor after the jump #395

Open
Gruzchick opened this issue Jan 14, 2022 · 7 comments
Open
Labels

Comments

@Gruzchick
Copy link

Gruzchick commented Jan 14, 2022

Some people will find it more convenient if the cursor is positioned after the character. Like in this plugin
https://plugins.jetbrains.com/plugin/9803-acejump-lite

image

It would be great to add "jump after" mode.

@Gruzchick
Copy link
Author

I mistakenly thought that the end mod is when the cursor after the jump is set immediately after the target character, but it is set at the end of the word (

@Clindbergh
Copy link

Personally I would prefer the ability to add additional shortcuts for the All Words Mode s that set the caret at the end of the word:
image

@Gruzchick
Copy link
Author

Gruzchick commented Apr 3, 2022

Personally I would prefer the ability to add additional shortcuts for the All Words Mode s that set the caret at the end of the word: image

There's no accounting for taste 😀

@Clindbergh
Copy link

There's no accounting for taste 😀

Sure 😆

However this time I actually think the difference is actually significant. My suggestion allows using both modes (caret after the word and word before caret) simultaneously. Having a setting to place the caret at the end would not allow this.

If you intend to often enable and disable the setting and want to keep using the same keyboard shortcuts, you would be quicker than changing 3 new keyboard shortcuts. However I think that's an exotic use case. @Gruzchick, do you see other benefits of the approach with single checkbox setting or would you be happy with 3 additional actions as I suggested?

@Gruzchick
Copy link
Author

@Clindbergh I just suggested adding the functionality that I needed, without specifying how it would be implemented.

I agree that it will be convenient to make the ability to add additional shortcuts

@breandan
Copy link
Collaborator

breandan commented Apr 7, 2022

Hey @Gruzchick/@Clindbergh, thanks for the feedback, this all seems reasonable to me. If either of you do feel like implementing something, AceJump welcomes PRs! One possibility would be to chain together Vim commands to update the caret position after jumping to some specific location. It would be great if custom actions could be composed together without adding a bunch of configuration settings. This kind of advanced customizability was discussed a while ago and would enable a wider set of scriptable events, @chylex might have some suggestions how to do that.

@chylex
Copy link
Collaborator

chylex commented Apr 7, 2022

I experimented with this a while ago, I still have the old code in a branch https://github.com/chylex/IntelliJ-AceJump/blob/experimental-rework/src/main/kotlin/org/acejump/action/AceTagAction.kt

They are still hard-coded actions, but it's more flexible than an enum and you can combine multiple actions in one. For example the "Target" mode calls a JumpToWordStart action first:

  object GoToDeclaration : AceTagAction() {
    override fun invoke(editor: Editor, searchProcessor: SearchProcessor, offset: Int, shiftMode: Boolean, isFinal: Boolean) {
      JumpToWordStart(editor, searchProcessor, offset, shiftMode = false, isFinal = isFinal)
      ApplicationManager.getApplication().invokeLater { performAction(if (shiftMode) IdeActions.ACTION_GOTO_TYPE_DECLARATION else IdeActions.ACTION_GOTO_DECLARATION) }
    }
  }

Refactoring current enums to AceTagAction could be a start, but there branch does not have any example of how this could be configured in the settings UI.

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

No branches or pull requests

4 participants