acejump / AceJump

🅰️ single character search, select, and jump
https://plugins.jetbrains.com/plugin/7086-acejump
GNU General Public License v3.0
1.22k stars 91 forks source link

Text selection does not transfer to IdeaVim #220

Closed breandan closed 6 years ago

breandan commented 6 years ago

Need to investigate why AceJump's Shift selection is not recognized by IdeaVim (ie. why does AceJump's text selection command not work with d in Vim's normal mode)? We should be able to select text from the cursor to a location with AceJump and press d in Vim to delete.

geoelectric commented 6 years ago

None of the selection commands from the Edit menu work with ideavim (extend/select all/etc.), so it's not just you.

Looks like the equivalence of visual mode and selection only works for selections initiated from ideavim's editor pane. Also looks like visual mode in general is fairly buggy (preceding counts don't seem to work right, etc.) so this one may be a hard one to fix.

geoelectric commented 6 years ago

OK, this is significant: https://youtrack.jetbrains.com/issue/VIM-510. Selection operations and visual mode don't mix unless you're in visual mode before doing the operation in question.

The bad news is that :action AceAction (or more accurately, :\<5 backspaces>action AceAction) doesn't work in visual mode--IdeaVim kicks you out of visual mode before executing the action. And I guess you can't vmap to a non-IdeaVim key, so \ ... <C-;> doesn't work.

What does work is hitting v to go into visual mode, then hitting C-;. If one uses a shifted tag, it'll extend visual mode to just before the jump target, then you can operate on it as expected with d or whatever.

If one does not use a shifted tag, the behavior is a little weird, though. It doesn't extend visual mode immediately, but the next navigation key will extend visual as if it had. So, if I jump to foo and hit right, everything from the jump origin through the first f will now be selected.

TL;DR: this is plumbing the grey area between IDE and IdeaVim, and there be dragons.

breandan commented 6 years ago

@geoelectric This is really helpful, thanks for investigating.

breandan commented 6 years ago

Turning this over to IdeaVim, please follow VIM-510 for updates.

@vlasovskikh Any chance of using a common editor selection model? This would be great.

vlasovskikh commented 5 years ago

@breandan Yes, it's possible, but it would require a medium-to-large refactoring of the Vim Visual Mode emulation. VIM-510 mostly covers it.