1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-02-26 14:46:00 +01:00

Do not perform keymap check if the plugin is disabled

This commit is contained in:
Alex Plate 2023-11-23 14:03:39 +02:00
parent c3409be780
commit e82abfb948
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
2 changed files with 6 additions and 1 deletions
src/main/java/com/maddyhome/idea/vim

View File

@ -16,12 +16,13 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupActivity
import com.intellij.util.SingleAlarm
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.key
import javax.swing.KeyStroke
// We use alarm with delay to avoid many notifications in case many events are fired at the same time
// [VERSION UPDATE] 2023.3+ Replace SingleAlarm with coroutine flows https://youtrack.jetbrains.com/articles/IJPL-A-8/Alarm-Alternative
private val keymapCheckRequester = SingleAlarm({ verifyKeymap() }, 5_000)
internal val keymapCheckRequester = SingleAlarm({ verifyKeymap() }, 5_000)
/**
* This checker verifies that the keymap has a correct configuration that is required for IdeaVim plugin
@ -57,6 +58,8 @@ private fun verifyKeymap() {
// This is needed to initialize the injector in case this verification is called to fast
VimPlugin.getInstance()
if (!injector.enabler.isEnabled()) return
val keymap = KeymapManagerEx.getInstanceEx().activeKeymap
val keymapShortcutsForEsc = keymap.getShortcuts(IdeActions.ACTION_EDITOR_ESCAPE)
val keymapShortcutsForEnter = keymap.getShortcuts(IdeActions.ACTION_EDITOR_ENTER)

View File

@ -71,6 +71,7 @@ import com.maddyhome.idea.vim.group.visual.VimVisualTimer
import com.maddyhome.idea.vim.group.visual.moveCaretOneCharLeftFromSelectionEnd
import com.maddyhome.idea.vim.group.visual.vimSetSystemSelectionSilently
import com.maddyhome.idea.vim.handler.correctorRequester
import com.maddyhome.idea.vim.handler.keymapCheckRequester
import com.maddyhome.idea.vim.helper.GuicursorChangeListener
import com.maddyhome.idea.vim.helper.StrictMode
import com.maddyhome.idea.vim.helper.VimStandalonePluginUpdateChecker
@ -130,6 +131,7 @@ internal object VimListenerManager {
GlobalListeners.enable()
EditorListeners.addAll()
correctorRequester.request()
keymapCheckRequester.request()
}
fun turnOff() {