abrookins / WrapToColumn

An IntelliJ plugin that wraps text
Apache License 2.0
62 stars 12 forks source link

Wrap to Column keymap used in Refactor->Rename dialog #19

Closed david-drinn closed 6 years ago

david-drinn commented 8 years ago

When I put the caret on a variable name and run the Refactor->Rename action (Alt-Shift-R by default), I cannot type the letter 'g', because it's finding the 'G,W' keymap to Wrap to Column and preventing it. In the bottom notification bar, I see the notification, "Prefix Key Pressed. Wrap to Column (W)".

This is on PyCharm 5.0.3 with Wrap to Column plugin 1.3.1 on Ubuntu 14.04 LTS. Also noting, in case it's relevant, that I'm using IdeaVIM plugin 0.44.

abrookins commented 8 years ago

What! Thank you for reporting. I'll take a look at this soon.

abrookins commented 8 years ago

Man, this key combination sounds really familiar, but I can't place it. The plugin should install with a beastly default shortcut of Shift-Control-Meta-W, not a two-key combination like G,W, in part because I ran into a similar problem to what you reported.

What's your current keymap setting for Wrap to Column (Settings -> Keymap)? And do you use any map commands in your IdeaVim configuration file (if you have one)?

The general problem is that Intellij/PyCharm's Keymap feature is not aware of IdeaVim's modality, so there isn't a way to remap something like G,W into a normal-mode-only command.

You can do these sorts of command with a slightly better result by using a ~/.ideavimrc file. Then you can use IdeaVim's :action ex command like this:

map <Leader>gh :action Github.Open.In.Browser<CR>
map <Leader>gq :action com.andrewbrookins.idea.wrap.WrapAction<CR>

This works okay for the first example (open the current line in GitHub) but less well for Wrap to Column's action (the second example) because there's a bug in IdeaVim's implementation of :action, such that the command ignores a visual range; i.e., you can't highlight a few lines and send them to WrapAction.

Long story short, you'll probably need to use a more Emacsy shortcut for Wrap to Column, at least until someone (maybe me) fixes that limitation in IdeaVim.

abrookins commented 6 years ago

Closing because this seems dependent on how users set up the key-mappings rather than the mappings that ship with the plugin.