koto
koto

Reputation: 740

IntelliJ's IdeaVim plugin disables converting Java to Kotlin

I would like to use IntelliJ's feature, which converts Java code to Kotlin by simply copy-pasting from Java file to Kotlin file. It is working fine, but when I turn on IdeaVim plugin, it refuses to work anymore. I know Vim decently and I that's not the problem with my misunderstanding Vim edit modes. I am aware of How can I convert a part of Java source file to Kotlin? and answer by @yole saying that there is no other tool to do that.

But that answer was made over 3 months ago, and maybe some other tool appeared. So, my question is if someone found workaround to make IdeaVim plugin cooperate with Java to Kotlin conversion. I've already made a ticket on YouTrack: https://youtrack.jetbrains.com/issue/VIM-1103 but frankly, I am not so sure if it will be resolved.

Upvotes: 2

Views: 482

Answers (2)

Peter
Peter

Reputation: 5224

The vim plugin takes over the clipboard and past functions. When you type :actionlist you get a list of idea actions you can use in your .ideavimrc file to map keymaps to idea actions. Use :action COMMAND to execute the command.

I.e.:

norepmap <C-w>q :action VimWindowClose<cr>

closes the current window.

Furthermore, you can search for a particular action with :actionlist Past. This lists

EditorPast <C-V> <S-ins>

among other things.

If you want to check if EditorPast ist the right command you can test it using :action EditorPaste.

Another way to make this work is to let idea handle the <C-v> shortcut. This can be archieved with the Settings -> Other Setting -> Vim Emulation settings. The handler (vim or idea) can be defined with that setting.

Upvotes: 1

koto
koto

Reputation: 740

Ok, guy from JetBrains answered my issue. The obvious workaround (which I didn't figure out) is to copy and paste from context menu. Then conversion question shows up. IMO it seems unlikely that IdeaVim plugin will support this feature by yanking and putting (Vim's copying and pasting), as from:

Running IDE actions on copy and paste might be a good idea, but we're not sure it wouldn't disrupt the workflow of the current users.

Upvotes: 1

Related Questions