mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2024-11-25 16:42:55 +01:00
Compare commits
10 Commits
1afd0d3c37
...
7a3bb5b2d7
Author | SHA1 | Date | |
---|---|---|---|
7a3bb5b2d7 | |||
c4b05957fc | |||
db83b89931 | |||
ce27c3e5ba | |||
31358bc983 | |||
f7e1c9c837 | |||
c46109caa3 | |||
9f7ca83306 | |||
b5761f20d2 | |||
305c6d2bf9 |
@ -11,7 +11,7 @@
|
||||
ideaVersion=2023.2
|
||||
downloadIdeaSources=true
|
||||
instrumentPluginCode=true
|
||||
version=chylex-18
|
||||
version=chylex-1
|
||||
javaVersion=17
|
||||
remoteRobotVersion=0.11.17
|
||||
antlrVersion=4.10.1
|
||||
|
@ -163,10 +163,6 @@ internal class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatib
|
||||
if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ENTER) && editor.appCodeTemplateCaptured()) {
|
||||
return ActionEnableStatus.no("App code template is active", LogLevel.INFO)
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_HOME || keyCode == KeyEvent.VK_END) {
|
||||
return ActionEnableStatus.no("Special keys", LogLevel.INFO)
|
||||
}
|
||||
|
||||
val nextTemplateVariableShortcuts = KeymapManager.getInstance().activeKeymap.getShortcuts(IdeActions.ACTION_EDITOR_NEXT_TEMPLATE_VARIABLE)
|
||||
if (nextTemplateVariableShortcuts.any { it is KeyboardShortcut && it.firstKeyStroke == keyStroke }) {
|
||||
@ -394,4 +390,4 @@ private class ActionEnableStatus(
|
||||
|
||||
private enum class LogLevel {
|
||||
DEBUG, INFO,
|
||||
}
|
||||
}
|
@ -18,12 +18,12 @@ import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.editor.Document
|
||||
import com.intellij.openapi.editor.toolbar.floating.AbstractFloatingToolbarProvider
|
||||
import com.intellij.openapi.editor.toolbar.floating.FloatingToolbarComponent
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.maddyhome.idea.vim.api.VimrcFileState
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar
|
||||
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||
import com.maddyhome.idea.vim.icons.VimIcons
|
||||
import com.maddyhome.idea.vim.key.MappingOwner
|
||||
@ -149,12 +149,14 @@ internal class ReloadVimRc : DumbAwareAction() {
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
|
||||
FileDocumentManager.getInstance().saveDocumentAsIs(editor.document)
|
||||
injector.keyGroup.removeKeyMapping(MappingOwner.IdeaVim.InitScript)
|
||||
Troubleshooter.instance.removeByType("old-action-notation-in-mappings")
|
||||
|
||||
// Reload the ideavimrc in the context of the current window, as though we had called `:source ~/.ideavimrc`
|
||||
executeIdeaVimRc(editor.vim)
|
||||
|
||||
// Ensure newly added extensions are initialized
|
||||
VimExtensionRegistrar.enableDelayedExtensions()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@ package com.maddyhome.idea.vim.vimscript
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
@ -88,12 +90,22 @@ internal class Executor : VimScriptExecutorBase() {
|
||||
override fun executeFile(file: File, editor: VimEditor, indicateErrors: Boolean) {
|
||||
val context = DataContext.EMPTY_CONTEXT.vim
|
||||
try {
|
||||
ensureFileIsSaved(file)
|
||||
execute(file.readText(), editor, context, skipHistory = true, indicateErrors)
|
||||
} catch (ignored: IOException) {
|
||||
LOG.error(ignored)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ensureFileIsSaved(file: File) {
|
||||
val documentManager = FileDocumentManager.getInstance()
|
||||
|
||||
VirtualFileManager.getInstance().findFileByNioPath(file.toPath())
|
||||
?.let(documentManager::getCachedDocument)
|
||||
?.takeIf(documentManager::isDocumentUnsaved)
|
||||
?.let(documentManager::saveDocumentAsIs)
|
||||
}
|
||||
|
||||
@Throws(ExException::class)
|
||||
override fun executeLastCommand(editor: VimEditor, context: ExecutionContext): Boolean {
|
||||
val reg = VimPlugin.getRegister().getRegister(':') ?: return false
|
||||
|
Loading…
Reference in New Issue
Block a user