mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2026-10-17 05:33:52 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f89e51ec10
|
||
|
|
dd4cb0e736
|
||
|
|
ffd5ccbc81
|
+1
-1
@@ -18,7 +18,7 @@ ideaVersion=2026.1
|
|||||||
# Values for type: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
|
# Values for type: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
|
||||||
ideaType=IU
|
ideaType=IU
|
||||||
instrumentPluginCode=true
|
instrumentPluginCode=true
|
||||||
version=chylex-1
|
version=9999.62-chylex
|
||||||
javaVersion=21
|
javaVersion=21
|
||||||
remoteRobotVersion=0.11.23
|
remoteRobotVersion=0.11.23
|
||||||
antlrVersion=4.10.1
|
antlrVersion=4.10.1
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.intellij.vim.api.VimApi
|
|||||||
import com.intellij.vim.api.VimInitApi
|
import com.intellij.vim.api.VimInitApi
|
||||||
import com.intellij.vim.api.getVariable
|
import com.intellij.vim.api.getVariable
|
||||||
import com.intellij.vim.api.scopes.nmapPluginAction
|
import com.intellij.vim.api.scopes.nmapPluginAction
|
||||||
import com.intellij.vim.api.scopes.omapPluginAction
|
|
||||||
import com.intellij.vim.api.scopes.xmapPluginAction
|
import com.intellij.vim.api.scopes.xmapPluginAction
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
|
|
||||||
@@ -33,12 +32,12 @@ internal class ParagraphMotion : VimExtension {
|
|||||||
xmapPluginAction("{", "<Plug>(ParagraphPrevMotion)", keepDefaultMapping = true) {
|
xmapPluginAction("{", "<Plug>(ParagraphPrevMotion)", keepDefaultMapping = true) {
|
||||||
moveParagraph(-1)
|
moveParagraph(-1)
|
||||||
}
|
}
|
||||||
omapPluginAction("}", "<Plug>(ParagraphNextMotion)", keepDefaultMapping = true) {
|
// omapPluginAction("}", "<Plug>(ParagraphNextMotion)", keepDefaultMapping = true) {
|
||||||
moveParagraph(1)
|
// moveParagraph(1)
|
||||||
}
|
// }
|
||||||
omapPluginAction("{", "<Plug>(ParagraphPrevMotion)", keepDefaultMapping = true) {
|
// omapPluginAction("{", "<Plug>(ParagraphPrevMotion)", keepDefaultMapping = true) {
|
||||||
moveParagraph(-1)
|
// moveParagraph(-1)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-6
@@ -24,7 +24,7 @@ import com.maddyhome.idea.vim.handler.toMotionOrError
|
|||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
sealed class MotionUnmatchedAction(private val motionChar: Char) : MotionActionHandler.ForEachCaret() {
|
sealed class MotionUnmatchedAction(private val motionChar: Char, private val isBackwardsMotion: Boolean) : MotionActionHandler.ForEachCaret() {
|
||||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||||
|
|
||||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||||
@@ -36,7 +36,9 @@ sealed class MotionUnmatchedAction(private val motionChar: Char) : MotionActionH
|
|||||||
argument: Argument?,
|
argument: Argument?,
|
||||||
operatorArguments: OperatorArguments,
|
operatorArguments: OperatorArguments,
|
||||||
): Motion {
|
): Motion {
|
||||||
return moveCaretToUnmatchedBlock(editor, caret, operatorArguments.count1, motionChar)?.toMotionOrError()
|
return moveCaretToUnmatchedBlock(editor, caret, operatorArguments.count1, motionChar)
|
||||||
|
?.let { if (isBackwardsMotion) it + 1 else it }
|
||||||
|
?.toMotionOrError()
|
||||||
?: Motion.Error
|
?: Motion.Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,28 +48,28 @@ sealed class MotionUnmatchedAction(private val motionChar: Char) : MotionActionH
|
|||||||
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
||||||
description = "Go to the [count]'th next unmatched '}'."
|
description = "Go to the [count]'th next unmatched '}'."
|
||||||
)
|
)
|
||||||
class MotionUnmatchedBraceCloseAction : MotionUnmatchedAction('}')
|
class MotionUnmatchedBraceCloseAction : MotionUnmatchedAction('}', isBackwardsMotion = false)
|
||||||
|
|
||||||
@CommandOrMotion(
|
@CommandOrMotion(
|
||||||
keys = ["[{"],
|
keys = ["[{"],
|
||||||
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
||||||
description = "Go to the [count]'th previous unmatched '{'."
|
description = "Go to the [count]'th previous unmatched '{'."
|
||||||
)
|
)
|
||||||
class MotionUnmatchedBraceOpenAction : MotionUnmatchedAction('{')
|
class MotionUnmatchedBraceOpenAction : MotionUnmatchedAction('{', isBackwardsMotion = true)
|
||||||
|
|
||||||
@CommandOrMotion(
|
@CommandOrMotion(
|
||||||
keys = ["])"],
|
keys = ["])"],
|
||||||
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
||||||
description = "Go to the [count]'th next unmatched ')'."
|
description = "Go to the [count]'th next unmatched ')'."
|
||||||
)
|
)
|
||||||
class MotionUnmatchedParenCloseAction : MotionUnmatchedAction(')')
|
class MotionUnmatchedParenCloseAction : MotionUnmatchedAction(')', isBackwardsMotion = false)
|
||||||
|
|
||||||
@CommandOrMotion(
|
@CommandOrMotion(
|
||||||
keys = ["[("],
|
keys = ["[("],
|
||||||
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING],
|
||||||
description = "Go to the [count]'th previous unmatched '('."
|
description = "Go to the [count]'th previous unmatched '('."
|
||||||
)
|
)
|
||||||
class MotionUnmatchedParenOpenAction : MotionUnmatchedAction('(')
|
class MotionUnmatchedParenOpenAction : MotionUnmatchedAction('(', isBackwardsMotion = true)
|
||||||
|
|
||||||
private fun moveCaretToUnmatchedBlock(editor: VimEditor, caret: ImmutableVimCaret, count: Int, type: Char): Int? {
|
private fun moveCaretToUnmatchedBlock(editor: VimEditor, caret: ImmutableVimCaret, count: Int, type: Char): Int? {
|
||||||
return if (editor.currentCaret().offset == 0 && count < 0 || editor.currentCaret().offset >= editor.fileSize() - 1 && count > 0) {
|
return if (editor.currentCaret().offset == 0 && count < 0 || editor.currentCaret().offset >= editor.fileSize() - 1 && count > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user