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:
parent
c3409be780
commit
e82abfb948
src/main/java/com/maddyhome/idea/vim
@ -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)
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user