mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2024-11-25 16:42:55 +01:00
Compare commits
16 Commits
7a3bb5b2d7
...
1afd0d3c37
Author | SHA1 | Date | |
---|---|---|---|
1afd0d3c37 | |||
547bd08c7e | |||
0c4154547f | |||
92d8be1ba4 | |||
080dbe9c0e | |||
ff7e6bf053 | |||
f19ce34311 | |||
8bcb0d116d | |||
d9ae9fa40d | |||
c19f88e5c0 | |||
03f4fb288d | |||
ef27579277 | |||
a8a822b58e | |||
9752bd5bbb | |||
240d9e0be4 | |||
328442544d |
@ -11,7 +11,7 @@
|
||||
ideaVersion=2023.2
|
||||
downloadIdeaSources=true
|
||||
instrumentPluginCode=true
|
||||
version=chylex-1
|
||||
version=chylex-18
|
||||
javaVersion=17
|
||||
remoteRobotVersion=0.11.17
|
||||
antlrVersion=4.10.1
|
||||
|
@ -163,6 +163,10 @@ 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 }) {
|
||||
@ -390,4 +394,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,14 +149,12 @@ 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,8 +11,6 @@ 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
|
||||
@ -90,22 +88,12 @@ 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