mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-09-14 14:32:10 +02:00
Compare commits
55 Commits
customized
...
120d889dfb
Author | SHA1 | Date | |
---|---|---|---|
120d889dfb | |||
![]() |
f439474b73 | ||
![]() |
d6cd92e256 | ||
![]() |
3a294268d9 | ||
![]() |
9b81c7e650 | ||
![]() |
e229fb3ad7 | ||
![]() |
720eae63fa | ||
![]() |
0df96a24bd | ||
![]() |
21a1588ede | ||
![]() |
7970006e8c | ||
![]() |
418d0cff7f | ||
![]() |
7284360774 | ||
![]() |
9fc3fadee8 | ||
![]() |
3d2db56f63 | ||
![]() |
e9c7cb8670 | ||
![]() |
87d19274c5 | ||
![]() |
3161bf8ffd | ||
![]() |
b68865587e | ||
![]() |
7dc0dbe944 | ||
![]() |
f50a363525 | ||
![]() |
57ad4c70d1 | ||
![]() |
d3d93b898f | ||
![]() |
7d8973edb2 | ||
![]() |
2302b576b0 | ||
f4782630d4 | |||
![]() |
8c1a2a686f | ||
32d5e1e6fa | |||
![]() |
a381a1cacc | ||
![]() |
73c3c9f7fe | ||
![]() |
67ef0a75d5 | ||
![]() |
328bc5e95a | ||
![]() |
7f8021e37e | ||
![]() |
9701b7e79b | ||
![]() |
7a52c6fec9 | ||
![]() |
1503639d4b | ||
![]() |
e82f19c852 | ||
![]() |
edd69c9c25 | ||
![]() |
fc61e369fb | ||
![]() |
113586b59b | ||
![]() |
5dbd5e1c89 | ||
![]() |
04b7d9e2c3 | ||
![]() |
5f2743176a | ||
![]() |
3723488617 | ||
![]() |
0cc17a0791 | ||
![]() |
05a21e6091 | ||
![]() |
fc06bc7c6f | ||
![]() |
1bd005adc1 | ||
![]() |
4f208d1577 | ||
![]() |
eb6e0557a7 | ||
![]() |
cf09d66be6 | ||
![]() |
76cd127a8a | ||
![]() |
f6dd2a9968 | ||
![]() |
ae05a33e14 | ||
![]() |
b38fad323b | ||
![]() |
c6027fcf0f |
1
.github/workflows/runUiOctopusTests.yml
vendored
1
.github/workflows/runUiOctopusTests.yml
vendored
@@ -52,6 +52,7 @@ jobs:
|
|||||||
name: ui-test-fails-report-mac
|
name: ui-test-fails-report-mac
|
||||||
path: |
|
path: |
|
||||||
build/reports
|
build/reports
|
||||||
|
tests/ui-ij-tests/build/reports
|
||||||
sandbox-idea-log
|
sandbox-idea-log
|
||||||
# build-for-ui-test-linux:
|
# build-for-ui-test-linux:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
1
.github/workflows/runUiPyTests.yml
vendored
1
.github/workflows/runUiPyTests.yml
vendored
@@ -52,4 +52,5 @@ jobs:
|
|||||||
name: ui-test-fails-report-mac
|
name: ui-test-fails-report-mac
|
||||||
path: |
|
path: |
|
||||||
build/reports
|
build/reports
|
||||||
|
tests/ui-py-tests/build/reports
|
||||||
sandbox-idea-log
|
sandbox-idea-log
|
1
.github/workflows/runUiTests.yml
vendored
1
.github/workflows/runUiTests.yml
vendored
@@ -49,6 +49,7 @@ jobs:
|
|||||||
name: ui-test-fails-report-mac
|
name: ui-test-fails-report-mac
|
||||||
path: |
|
path: |
|
||||||
build/reports
|
build/reports
|
||||||
|
tests/ui-ij-tests/build/reports
|
||||||
sandbox-idea-log
|
sandbox-idea-log
|
||||||
# build-for-ui-test-linux:
|
# build-for-ui-test-linux:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
1
.idea/codeStyles/Project.xml
generated
1
.idea/codeStyles/Project.xml
generated
@@ -6,6 +6,7 @@
|
|||||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="LINE_SEPARATOR" value=" " />
|
||||||
<JavaCodeStyleSettings>
|
<JavaCodeStyleSettings>
|
||||||
<option name="FIELD_NAME_PREFIX" value="my" />
|
<option name="FIELD_NAME_PREFIX" value="my" />
|
||||||
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
|
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
|
||||||
|
3
.teamcity/_Self/buildTypes/Qodana.kt
vendored
3
.teamcity/_Self/buildTypes/Qodana.kt
vendored
@@ -46,8 +46,8 @@ object Qodana : IdeaVimBuildType({
|
|||||||
version = Qodana.JVMVersion.LATEST
|
version = Qodana.JVMVersion.LATEST
|
||||||
}
|
}
|
||||||
reportAsTests = true
|
reportAsTests = true
|
||||||
additionalDockerArguments = "-e QODANA_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb24iOiIzUFZrQSIsInByb2plY3QiOiIzN1FlQSIsInRva2VuIjoiM0t2bXoifQ.uohp81tM7iAfvvB6k8faarfpV-OjusAaEbWQ8iNrOgs"
|
|
||||||
additionalQodanaArguments = "--baseline qodana.sarif.json"
|
additionalQodanaArguments = "--baseline qodana.sarif.json"
|
||||||
|
cloudToken = "credentialsJSON:6b79412e-9198-4862-9223-c5019488f903"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,6 @@ object Qodana : IdeaVimBuildType({
|
|||||||
timezone = "SERVER"
|
timezone = "SERVER"
|
||||||
}
|
}
|
||||||
param("dayOfWeek", "Sunday")
|
param("dayOfWeek", "Sunday")
|
||||||
enabled = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
package patches.buildTypes
|
package patches.buildTypes
|
||||||
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.RelativeId
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.GradleBuildStep
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.GradleBuildStep
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.changeBuildType
|
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.expectSteps
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.update
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This patch script was generated by TeamCity on settings change in UI.
|
This patch script was generated by TeamCity on settings change in UI.
|
||||||
@@ -13,6 +11,18 @@ To apply the patch, change the buildType with id = 'IdeaVimTests_Latest_EAP'
|
|||||||
accordingly, and delete the patch script.
|
accordingly, and delete the patch script.
|
||||||
*/
|
*/
|
||||||
changeBuildType(RelativeId("IdeaVimTests_Latest_EAP")) {
|
changeBuildType(RelativeId("IdeaVimTests_Latest_EAP")) {
|
||||||
|
check(artifactRules == """
|
||||||
|
+:build/reports => build/reports
|
||||||
|
+:/mnt/agent/temp/buildTmp/ => /mnt/agent/temp/buildTmp/
|
||||||
|
""".trimIndent()) {
|
||||||
|
"Unexpected option value: artifactRules = $artifactRules"
|
||||||
|
}
|
||||||
|
artifactRules = """
|
||||||
|
+:build/reports => build/reports
|
||||||
|
+:/mnt/agent/temp/buildTmp/ => /mnt/agent/temp/buildTmp/
|
||||||
|
+:tests/java-tests/build/reports => tests/java-tests/build/reports
|
||||||
|
""".trimIndent()
|
||||||
|
|
||||||
expectSteps {
|
expectSteps {
|
||||||
gradle {
|
gradle {
|
||||||
tasks = "clean test"
|
tasks = "clean test"
|
||||||
|
11
CHANGES.md
11
CHANGES.md
@@ -26,12 +26,19 @@ usual beta standards.
|
|||||||
## To Be Released
|
## To Be Released
|
||||||
|
|
||||||
### Fixes:
|
### Fixes:
|
||||||
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
|
|
||||||
* [VIM-3291](https://youtrack.jetbrains.com/issue/VIM-3291) Remove sync of editor selection between different opened editors
|
* [VIM-3291](https://youtrack.jetbrains.com/issue/VIM-3291) Remove sync of editor selection between different opened editors
|
||||||
* [VIM-3234](https://youtrack.jetbrains.com/issue/VIM-3234) The space character won't mix in the tab chars after >> and << commands
|
* [VIM-3234](https://youtrack.jetbrains.com/issue/VIM-3234) The space character won't mix in the tab chars after >> and << commands
|
||||||
|
*
|
||||||
|
### Merged PRs:
|
||||||
|
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
|
||||||
|
* [806](https://github.com/JetBrains/ideavim/pull/806) by [chylex](https://github.com/chylex): Enforce LF line separator in project code style
|
||||||
|
|
||||||
|
## 2.9.0, 2024-02-20
|
||||||
|
|
||||||
|
### Fixes:
|
||||||
|
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
|
||||||
|
|
||||||
### Merged PRs:
|
### Merged PRs:
|
||||||
* [725](https://github.com/JetBrains/ideavim/pull/725) by [Emanuel Gestosa](https://github.com/emanuelgestosa): Regex
|
|
||||||
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
|
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
|
||||||
|
|
||||||
## 2.8.0, 2024-01-30
|
## 2.8.0, 2024-01-30
|
||||||
|
@@ -52,11 +52,11 @@ buildscript {
|
|||||||
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
|
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
|
||||||
classpath("org.kohsuke:github-api:1.305")
|
classpath("org.kohsuke:github-api:1.305")
|
||||||
|
|
||||||
classpath("io.ktor:ktor-client-core:2.3.7")
|
classpath("io.ktor:ktor-client-core:2.3.8")
|
||||||
classpath("io.ktor:ktor-client-cio:2.3.7")
|
classpath("io.ktor:ktor-client-cio:2.3.8")
|
||||||
classpath("io.ktor:ktor-client-auth:2.3.7")
|
classpath("io.ktor:ktor-client-auth:2.3.8")
|
||||||
classpath("io.ktor:ktor-client-content-negotiation:2.3.7")
|
classpath("io.ktor:ktor-client-content-negotiation:2.3.8")
|
||||||
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
|
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
|
||||||
|
|
||||||
// This comes from the changelog plugin
|
// This comes from the changelog plugin
|
||||||
// classpath("org.jetbrains:markdown:0.3.1")
|
// classpath("org.jetbrains:markdown:0.3.1")
|
||||||
@@ -70,7 +70,7 @@ plugins {
|
|||||||
application
|
application
|
||||||
id("java-test-fixtures")
|
id("java-test-fixtures")
|
||||||
|
|
||||||
id("org.jetbrains.intellij") version "1.17.0"
|
id("org.jetbrains.intellij") version "1.17.2"
|
||||||
id("org.jetbrains.changelog") version "2.2.0"
|
id("org.jetbrains.changelog") version "2.2.0"
|
||||||
|
|
||||||
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
||||||
@@ -144,12 +144,12 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
|
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
|
||||||
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
|
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
|
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
|
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
|
||||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
|
||||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
|
||||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -431,12 +431,14 @@ val prId: String by project
|
|||||||
|
|
||||||
tasks.register("updateMergedPr") {
|
tasks.register("updateMergedPr") {
|
||||||
doLast {
|
doLast {
|
||||||
if (project.hasProperty("prId")) {
|
val x = changelog.getUnreleased()
|
||||||
println("Got pr id: $prId")
|
println("x")
|
||||||
updateMergedPr(prId.toInt())
|
// if (project.hasProperty("prId")) {
|
||||||
} else {
|
// println("Got pr id: $prId")
|
||||||
error("Cannot get prId")
|
// updateMergedPr(prId.toInt())
|
||||||
}
|
// } else {
|
||||||
|
// error("Cannot get prId")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
124814
qodana.sarif.json
124814
qodana.sarif.json
File diff suppressed because one or more lines are too long
@@ -21,6 +21,9 @@ exclude:
|
|||||||
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/SimpleText.kt
|
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/SimpleText.kt
|
||||||
- src/main/java/com/maddyhome/idea/vim/vimscript/parser/generated
|
- src/main/java/com/maddyhome/idea/vim/vimscript/parser/generated
|
||||||
- src/main/java/com/maddyhome/idea/vim/package-info.java
|
- src/main/java/com/maddyhome/idea/vim/package-info.java
|
||||||
|
- vim-engine/src/main/java/com/maddyhome/idea/vim/regexp/parser/generated
|
||||||
|
- src/main/java/com/maddyhome/idea/vim/group/SearchGroup.java
|
||||||
|
- tests/ui-fixtures
|
||||||
dependencyIgnores:
|
dependencyIgnores:
|
||||||
- name: "acejump"
|
- name: "acejump"
|
||||||
- name: "icu4j"
|
- name: "icu4j"
|
||||||
|
@@ -22,11 +22,11 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
|
||||||
|
|
||||||
implementation("io.ktor:ktor-client-core:2.3.7")
|
implementation("io.ktor:ktor-client-core:2.3.8")
|
||||||
implementation("io.ktor:ktor-client-cio:2.3.7")
|
implementation("io.ktor:ktor-client-cio:2.3.8")
|
||||||
implementation("io.ktor:ktor-client-content-negotiation:2.3.7")
|
implementation("io.ktor:ktor-client-content-negotiation:2.3.8")
|
||||||
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
|
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
|
||||||
implementation("io.ktor:ktor-client-auth:2.3.7")
|
implementation("io.ktor:ktor-client-auth:2.3.8")
|
||||||
implementation("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
|
implementation("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
|
||||||
|
|
||||||
// This is needed for jgit to connect to ssh
|
// This is needed for jgit to connect to ssh
|
||||||
|
@@ -22,7 +22,7 @@ import kotlinx.serialization.json.jsonPrimitive
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
val knownPlugins = listOf(
|
val knownPlugins = setOf(
|
||||||
"IdeaVimExtension",
|
"IdeaVimExtension",
|
||||||
"github.zgqq.intellij-enhance",
|
"github.zgqq.intellij-enhance",
|
||||||
"org.jetbrains.IdeaVim-EasyMotion",
|
"org.jetbrains.IdeaVim-EasyMotion",
|
||||||
@@ -31,7 +31,12 @@ val knownPlugins = listOf(
|
|||||||
"com.github.copilot",
|
"com.github.copilot",
|
||||||
"com.github.dankinsoid.multicursor",
|
"com.github.dankinsoid.multicursor",
|
||||||
"com.joshestein.ideavim-quickscope",
|
"com.joshestein.ideavim-quickscope",
|
||||||
|
|
||||||
"ca.alexgirard.HarpoonIJ",
|
"ca.alexgirard.HarpoonIJ",
|
||||||
|
"me.kyren223.harpoonforjb", // https://plugins.jetbrains.com/plugin/23771-harpoonforjb
|
||||||
|
"com.github.erotourtes.harpoon", // https://plugins.jetbrains.com/plugin/21796-harpooner
|
||||||
|
"me.kyren223.trident", // https://plugins.jetbrains.com/plugin/23818-trident
|
||||||
|
|
||||||
"com.protoseo.input-source-auto-converter",
|
"com.protoseo.input-source-auto-converter",
|
||||||
|
|
||||||
// "cc.implicated.intellij.plugins.bunny", // I don't want to include this plugin in the list of IdeaVim plugins as I don't understand what this is for
|
// "cc.implicated.intellij.plugins.bunny", // I don't want to include this plugin in the list of IdeaVim plugins as I don't understand what this is for
|
||||||
@@ -42,7 +47,7 @@ suspend fun main() {
|
|||||||
parameter("dependency", "IdeaVIM")
|
parameter("dependency", "IdeaVIM")
|
||||||
parameter("includeOptional", true)
|
parameter("includeOptional", true)
|
||||||
}
|
}
|
||||||
val output = response.body<List<String>>()
|
val output = response.body<List<String>>().toSet()
|
||||||
println(output)
|
println(output)
|
||||||
if (knownPlugins != output) {
|
if (knownPlugins != output) {
|
||||||
val newPlugins = (output - knownPlugins).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
|
val newPlugins = (output - knownPlugins).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
|
||||||
|
@@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
package scripts.release
|
package scripts.release
|
||||||
|
|
||||||
|
import org.eclipse.jgit.lib.ObjectId
|
||||||
|
import org.eclipse.jgit.revwalk.RevCommit
|
||||||
|
import org.eclipse.jgit.revwalk.RevWalk
|
||||||
|
import org.eclipse.jgit.revwalk.filter.RevFilter
|
||||||
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
println("HI!")
|
println("HI!")
|
||||||
val projectDir = args[0]
|
val projectDir = args[0]
|
||||||
@@ -19,10 +25,12 @@ fun main(args: Array<String>) {
|
|||||||
check(branch == "master") {
|
check(branch == "master") {
|
||||||
"We should be on master branch"
|
"We should be on master branch"
|
||||||
}
|
}
|
||||||
|
val mergeBaseCommit = getMergeBaseWithMaster(projectDir, objectId)
|
||||||
|
println("Base commit $mergeBaseCommit")
|
||||||
withGit(projectDir) { git ->
|
withGit(projectDir) { git ->
|
||||||
val log = git.log().setMaxCount(500).call().toList()
|
val log = git.log().setMaxCount(500).call().toList()
|
||||||
println("First commit hash in log: " + log.first().name + " log size: ${log.size}")
|
println("First commit hash in log: " + log.first().name + " log size: ${log.size}")
|
||||||
val logDiff = log.takeWhile { it.id.name != objectId.name }
|
val logDiff = log.takeWhile { it.id.name != mergeBaseCommit }
|
||||||
val numCommits = logDiff.size
|
val numCommits = logDiff.size
|
||||||
println("Log diff size is $numCommits")
|
println("Log diff size is $numCommits")
|
||||||
check(numCommits < 450) {
|
check(numCommits < 450) {
|
||||||
@@ -35,3 +43,18 @@ fun main(args: Array<String>) {
|
|||||||
println("##teamcity[setParameter name='env.ORG_GRADLE_PROJECT_version' value='$nextVersion']")
|
println("##teamcity[setParameter name='env.ORG_GRADLE_PROJECT_version' value='$nextVersion']")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getMergeBaseWithMaster(projectDir: String, tag: ObjectId): String {
|
||||||
|
withRepo(projectDir) { repo ->
|
||||||
|
val master = repo.resolve("master")
|
||||||
|
RevWalk(repo).use { walk ->
|
||||||
|
val tagRevCommit = walk.parseCommit(tag)
|
||||||
|
val masterRevCommit = walk.parseCommit(master)
|
||||||
|
walk.setRevFilter(RevFilter.MERGE_BASE)
|
||||||
|
walk.markStart(tagRevCommit)
|
||||||
|
walk.markStart(masterRevCommit)
|
||||||
|
val mergeBase: RevCommit = walk.next()
|
||||||
|
return mergeBase.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import com.intellij.openapi.components.service
|
|||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.maddyhome.idea.vim.group.EditorHolderService
|
import com.maddyhome.idea.vim.group.EditorHolderService
|
||||||
|
|
||||||
@Service
|
@Service(Service.Level.PROJECT)
|
||||||
internal class VimProjectService(val project: Project) : Disposable {
|
internal class VimProjectService(val project: Project) : Disposable {
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
// Not sure if this is a best solution
|
// Not sure if this is a best solution
|
||||||
|
@@ -14,6 +14,7 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.api.setChangeMarks
|
import com.maddyhome.idea.vim.api.setChangeMarks
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
@@ -21,6 +22,7 @@ import com.maddyhome.idea.vim.command.Command
|
|||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.common.argumentCaptured
|
import com.maddyhome.idea.vim.common.argumentCaptured
|
||||||
|
import com.maddyhome.idea.vim.ex.ExException
|
||||||
import com.maddyhome.idea.vim.group.MotionGroup
|
import com.maddyhome.idea.vim.group.MotionGroup
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
@@ -29,21 +31,67 @@ import com.maddyhome.idea.vim.helper.MessageHelper
|
|||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.CommandLineVimLContext
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimFuncref
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.expressions.FunctionCallExpression
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.expressions.SimpleExpression
|
||||||
|
|
||||||
// todo make it multicaret
|
// todo make it multicaret
|
||||||
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
|
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
|
||||||
val operatorFunction = injector.keyGroup.operatorFunction
|
val func = injector.globalOptions().operatorfunc
|
||||||
if (operatorFunction == null) {
|
if (func.isEmpty()) {
|
||||||
VimPlugin.showMessage(MessageHelper.message("E774"))
|
VimPlugin.showMessage(MessageHelper.message("E774"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val scriptContext = CommandLineVimLContext
|
||||||
|
|
||||||
|
// The option value is either a function name, which should have a handler, or it might be a lambda expression, or a
|
||||||
|
// `function` or `funcref` call expression, all of which will return a funcref (with a handler)
|
||||||
|
var handler = injector.functionService.getFunctionHandlerOrNull(null, func, scriptContext)
|
||||||
|
if (handler == null) {
|
||||||
|
val expression = injector.vimscriptParser.parseExpression(func)
|
||||||
|
if (expression != null) {
|
||||||
|
try {
|
||||||
|
val value = expression.evaluate(editor, context, scriptContext)
|
||||||
|
if (value is VimFuncref) {
|
||||||
|
handler = value.handler
|
||||||
|
}
|
||||||
|
} catch (ex: ExException) {
|
||||||
|
// Get the argument for function('...') or funcref('...') for the error message
|
||||||
|
val functionName = if (expression is FunctionCallExpression && expression.arguments.size > 0) {
|
||||||
|
expression.arguments[0].evaluate(editor, context, scriptContext).toString()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
func
|
||||||
|
}
|
||||||
|
|
||||||
|
VimPlugin.showMessage("E117: Unknown function: $functionName")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (handler == null) {
|
||||||
|
VimPlugin.showMessage("E117: Unknown function: $func")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
val arg = when (selectionType) {
|
||||||
|
SelectionType.LINE_WISE -> "line"
|
||||||
|
SelectionType.CHARACTER_WISE -> "char"
|
||||||
|
SelectionType.BLOCK_WISE -> "block"
|
||||||
|
}
|
||||||
|
|
||||||
val saveRepeatHandler = VimRepeater.repeatHandler
|
val saveRepeatHandler = VimRepeater.repeatHandler
|
||||||
injector.markService.setChangeMarks(editor.primaryCaret(), textRange)
|
injector.markService.setChangeMarks(editor.primaryCaret(), textRange)
|
||||||
KeyHandler.getInstance().reset(editor)
|
KeyHandler.getInstance().reset(editor)
|
||||||
val result = operatorFunction.apply(editor, context, selectionType)
|
|
||||||
|
val arguments = listOf(SimpleExpression(arg))
|
||||||
|
handler.executeFunction(arguments, editor, context, scriptContext)
|
||||||
|
|
||||||
VimRepeater.repeatHandler = saveRepeatHandler
|
VimRepeater.repeatHandler = saveRepeatHandler
|
||||||
return result
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@CommandOrMotion(keys = ["g@"], modes = [Mode.NORMAL])
|
@CommandOrMotion(keys = ["g@"], modes = [Mode.NORMAL])
|
||||||
|
@@ -23,17 +23,17 @@ public class CommandState(private val machine: VimStateMachine) {
|
|||||||
public val isOperatorPending: Boolean
|
public val isOperatorPending: Boolean
|
||||||
get() = machine.isOperatorPending
|
get() = machine.isOperatorPending
|
||||||
|
|
||||||
public val mode: CommandState.Mode
|
public val mode: Mode
|
||||||
get() {
|
get() {
|
||||||
val myMode = machine.mode
|
val myMode = machine.mode
|
||||||
return when (myMode) {
|
return when (myMode) {
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> CommandState.Mode.CMD_LINE
|
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> Mode.CMD_LINE
|
||||||
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> CommandState.Mode.INSERT
|
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> Mode.INSERT
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> CommandState.Mode.COMMAND
|
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> Mode.COMMAND
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> CommandState.Mode.OP_PENDING
|
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> Mode.OP_PENDING
|
||||||
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> CommandState.Mode.REPLACE
|
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> Mode.REPLACE
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> CommandState.Mode.SELECT
|
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> Mode.SELECT
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> CommandState.Mode.VISUAL
|
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> Mode.VISUAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,21 +14,34 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.action.change.Extension
|
import com.maddyhome.idea.vim.action.change.Extension
|
||||||
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.common.CommandAlias
|
import com.maddyhome.idea.vim.common.CommandAlias
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
||||||
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.helper.CommandLineHelper
|
import com.maddyhome.idea.vim.helper.CommandLineHelper
|
||||||
import com.maddyhome.idea.vim.helper.TestInputModel
|
import com.maddyhome.idea.vim.helper.TestInputModel
|
||||||
|
import com.maddyhome.idea.vim.helper.noneOfEnum
|
||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.key.MappingOwner
|
import com.maddyhome.idea.vim.key.MappingOwner
|
||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.ui.ModalEntry
|
import com.maddyhome.idea.vim.ui.ModalEntry
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.Executable
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.ExecutionResult
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.VimLContext
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.expressions.Scope
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.statements.FunctionDeclaration
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.statements.FunctionFlag
|
||||||
import java.awt.event.KeyEvent
|
import java.awt.event.KeyEvent
|
||||||
|
import java.util.*
|
||||||
import javax.swing.KeyStroke
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,12 +133,6 @@ public object VimExtensionFacade {
|
|||||||
.setAlias(name, CommandAlias.Call(minimumNumberOfArguments, maximumNumberOfArguments, name, handler))
|
.setAlias(name, CommandAlias.Call(minimumNumberOfArguments, maximumNumberOfArguments, name, handler))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the value of 'operatorfunc' to be used as the operator function in 'g@'. */
|
|
||||||
@JvmStatic
|
|
||||||
public fun setOperatorFunction(function: OperatorFunction) {
|
|
||||||
VimPlugin.getKey().operatorFunction = function
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs normal mode commands similar to ':normal! {commands}'.
|
* Runs normal mode commands similar to ':normal! {commands}'.
|
||||||
* Mappings doesn't work with this function
|
* Mappings doesn't work with this function
|
||||||
@@ -207,4 +214,65 @@ public object VimExtensionFacade {
|
|||||||
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
||||||
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList(), type)
|
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList(), type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public fun exportScriptFunction(
|
||||||
|
scope: Scope?,
|
||||||
|
name: String,
|
||||||
|
args: List<String>,
|
||||||
|
defaultArgs: List<Pair<String, Expression>>,
|
||||||
|
hasOptionalArguments: Boolean,
|
||||||
|
flags: EnumSet<FunctionFlag>,
|
||||||
|
function: ScriptFunction
|
||||||
|
) {
|
||||||
|
var functionDeclaration: FunctionDeclaration? = null
|
||||||
|
val body = listOf(object : Executable {
|
||||||
|
// This context is set to the function declaration during initialisation and then set to the function execution
|
||||||
|
// context during execution
|
||||||
|
override lateinit var vimContext: VimLContext
|
||||||
|
override var rangeInScript: TextRange = TextRange(0, 0)
|
||||||
|
|
||||||
|
override fun execute(editor: VimEditor, context: ExecutionContext): ExecutionResult {
|
||||||
|
return function.execute(editor, context, functionDeclaration!!.functionVariables)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
functionDeclaration = FunctionDeclaration(
|
||||||
|
scope,
|
||||||
|
name,
|
||||||
|
args,
|
||||||
|
defaultArgs,
|
||||||
|
body,
|
||||||
|
replaceExisting = true,
|
||||||
|
flags,
|
||||||
|
hasOptionalArguments
|
||||||
|
)
|
||||||
|
functionDeclaration.rangeInScript = TextRange(0, 0)
|
||||||
|
body.forEach { it.vimContext = functionDeclaration }
|
||||||
|
injector.functionService.storeFunction(functionDeclaration)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFunction) {
|
||||||
|
exportScriptFunction(null, name, listOf("type"), emptyList(), false, noneOfEnum()) {
|
||||||
|
editor, context, args ->
|
||||||
|
|
||||||
|
val type = args["type"]?.asString()
|
||||||
|
val selectionType = when (type) {
|
||||||
|
"line" -> SelectionType.LINE_WISE
|
||||||
|
"block" -> SelectionType.BLOCK_WISE
|
||||||
|
"char" -> SelectionType.CHARACTER_WISE
|
||||||
|
else -> return@exportScriptFunction ExecutionResult.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
if (function.apply(editor, context, selectionType)) {
|
||||||
|
ExecutionResult.Success
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ExecutionResult.Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public fun interface ScriptFunction {
|
||||||
|
public fun execute(editor: VimEditor, context: ExecutionContext, args: Map<String, VimDataType>): ExecutionResult
|
||||||
|
}
|
@@ -22,26 +22,26 @@ import com.maddyhome.idea.vim.api.ExecutionContext
|
|||||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getLineEndOffset
|
import com.maddyhome.idea.vim.api.getLineEndOffset
|
||||||
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
import com.maddyhome.idea.vim.extension.exportOperatorFunction
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.PsiHelper
|
import com.maddyhome.idea.vim.helper.PsiHelper
|
||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
@@ -49,17 +49,22 @@ import com.maddyhome.idea.vim.key.OperatorFunction
|
|||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
internal class CommentaryExtension : VimExtension {
|
internal class CommentaryExtension : VimExtension {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
private const val OPERATOR_FUNC = "CommentaryOperatorFunc"
|
||||||
|
|
||||||
fun doCommentary(
|
fun doCommentary(
|
||||||
editor: VimEditor,
|
editor: VimEditor,
|
||||||
context: ExecutionContext,
|
context: ExecutionContext,
|
||||||
range: TextRange,
|
range: TextRange,
|
||||||
selectionType: SelectionType,
|
selectionType: SelectionType,
|
||||||
resetCaret: Boolean,
|
resetCaret: Boolean = true,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val mode = editor.vimStateMachine.mode
|
val mode = editor.vimStateMachine.mode
|
||||||
if (mode !is Mode.VISUAL) {
|
if (mode !is Mode.VISUAL) {
|
||||||
@@ -67,8 +72,7 @@ internal class CommentaryExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return runWriteAction {
|
return runWriteAction {
|
||||||
// Treat block- and character-wise selections as block comments. Be ready to fall back to if the first action
|
// Treat block- and character-wise selections as block comments. Fall back if the first action isn't available
|
||||||
// isn't available
|
|
||||||
val actions = if (selectionType === SelectionType.LINE_WISE) {
|
val actions = if (selectionType === SelectionType.LINE_WISE) {
|
||||||
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
|
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
|
||||||
} else {
|
} else {
|
||||||
@@ -113,6 +117,7 @@ internal class CommentaryExtension : VimExtension {
|
|||||||
// first non-whitespace character, then the caret is in the right place. If it's inserted at the first column,
|
// first non-whitespace character, then the caret is in the right place. If it's inserted at the first column,
|
||||||
// then the caret is now in a bit of a weird place. We can't detect this scenario, so we just have to accept
|
// then the caret is now in a bit of a weird place. We can't detect this scenario, so we just have to accept
|
||||||
// the difference
|
// the difference
|
||||||
|
// TODO: If we don't move the caret to the start offset, we should maintain the current logical position
|
||||||
if (resetCaret) {
|
if (resetCaret) {
|
||||||
editor.primaryCaret().moveToOffset(range.startOffset)
|
editor.primaryCaret().moveToOffset(range.startOffset)
|
||||||
}
|
}
|
||||||
@@ -145,6 +150,16 @@ internal class CommentaryExtension : VimExtension {
|
|||||||
putKeyMapping(MappingMode.N, injector.parser.parseKeys("<Plug>(CommentLine)"), owner, plugCommentaryLineKeys, true)
|
putKeyMapping(MappingMode.N, injector.parser.parseKeys("<Plug>(CommentLine)"), owner, plugCommentaryLineKeys, true)
|
||||||
|
|
||||||
addCommand("Commentary", CommentaryCommandAliasHandler())
|
addCommand("Commentary", CommentaryCommandAliasHandler())
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, CommentaryOperatorFunction())
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CommentaryOperatorFunction : OperatorFunction {
|
||||||
|
// todo make it multicaret
|
||||||
|
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
|
||||||
|
val range = injector.markService.getChangeMarks(editor.primaryCaret()) ?: return false
|
||||||
|
return doCommentary(editor, context, range, selectionType ?: SelectionType.CHARACTER_WISE, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,19 +168,13 @@ internal class CommentaryExtension : VimExtension {
|
|||||||
* E.g. handles the `gc` in `gc_`, by setting the operator function, then invoking `g@` to receive the `_` motion to
|
* E.g. handles the `gc` in `gc_`, by setting the operator function, then invoking `g@` to receive the `_` motion to
|
||||||
* invoke the operator. This object is both the mapping handler and the operator function.
|
* invoke the operator. This object is both the mapping handler and the operator function.
|
||||||
*/
|
*/
|
||||||
private class CommentaryOperatorHandler : OperatorFunction, ExtensionHandler {
|
private class CommentaryOperatorHandler : ExtensionHandler {
|
||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(this)
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo make it multicaret
|
|
||||||
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
|
|
||||||
val range = injector.markService.getChangeMarks(editor.primaryCaret()) ?: return false
|
|
||||||
return doCommentary(editor, context, range, selectionType ?: SelectionType.CHARACTER_WISE, true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CommentaryMappingHandler : ExtensionHandler {
|
private class CommentaryMappingHandler : ExtensionHandler {
|
||||||
|
@@ -19,22 +19,23 @@ import com.intellij.openapi.util.Key
|
|||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getOffset
|
import com.maddyhome.idea.vim.api.getOffset
|
||||||
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.api.setChangeMarks
|
import com.maddyhome.idea.vim.api.setChangeMarks
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
|
|
||||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegister
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegister
|
||||||
|
import com.maddyhome.idea.vim.extension.exportOperatorFunction
|
||||||
import com.maddyhome.idea.vim.helper.fileSize
|
import com.maddyhome.idea.vim.helper.fileSize
|
||||||
import com.maddyhome.idea.vim.state.mode.mode
|
import com.maddyhome.idea.vim.state.mode.mode
|
||||||
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
|
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
|
||||||
@@ -72,17 +73,15 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("X"), owner, injector.parser.parseKeys(EXCHANGE_CMD), true)
|
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("X"), owner, injector.parser.parseKeys(EXCHANGE_CMD), true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxc"), owner, injector.parser.parseKeys(EXCHANGE_CLEAR_CMD), true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxc"), owner, injector.parser.parseKeys(EXCHANGE_CLEAR_CMD), true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxx"), owner, injector.parser.parseKeys(EXCHANGE_LINE_CMD), true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxx"), owner, injector.parser.parseKeys(EXCHANGE_LINE_CMD), true)
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@NonNls
|
@NonNls private const val EXCHANGE_CMD = "<Plug>(Exchange)"
|
||||||
const val EXCHANGE_CMD = "<Plug>(Exchange)"
|
@NonNls private const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
|
||||||
|
@NonNls private const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
|
||||||
@NonNls
|
@NonNls private const val OPERATOR_FUNC = "ExchangeOperatorFunc"
|
||||||
const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
|
|
||||||
|
|
||||||
@NonNls
|
|
||||||
const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
|
|
||||||
|
|
||||||
val EXCHANGE_KEY = Key<Exchange>("exchange")
|
val EXCHANGE_KEY = Key<Exchange>("exchange")
|
||||||
|
|
||||||
@@ -108,7 +107,7 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(Operator(false))
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys(if (isLine) "g@_" else "g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys(if (isLine) "g@_" else "g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,12 +124,12 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
val mode = editor.mode
|
val mode = editor.mode
|
||||||
// Leave visual mode to create selection marks
|
// Leave visual mode to create selection marks
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
||||||
Operator(true).apply(editor, context, mode.selectionType ?: CHARACTER_WISE)
|
Operator(true).apply(editor, context, mode.selectionType ?: SelectionType.CHARACTER_WISE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Operator(private val isVisual: Boolean) : OperatorFunction {
|
private class Operator(private val isVisual: Boolean = false) : OperatorFunction {
|
||||||
fun Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
|
fun Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
|
||||||
fun SelectionType.getString() = when (this) {
|
fun SelectionType.getString() = when (this) {
|
||||||
SelectionType.CHARACTER_WISE -> "v"
|
SelectionType.CHARACTER_WISE -> "v"
|
||||||
@@ -148,7 +147,7 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
else -> HighlighterTargetArea.EXACT_RANGE
|
else -> HighlighterTargetArea.EXACT_RANGE
|
||||||
}
|
}
|
||||||
val isVisualLine = ex.type == SelectionType.LINE_WISE
|
val isVisualLine = ex.type == SelectionType.LINE_WISE
|
||||||
val endAdj = if (!(isVisualLine) && (hlArea == HighlighterTargetArea.EXACT_RANGE || (isVisual))) 1 else 0
|
val endAdj = if (!(isVisualLine) && (hlArea == HighlighterTargetArea.EXACT_RANGE || isVisual)) 1 else 0
|
||||||
return ijEditor.markupModel.addRangeHighlighter(
|
return ijEditor.markupModel.addRangeHighlighter(
|
||||||
ijEditor.getMarkOffset(ex.start),
|
ijEditor.getMarkOffset(ex.start),
|
||||||
(ijEditor.getMarkOffset(ex.end) + endAdj).coerceAtMost(ijEditor.fileSize),
|
(ijEditor.getMarkOffset(ex.end) + endAdj).coerceAtMost(ijEditor.fileSize),
|
||||||
@@ -158,7 +157,7 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val currentExchange = getExchange(ijEditor, isVisual, selectionType ?: CHARACTER_WISE)
|
val currentExchange = getExchange(ijEditor, isVisual, selectionType ?: SelectionType.CHARACTER_WISE)
|
||||||
val exchange1 = ijEditor.getUserData(EXCHANGE_KEY)
|
val exchange1 = ijEditor.getUserData(EXCHANGE_KEY)
|
||||||
if (exchange1 == null) {
|
if (exchange1 == null) {
|
||||||
val highlighter = highlightExchange(currentExchange)
|
val highlighter = highlightExchange(currentExchange)
|
||||||
|
@@ -217,6 +217,8 @@ private object FileTypePatterns {
|
|||||||
|
|
||||||
return if (fileTypeName in htmlLikeFileTypes) {
|
return if (fileTypeName in htmlLikeFileTypes) {
|
||||||
this.htmlPatterns
|
this.htmlPatterns
|
||||||
|
} else if (fileTypeName == "JAVA" || fileExtension == "java") {
|
||||||
|
this.javaPatterns
|
||||||
} else if (fileTypeName == "Ruby" || fileExtension == "rb") {
|
} else if (fileTypeName == "Ruby" || fileExtension == "rb") {
|
||||||
this.rubyPatterns
|
this.rubyPatterns
|
||||||
} else if (fileTypeName == "RHTML" || fileExtension == "erb") {
|
} else if (fileTypeName == "RHTML" || fileExtension == "erb") {
|
||||||
@@ -242,6 +244,7 @@ private object FileTypePatterns {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private val htmlPatterns = createHtmlPatterns()
|
private val htmlPatterns = createHtmlPatterns()
|
||||||
|
private val javaPatterns = createJavaPatterns()
|
||||||
private val rubyPatterns = createRubyPatterns()
|
private val rubyPatterns = createRubyPatterns()
|
||||||
private val rubyAndHtmlPatterns = rubyPatterns + htmlPatterns
|
private val rubyAndHtmlPatterns = rubyPatterns + htmlPatterns
|
||||||
private val phpPatterns = createPhpPatterns()
|
private val phpPatterns = createPhpPatterns()
|
||||||
@@ -270,6 +273,14 @@ private object FileTypePatterns {
|
|||||||
LanguagePatterns(linkedMapOf(openingTagPattern to htmlSearchPair), linkedMapOf(closingTagPattern to htmlSearchPair))
|
LanguagePatterns(linkedMapOf(openingTagPattern to htmlSearchPair), linkedMapOf(closingTagPattern to htmlSearchPair))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createJavaPatterns(): LanguagePatterns {
|
||||||
|
return (
|
||||||
|
LanguagePatterns("\\b(?<!else\\s+)if\\b", "\\belse\\s+if\\b", "\\belse(?!\\s+if)\\b") +
|
||||||
|
LanguagePatterns("\\bdo\\b", "\\bwhile\\b") +
|
||||||
|
LanguagePatterns("\\btry\\b", "\\bcatch\\b", "\\bfinally\\b")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
private fun createRubyPatterns(): LanguagePatterns {
|
private fun createRubyPatterns(): LanguagePatterns {
|
||||||
// Original patterns: https://github.com/vim/vim/blob/master/runtime/ftplugin/ruby.vim
|
// Original patterns: https://github.com/vim/vim/blob/master/runtime/ftplugin/ruby.vim
|
||||||
|
@@ -14,12 +14,12 @@ import com.maddyhome.idea.vim.api.ExecutionContext
|
|||||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getLineEndOffset
|
import com.maddyhome.idea.vim.api.getLineEndOffset
|
||||||
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
|
|
||||||
import com.maddyhome.idea.vim.state.mode.isLine
|
import com.maddyhome.idea.vim.state.mode.isLine
|
||||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
@@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.extension.VimExtension
|
|||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
import com.maddyhome.idea.vim.extension.exportOperatorFunction
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
import com.maddyhome.idea.vim.helper.exitVisualMode
|
import com.maddyhome.idea.vim.helper.exitVisualMode
|
||||||
import com.maddyhome.idea.vim.state.mode.mode
|
import com.maddyhome.idea.vim.state.mode.mode
|
||||||
@@ -53,11 +53,13 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_OPERATOR), true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_OPERATOR), true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("grr"), owner, injector.parser.parseKeys(RWR_LINE), true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("grr"), owner, injector.parser.parseKeys(RWR_LINE), true)
|
||||||
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_VISUAL), true)
|
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_VISUAL), true)
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RwrVisual : ExtensionHandler {
|
private class RwrVisual : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
val typeInEditor = editor.mode.selectionType ?: CHARACTER_WISE
|
val typeInEditor = editor.mode.selectionType ?: SelectionType.CHARACTER_WISE
|
||||||
editor.sortedCarets().forEach { caret ->
|
editor.sortedCarets().forEach { caret ->
|
||||||
val selectionStart = caret.selectionStart
|
val selectionStart = caret.selectionStart
|
||||||
val selectionEnd = caret.selectionEnd
|
val selectionEnd = caret.selectionEnd
|
||||||
@@ -73,7 +75,7 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
override val isRepeatable: Boolean = true
|
override val isRepeatable: Boolean = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(Operator())
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,11 +114,11 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
editor.primaryCaret() to VimSelection.create(
|
editor.primaryCaret() to VimSelection.create(
|
||||||
range.startOffset,
|
range.startOffset,
|
||||||
range.endOffset - 1,
|
range.endOffset - 1,
|
||||||
selectionType ?: CHARACTER_WISE,
|
selectionType ?: SelectionType.CHARACTER_WISE,
|
||||||
editor,
|
editor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
selectionType ?: CHARACTER_WISE,
|
selectionType ?: SelectionType.CHARACTER_WISE,
|
||||||
)
|
)
|
||||||
// todo multicaret
|
// todo multicaret
|
||||||
doReplace(ijEditor, editor.primaryCaret(), visualSelection)
|
doReplace(ijEditor, editor.primaryCaret(), visualSelection)
|
||||||
@@ -132,14 +134,10 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@NonNls
|
@NonNls private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
|
||||||
private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
|
@NonNls private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
|
||||||
|
@NonNls private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
|
||||||
@NonNls
|
@NonNls private const val OPERATOR_FUNC = "ReplaceWithRegisterOperatorFunc"
|
||||||
private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
|
|
||||||
|
|
||||||
@NonNls
|
|
||||||
private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
|
|
||||||
|
|
||||||
private fun doReplace(editor: Editor, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
|
private fun doReplace(editor: Editor, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
|
||||||
val registerGroup = injector.registerGroup
|
val registerGroup = injector.registerGroup
|
||||||
|
@@ -16,6 +16,7 @@ import com.maddyhome.idea.vim.api.VimCaret
|
|||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.endsWithNewLine
|
import com.maddyhome.idea.vim.api.endsWithNewLine
|
||||||
import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
|
import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
|
||||||
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.api.setChangeMarks
|
import com.maddyhome.idea.vim.api.setChangeMarks
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
@@ -23,14 +24,16 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
|||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegisterForCaret
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegisterForCaret
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputKeyStroke
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputKeyStroke
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputString
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputString
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
|
||||||
|
import com.maddyhome.idea.vim.extension.exportOperatorFunction
|
||||||
|
import com.maddyhome.idea.vim.state.mode.mode
|
||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
@@ -74,13 +77,15 @@ internal class VimSurroundExtension : VimExtension {
|
|||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("ds"), owner, injector.parser.parseKeys("<Plug>DSurround"), true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("ds"), owner, injector.parser.parseKeys("<Plug>DSurround"), true)
|
||||||
putKeyMappingIfMissing(MappingMode.XO, injector.parser.parseKeys("S"), owner, injector.parser.parseKeys("<Plug>VSurround"), true)
|
putKeyMappingIfMissing(MappingMode.XO, injector.parser.parseKeys("S"), owner, injector.parser.parseKeys("<Plug>VSurround"), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
|
||||||
}
|
}
|
||||||
|
|
||||||
private class YSurroundHandler : ExtensionHandler {
|
private class YSurroundHandler : ExtensionHandler {
|
||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(Operator())
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,7 +293,9 @@ private val LOG = logger<VimSurroundExtension>()
|
|||||||
|
|
||||||
private const val REGISTER = '"'
|
private const val REGISTER = '"'
|
||||||
|
|
||||||
private val tagNameAndAttributesCapturePattern = "(\\S+)([^>]*)>".toPattern()
|
private const val OPERATOR_FUNC = "SurroundOperatorFunc"
|
||||||
|
|
||||||
|
private val tagNameAndAttributesCapturePattern = "(\\S+)([^>]*)>".toPattern()
|
||||||
|
|
||||||
private val SURROUND_PAIRS = mapOf(
|
private val SURROUND_PAIRS = mapOf(
|
||||||
'b' to ("(" to ")"),
|
'b' to ("(" to ")"),
|
||||||
|
@@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.group
|
package com.maddyhome.idea.vim.group
|
||||||
|
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.maddyhome.idea.vim.api.VimCommandGroupBase
|
import com.maddyhome.idea.vim.api.VimCommandGroupBase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Elliot Courant
|
* @author Elliot Courant
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
internal class CommandGroup : VimCommandGroupBase()
|
internal class CommandGroup : VimCommandGroupBase()
|
||||||
|
@@ -20,7 +20,6 @@ import com.maddyhome.idea.vim.options.OptionAccessScope
|
|||||||
*/
|
*/
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
|
public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
|
||||||
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
|
|
||||||
public var ide: String by optionProperty(IjOptions.ide)
|
public var ide: String by optionProperty(IjOptions.ide)
|
||||||
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
|
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
|
||||||
public var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
|
public var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
|
||||||
@@ -29,15 +28,16 @@ public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesB
|
|||||||
public val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
|
public val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
|
||||||
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
|
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
|
||||||
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
|
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
|
||||||
public var showmodewidget: Boolean by optionProperty(IjOptions.showmodewidget)
|
|
||||||
|
|
||||||
// Temporary options to control work-in-progress behaviour
|
// Temporary options to control work-in-progress behaviour
|
||||||
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
|
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
|
||||||
public var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
|
|
||||||
public var exCommandAnnotation: Boolean by optionProperty(IjOptions.exCommandAnnotation)
|
|
||||||
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
|
|
||||||
public var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
|
public var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
|
||||||
|
public var exCommandAnnotation: Boolean by optionProperty(IjOptions.exCommandAnnotation)
|
||||||
|
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
|
||||||
|
public var showmodewidget: Boolean by optionProperty(IjOptions.showmodewidget)
|
||||||
|
public var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
|
||||||
public var useNewRegex: Boolean by optionProperty(IjOptions.useNewRegex)
|
public var useNewRegex: Boolean by optionProperty(IjOptions.useNewRegex)
|
||||||
|
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -33,8 +33,6 @@ public object IjOptions {
|
|||||||
Options.overrideDefaultValue(Options.clipboard, VimString("ideaput,autoselect,exclude:cons\\|linux"))
|
Options.overrideDefaultValue(Options.clipboard, VimString("ideaput,autoselect,exclude:cons\\|linux"))
|
||||||
}
|
}
|
||||||
|
|
||||||
public val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true))
|
|
||||||
public val exCommandAnnotation: ToggleOption = addOption(ToggleOption("excommandannotation", GLOBAL, "excommandannotation", true))
|
|
||||||
public val ide: StringOption = addOption(
|
public val ide: StringOption = addOption(
|
||||||
StringOption("ide", GLOBAL, "ide", ApplicationNamesInfo.getInstance().fullProductNameWithEdition)
|
StringOption("ide", GLOBAL, "ide", ApplicationNamesInfo.getInstance().fullProductNameWithEdition)
|
||||||
)
|
)
|
||||||
@@ -81,15 +79,19 @@ public object IjOptions {
|
|||||||
"<Tab>,<Down>,<Up>,<Enter>,<Left>,<Right>,<C-Down>,<C-Up>,<PageUp>,<PageDown>,<C-J>,<C-Q>")
|
"<Tab>,<Down>,<Up>,<Enter>,<Left>,<Right>,<C-Down>,<C-Up>,<PageUp>,<PageDown>,<C-J>,<C-Q>")
|
||||||
)
|
)
|
||||||
public val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
|
public val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
|
||||||
public val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true))
|
|
||||||
public val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
public val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
||||||
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isTemporary = true))
|
|
||||||
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isTemporary = true))
|
// Temporary feature flags during development, not really intended for external use
|
||||||
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isTemporary = true))
|
public val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
|
||||||
public val showmodewidget: ToggleOption = addOption(ToggleOption("showmodewidget", GLOBAL, "showmodewidget", false, isTemporary = true))
|
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
|
||||||
public val useNewRegex: ToggleOption = addOption(ToggleOption("usenewregex", GLOBAL, "usenewregex", true, isTemporary = true))
|
public val exCommandAnnotation: ToggleOption = addOption(ToggleOption("excommandannotation", GLOBAL, "excommandannotation", true, isHidden = true))
|
||||||
|
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isHidden = true))
|
||||||
|
public val showmodewidget: ToggleOption = addOption(ToggleOption("showmodewidget", GLOBAL, "showmodewidget", false, isHidden = true))
|
||||||
|
public val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true, isHidden = true))
|
||||||
|
public val useNewRegex: ToggleOption = addOption(ToggleOption("usenewregex", GLOBAL, "usenewregex", true, isHidden = true))
|
||||||
|
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isHidden = true))
|
||||||
|
|
||||||
// This needs to be Option<out VimDataType> so that it can work with derived option types, such as NumberOption, which
|
// This needs to be Option<out VimDataType> so that it can work with derived option types, such as NumberOption, which
|
||||||
// derives from Option<VimInt>
|
// derives from Option<VimInt>
|
||||||
private fun <T : Option<out VimDataType>> addOption(option: T) = option.also { Options.addOption(option) }
|
private fun <T : Option<out VimDataType>> addOption(option: T) = option.also { Options.addOption(option) }
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ package com.maddyhome.idea.vim.group
|
|||||||
import com.intellij.codeInsight.completion.CompletionPhase
|
import com.intellij.codeInsight.completion.CompletionPhase
|
||||||
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl
|
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException
|
import com.intellij.openapi.progress.ProcessCanceledException
|
||||||
import com.intellij.openapi.progress.ProgressManager
|
import com.intellij.openapi.progress.ProgressManager
|
||||||
@@ -25,6 +26,7 @@ import com.maddyhome.idea.vim.newapi.IjVimEditor
|
|||||||
/**
|
/**
|
||||||
* Used to handle playback of macros
|
* Used to handle playback of macros
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
internal class MacroGroup : VimMacroBase() {
|
internal class MacroGroup : VimMacroBase() {
|
||||||
|
|
||||||
// If it's null, this is the top macro (as in most cases). If it's not null, this macro is executed from top macro
|
// If it's null, this is the top macro (as in most cases). If it's not null, this macro is executed from top macro
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
package com.maddyhome.idea.vim.group
|
package com.maddyhome.idea.vim.group
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.LogicalPosition
|
import com.intellij.openapi.editor.LogicalPosition
|
||||||
@@ -83,6 +84,7 @@ import kotlin.math.min
|
|||||||
/**
|
/**
|
||||||
* This handles all motion related commands and marks
|
* This handles all motion related commands and marks
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
internal class MotionGroup : VimMotionGroupBase() {
|
internal class MotionGroup : VimMotionGroupBase() {
|
||||||
override fun onAppCodeMovement(editor: VimEditor, caret: VimCaret, offset: Int, oldOffset: Int) {
|
override fun onAppCodeMovement(editor: VimEditor, caret: VimCaret, offset: Int, oldOffset: Int) {
|
||||||
AppCodeTemplates.onMovement(editor.ij, caret.ij, oldOffset < offset)
|
AppCodeTemplates.onMovement(editor.ij, caret.ij, oldOffset < offset)
|
||||||
|
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
|
|||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.intellij.openapi.ide.CopyPasteManager
|
import com.intellij.openapi.ide.CopyPasteManager
|
||||||
import com.intellij.openapi.keymap.KeymapUtil
|
import com.intellij.openapi.keymap.KeymapUtil
|
||||||
@@ -55,6 +56,7 @@ import javax.swing.KeyStroke
|
|||||||
* This service is can be used as application level and as project level service.
|
* This service is can be used as application level and as project level service.
|
||||||
* If project is null, this means that this is an application level service and notification will be shown for all projects
|
* If project is null, this means that this is an application level service and notification will be shown for all projects
|
||||||
*/
|
*/
|
||||||
|
@Service(Service.Level.PROJECT, Service.Level.APP)
|
||||||
internal class NotificationService(private val project: Project?) {
|
internal class NotificationService(private val project: Project?) {
|
||||||
// This constructor is used to create an applicationService
|
// This constructor is used to create an applicationService
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.group
|
package com.maddyhome.idea.vim.group
|
||||||
|
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import org.apache.commons.codec.binary.Base64
|
import org.apache.commons.codec.binary.Base64
|
||||||
import org.jdom.Element
|
import org.jdom.Element
|
||||||
|
|
||||||
|
@Service
|
||||||
internal class XMLGroup {
|
internal class XMLGroup {
|
||||||
/**
|
/**
|
||||||
* Set the text of an XML element, safely encode it if needed.
|
* Set the text of an XML element, safely encode it if needed.
|
||||||
|
@@ -14,6 +14,7 @@ import com.intellij.ide.DataManager
|
|||||||
import com.intellij.ide.PasteProvider
|
import com.intellij.ide.PasteProvider
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.RangeMarker
|
import com.intellij.openapi.editor.RangeMarker
|
||||||
import com.intellij.openapi.editor.ex.EditorEx
|
import com.intellij.openapi.editor.ex.EditorEx
|
||||||
@@ -51,6 +52,7 @@ import com.maddyhome.idea.vim.state.mode.isChar
|
|||||||
import com.maddyhome.idea.vim.state.mode.isLine
|
import com.maddyhome.idea.vim.state.mode.isLine
|
||||||
import java.awt.datatransfer.DataFlavor
|
import java.awt.datatransfer.DataFlavor
|
||||||
|
|
||||||
|
@Service
|
||||||
internal class PutGroup : VimPutBase() {
|
internal class PutGroup : VimPutBase() {
|
||||||
|
|
||||||
override fun getProviderForPasteViaIde(
|
override fun getProviderForPasteViaIde(
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.helper
|
package com.maddyhome.idea.vim.helper
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.diagnostic.thisLogger
|
import com.intellij.openapi.diagnostic.thisLogger
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.CaretVisualAttributes
|
import com.intellij.openapi.editor.CaretVisualAttributes
|
||||||
@@ -85,7 +86,10 @@ private fun Editor.updatePrimaryCaretVisualAttributes() {
|
|||||||
caretModel.primaryCaret.visualAttributes = AttributesCache.getCaretVisualAttributes(this)
|
caretModel.primaryCaret.visualAttributes = AttributesCache.getCaretVisualAttributes(this)
|
||||||
|
|
||||||
// Make sure the caret is visible as soon as it's set. It might be invisible while blinking
|
// Make sure the caret is visible as soon as it's set. It might be invisible while blinking
|
||||||
(this as? EditorEx)?.setCaretVisible(true)
|
// NOTE: At the moment, this causes project leak in tests
|
||||||
|
if (!ApplicationManager.getApplication().isUnitTestMode) {
|
||||||
|
(this as? EditorEx)?.setCaretVisible(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Editor.updateSecondaryCaretsVisualAttributes() {
|
private fun Editor.updateSecondaryCaretsVisualAttributes() {
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
package com.maddyhome.idea.vim.helper;
|
package com.maddyhome.idea.vim.helper;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx;
|
||||||
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||||
import com.intellij.lang.Commenter;
|
import com.intellij.lang.Commenter;
|
||||||
import com.intellij.lang.Language;
|
import com.intellij.lang.Language;
|
||||||
@@ -16,22 +17,28 @@ import com.intellij.lang.LanguageCommenters;
|
|||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.editor.Caret;
|
import com.intellij.openapi.editor.Caret;
|
||||||
import com.intellij.openapi.editor.Editor;
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.psi.PsiComment;
|
import com.intellij.psi.PsiComment;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
|
import com.intellij.spellchecker.SpellCheckerSeveritiesProvider;
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
import com.maddyhome.idea.vim.api.EngineEditorHelperKt;
|
import com.maddyhome.idea.vim.api.EngineEditorHelperKt;
|
||||||
import com.maddyhome.idea.vim.api.VimEditor;
|
import com.maddyhome.idea.vim.api.VimEditor;
|
||||||
import com.maddyhome.idea.vim.regexp.*;
|
|
||||||
import com.maddyhome.idea.vim.regexp.match.VimMatchResult;
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode;
|
|
||||||
import com.maddyhome.idea.vim.state.VimStateMachine;
|
|
||||||
import com.maddyhome.idea.vim.common.CharacterPosition;
|
import com.maddyhome.idea.vim.common.CharacterPosition;
|
||||||
import com.maddyhome.idea.vim.common.Direction;
|
import com.maddyhome.idea.vim.common.Direction;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimCaret;
|
import com.maddyhome.idea.vim.newapi.IjVimCaret;
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
||||||
|
import com.maddyhome.idea.vim.regexp.*;
|
||||||
|
import com.maddyhome.idea.vim.regexp.match.VimMatchResult;
|
||||||
|
import com.maddyhome.idea.vim.state.VimStateMachine;
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntComparator;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntIterator;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntRBTreeSet;
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntSortedSet;
|
||||||
import kotlin.Pair;
|
import kotlin.Pair;
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -1573,6 +1580,42 @@ public class SearchHelper {
|
|||||||
return PsiHelper.findMethodEnd(editor, caret.getOffset(), count);
|
return PsiHelper.findMethodEnd(editor, caret.getOffset(), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int findMisspelledWords(@NotNull Editor editor,
|
||||||
|
int startOffset,
|
||||||
|
int endOffset,
|
||||||
|
int skipCount,
|
||||||
|
IntComparator offsetOrdering) {
|
||||||
|
Project project = editor.getProject();
|
||||||
|
if (project == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntSortedSet offsets = new IntRBTreeSet(offsetOrdering);
|
||||||
|
DaemonCodeAnalyzerEx.processHighlights(editor.getDocument(), project, SpellCheckerSeveritiesProvider.TYPO,
|
||||||
|
startOffset, endOffset, highlight -> {
|
||||||
|
if (highlight.getSeverity() == SpellCheckerSeveritiesProvider.TYPO) {
|
||||||
|
int offset = highlight.getStartOffset();
|
||||||
|
if (offset >= startOffset && offset <= endOffset) {
|
||||||
|
offsets.add(offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (offsets.isEmpty()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skipCount >= offsets.size()) {
|
||||||
|
return offsets.lastInt();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
IntIterator offsetIterator = offsets.iterator();
|
||||||
|
offsetIterator.skip(skipCount);
|
||||||
|
return offsetIterator.nextInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static @NotNull String parseMatchPairsOption(final VimEditor vimEditor) {
|
private static @NotNull String parseMatchPairsOption(final VimEditor vimEditor) {
|
||||||
List<String> pairs = options(injector, vimEditor).getMatchpairs();
|
List<String> pairs = options(injector, vimEditor).getMatchpairs();
|
||||||
StringBuilder res = new StringBuilder();
|
StringBuilder res = new StringBuilder();
|
||||||
|
@@ -31,4 +31,8 @@ public object StringHelper {
|
|||||||
return Arrays.stream(string).flatMap { o: String -> injector.parser.parseKeys(o).stream() }
|
return Arrays.stream(string).flatMap { o: String -> injector.parser.parseKeys(o).stream() }
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@Deprecated("Use key.isCloseKeyStroke()", ReplaceWith("key.isCloseKeyStroke()"))
|
||||||
|
public fun isCloseKeyStroke(key: KeyStroke): Boolean = key.isCloseKeyStroke()
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,6 @@ public final class VimIcons {
|
|||||||
public static final @NotNull Icon YOUTRACK = load("/icons/youtrack.svg");
|
public static final @NotNull Icon YOUTRACK = load("/icons/youtrack.svg");
|
||||||
|
|
||||||
private static @NotNull Icon load(@NotNull @NonNls String path) {
|
private static @NotNull Icon load(@NotNull @NonNls String path) {
|
||||||
return IconManager.getInstance().getIcon(path, VimIcons.class);
|
return IconManager.getInstance().getIcon(path, VimIcons.class.getClassLoader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,11 +9,19 @@
|
|||||||
package com.maddyhome.idea.vim.inspections
|
package com.maddyhome.idea.vim.inspections
|
||||||
|
|
||||||
import com.intellij.codeInspection.LocalInspectionTool
|
import com.intellij.codeInspection.LocalInspectionTool
|
||||||
|
import com.intellij.codeInspection.LocalQuickFix
|
||||||
|
import com.intellij.codeInspection.ProblemDescriptor
|
||||||
import com.intellij.codeInspection.ProblemsHolder
|
import com.intellij.codeInspection.ProblemsHolder
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiElementVisitor
|
import com.intellij.psi.PsiElementVisitor
|
||||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||||
|
import com.intellij.psi.util.PsiEditorUtil
|
||||||
|
import com.maddyhome.idea.vim.extension.ExtensionBeanClass
|
||||||
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.commands.SetCommand
|
||||||
|
import com.maddyhome.idea.vim.vimscript.parser.VimscriptParser
|
||||||
|
|
||||||
internal class UsePlugSyntaxInspection : LocalInspectionTool() {
|
internal class UsePlugSyntaxInspection : LocalInspectionTool() {
|
||||||
override fun getGroupDisplayName(): String {
|
override fun getGroupDisplayName(): String {
|
||||||
@@ -23,11 +31,54 @@ internal class UsePlugSyntaxInspection : LocalInspectionTool() {
|
|||||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||||
val file = holder.file
|
val file = holder.file
|
||||||
if (file.name != ".ideavimrc" && file.name != "_ideavimrc") return PsiElementVisitor.EMPTY_VISITOR
|
if (file.name != ".ideavimrc" && file.name != "_ideavimrc") return PsiElementVisitor.EMPTY_VISITOR
|
||||||
|
val plugins = buildPlugins()
|
||||||
return object : PsiElementVisitor() {
|
return object : PsiElementVisitor() {
|
||||||
override fun visitElement(element: PsiElement) {
|
override fun visitElement(element: PsiElement) {
|
||||||
if (element !is LeafPsiElement) return
|
if (element !is LeafPsiElement) return
|
||||||
holder.registerProblem(element, TextRange.create(10, 20), "Hi there")
|
val myScript = VimscriptParser.parse(element.text)
|
||||||
|
myScript.units.forEach { unit ->
|
||||||
|
if (unit is SetCommand) {
|
||||||
|
val argument = unit.argument
|
||||||
|
val alias = plugins[argument]
|
||||||
|
if (alias != null) {
|
||||||
|
holder.registerProblem(
|
||||||
|
element,
|
||||||
|
unit.rangeInScript.let { TextRange(it.startOffset, it.endOffset - 1) },
|
||||||
|
"""
|
||||||
|
Use `Plug` syntax for defining extensions
|
||||||
|
""".trimIndent(),
|
||||||
|
object : LocalQuickFix {
|
||||||
|
override fun getFamilyName(): String {
|
||||||
|
return "Use Plug syntax"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun applyFix(p0: Project, p1: ProblemDescriptor) {
|
||||||
|
val editor = PsiEditorUtil.findEditor(file)
|
||||||
|
editor?.document?.replaceString(
|
||||||
|
unit.rangeInScript.startOffset,
|
||||||
|
unit.rangeInScript.endOffset - 1,
|
||||||
|
"Plug '$alias'"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun buildPlugins(): HashMap<String, String> {
|
||||||
|
val res = HashMap<String, String>()
|
||||||
|
VimExtension.EP_NAME.extensions.forEach { extension: ExtensionBeanClass ->
|
||||||
|
val alias = extension.aliases?.first { it.name?.count { it == '/' } == 1 }?.name
|
||||||
|
?: extension.aliases?.firstOrNull()?.name
|
||||||
|
val name = extension.name
|
||||||
|
if (alias != null && name != null) {
|
||||||
|
res[name] = alias
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.listener
|
package com.maddyhome.idea.vim.listener
|
||||||
|
|
||||||
import com.intellij.openapi.components.ServiceManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import org.acejump.session.SessionManager
|
import org.acejump.session.SessionManager
|
||||||
|
|
||||||
@@ -16,12 +16,11 @@ import org.acejump.session.SessionManager
|
|||||||
* Key handling for IdeaVim should be updated to editorHandler usage. In this case this class can be safely removed.
|
* Key handling for IdeaVim should be updated to editorHandler usage. In this case this class can be safely removed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
internal interface AceJumpService {
|
internal interface AceJumpService {
|
||||||
fun isActive(editor: Editor): Boolean
|
fun isActive(editor: Editor): Boolean
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getInstance(): AceJumpService? = ServiceManager.getService(AceJumpService::class.java)
|
fun getInstance(): AceJumpService? = ApplicationManager.getApplication().getService(AceJumpService::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,10 @@ internal class IjVimApplication : VimApplicationBase() {
|
|||||||
return ApplicationManager.getApplication().isUnitTestMode
|
return ApplicationManager.getApplication().isUnitTestMode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isInternal(): Boolean {
|
||||||
|
return ApplicationManager.getApplication().isInternal
|
||||||
|
}
|
||||||
|
|
||||||
override fun postKey(stroke: KeyStroke, editor: VimEditor) {
|
override fun postKey(stroke: KeyStroke, editor: VimEditor) {
|
||||||
val component: Component = SwingUtilities.getAncestorOfClass(Window::class.java, editor.ij.component)
|
val component: Component = SwingUtilities.getAncestorOfClass(Window::class.java, editor.ij.component)
|
||||||
val event = createKeyEvent(stroke, component)
|
val event = createKeyEvent(stroke, component)
|
||||||
|
@@ -29,6 +29,8 @@ import com.maddyhome.idea.vim.helper.checkInString
|
|||||||
import com.maddyhome.idea.vim.helper.fileSize
|
import com.maddyhome.idea.vim.helper.fileSize
|
||||||
import com.maddyhome.idea.vim.state.VimStateMachine.Companion.getInstance
|
import com.maddyhome.idea.vim.state.VimStateMachine.Companion.getInstance
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode.VISUAL
|
import com.maddyhome.idea.vim.state.mode.Mode.VISUAL
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntComparator
|
||||||
|
import it.unimi.dsi.fastutil.ints.IntComparators
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
@@ -689,4 +691,26 @@ internal class IjVimSearchHelper : VimSearchHelperBase() {
|
|||||||
// End offset exclusive
|
// End offset exclusive
|
||||||
return TextRange(bstart, bend + 1)
|
return TextRange(bstart, bend + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun findMisspelledWord(editor: VimEditor, caret: ImmutableVimCaret, count: Int): Int {
|
||||||
|
val startOffset: Int
|
||||||
|
val endOffset: Int
|
||||||
|
val skipCount: Int
|
||||||
|
val offsetOrdering: IntComparator
|
||||||
|
|
||||||
|
if (count < 0) {
|
||||||
|
startOffset = 0
|
||||||
|
endOffset = caret.offset.point - 1
|
||||||
|
skipCount = -count - 1
|
||||||
|
offsetOrdering = IntComparators.OPPOSITE_COMPARATOR
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
startOffset = caret.offset.point + 1
|
||||||
|
endOffset = editor.ij.document.textLength
|
||||||
|
skipCount = count - 1
|
||||||
|
offsetOrdering = IntComparators.NATURAL_COMPARATOR
|
||||||
|
}
|
||||||
|
|
||||||
|
return SearchHelper.findMisspelledWords(editor.ij, startOffset, endOffset, skipCount, offsetOrdering)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -333,7 +333,7 @@
|
|||||||
* |[m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousStartAction}
|
* |[m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousStartAction}
|
||||||
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
|
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
|
||||||
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
|
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
|
||||||
* |[s| TO BE IMPLEMENTED
|
* |[s| {@link com.maddyhome.idea.vim.action.motion.text.MotionMisspelledWordPreviousAction}
|
||||||
* |[z| TO BE IMPLEMENTED
|
* |[z| TO BE IMPLEMENTED
|
||||||
* |[{| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceOpenAction}
|
* |[{| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceOpenAction}
|
||||||
* |]_CTRL-D| TO BE IMPLEMENTED
|
* |]_CTRL-D| TO BE IMPLEMENTED
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
* |]m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodNextStartAction}
|
* |]m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodNextStartAction}
|
||||||
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
|
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
|
||||||
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
|
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
|
||||||
* |]s| TO BE IMPLEMENTED
|
* |]s| {@link com.maddyhome.idea.vim.action.motion.text.MotionMisspelledWordNextAction}
|
||||||
* |]z| TO BE IMPLEMENTED
|
* |]z| TO BE IMPLEMENTED
|
||||||
* |]}| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceCloseAction}
|
* |]}| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceCloseAction}
|
||||||
*
|
*
|
||||||
|
@@ -31,7 +31,7 @@ internal class Troubleshooter {
|
|||||||
|
|
||||||
fun findIncorrectMappings(): List<Problem> {
|
fun findIncorrectMappings(): List<Problem> {
|
||||||
val problems = ArrayList<Problem>()
|
val problems = ArrayList<Problem>()
|
||||||
MappingMode.values().forEach { mode ->
|
MappingMode.entries.forEach { mode ->
|
||||||
injector.keyGroup.getKeyMapping(mode).getByOwner(MappingOwner.IdeaVim.InitScript).forEach { (_, to) ->
|
injector.keyGroup.getKeyMapping(mode).getByOwner(MappingOwner.IdeaVim.InitScript).forEach { (_, to) ->
|
||||||
if (to is ToKeysMappingInfo) {
|
if (to is ToKeysMappingInfo) {
|
||||||
if (":action" in to.toKeys.joinToString { it.keyChar.toString() }) {
|
if (":action" in to.toKeys.joinToString { it.keyChar.toString() }) {
|
||||||
|
@@ -12,6 +12,7 @@ import com.intellij.icons.AllIcons
|
|||||||
import com.intellij.openapi.Disposable
|
import com.intellij.openapi.Disposable
|
||||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
@@ -159,8 +160,8 @@ internal class ReloadVimRc : DumbAwareAction() {
|
|||||||
internal class ReloadFloatingToolbar : AbstractFloatingToolbarProvider(ACTION_GROUP) {
|
internal class ReloadFloatingToolbar : AbstractFloatingToolbarProvider(ACTION_GROUP) {
|
||||||
override val autoHideable: Boolean = false
|
override val autoHideable: Boolean = false
|
||||||
|
|
||||||
override fun register(component: FloatingToolbarComponent, parentDisposable: Disposable) {
|
override fun register(dataContext: DataContext, component: FloatingToolbarComponent, parentDisposable: Disposable) {
|
||||||
super.register(component, parentDisposable)
|
super.register(dataContext, component, parentDisposable)
|
||||||
val action = {
|
val action = {
|
||||||
component.scheduleShow()
|
component.scheduleShow()
|
||||||
}
|
}
|
||||||
|
@@ -9,15 +9,16 @@ package com.maddyhome.idea.vim.ui
|
|||||||
|
|
||||||
import com.intellij.icons.AllIcons
|
import com.intellij.icons.AllIcons
|
||||||
import com.intellij.openapi.actionSystem.ActionToolbarPosition
|
import com.intellij.openapi.actionSystem.ActionToolbarPosition
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||||
import com.intellij.openapi.keymap.KeymapUtil
|
import com.intellij.openapi.keymap.KeymapUtil
|
||||||
import com.intellij.openapi.options.Configurable
|
import com.intellij.openapi.options.Configurable
|
||||||
|
import com.intellij.openapi.project.DumbAwareAction
|
||||||
import com.intellij.openapi.ui.ComboBoxTableRenderer
|
import com.intellij.openapi.ui.ComboBoxTableRenderer
|
||||||
import com.intellij.openapi.ui.StripeTable
|
import com.intellij.openapi.ui.StripeTable
|
||||||
import com.intellij.openapi.wm.IdeFocusManager
|
import com.intellij.openapi.wm.IdeFocusManager
|
||||||
import com.intellij.ui.DumbAwareActionButton
|
|
||||||
import com.intellij.ui.HyperlinkLabel
|
import com.intellij.ui.HyperlinkLabel
|
||||||
import com.intellij.ui.IdeBorderFactory
|
import com.intellij.ui.IdeBorderFactory
|
||||||
import com.intellij.ui.JBColor
|
import com.intellij.ui.JBColor
|
||||||
@@ -169,7 +170,7 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
return getColumnModel().getColumn(column.index)
|
return getColumnModel().getColumn(column.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ShortcutOwnerRenderer : ComboBoxTableRenderer<ShortcutOwner>(ShortcutOwner.values()) {
|
private class ShortcutOwnerRenderer : ComboBoxTableRenderer<ShortcutOwner>(ShortcutOwner.entries.toTypedArray()) {
|
||||||
override fun customizeComponent(owner: ShortcutOwner, table: JTable, isSelected: Boolean) {
|
override fun customizeComponent(owner: ShortcutOwner, table: JTable, isSelected: Boolean) {
|
||||||
super.customizeComponent(owner, table, isSelected)
|
super.customizeComponent(owner, table, isSelected)
|
||||||
if (owner == ShortcutOwner.UNDEFINED) {
|
if (owner == ShortcutOwner.UNDEFINED) {
|
||||||
@@ -192,7 +193,7 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
private val ourMembers: MutableMap<Int, Column> = HashMap()
|
private val ourMembers: MutableMap<Int, Column> = HashMap()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
for (column in values()) {
|
for (column in entries) {
|
||||||
ourMembers[column.index] = column
|
ourMembers[column.index] = column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,7 +225,7 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getColumnCount(): Int {
|
override fun getColumnCount(): Int {
|
||||||
return Column.values().size
|
return Column.entries.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
|
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
|
||||||
@@ -294,19 +295,21 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
|
|
||||||
private class CopyForRcAction(
|
private class CopyForRcAction(
|
||||||
private val myModel: VimShortcutConflictsTable.Model,
|
private val myModel: VimShortcutConflictsTable.Model,
|
||||||
) : DumbAwareActionButton(
|
) : DumbAwareAction(
|
||||||
"Copy Config for .ideavimrc",
|
"Copy Config for .ideavimrc",
|
||||||
"Copy config for .ideavimrc in sethandler format",
|
"Copy config for .ideavimrc in sethandler format",
|
||||||
AllIcons.Actions.Copy,
|
AllIcons.Actions.Copy,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun updateButton(e: AnActionEvent) {
|
override fun update(e: AnActionEvent) {
|
||||||
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
||||||
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
||||||
}
|
}
|
||||||
e.presentation.isEnabled = enabled
|
e.presentation.isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
|
||||||
|
|
||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val stringBuilder = StringBuilder()
|
val stringBuilder = StringBuilder()
|
||||||
for (row in myModel.rows) {
|
for (row in myModel.rows) {
|
||||||
@@ -328,14 +331,16 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
class ResetHandlersAction(
|
class ResetHandlersAction(
|
||||||
private val myModel: VimShortcutConflictsTable.Model,
|
private val myModel: VimShortcutConflictsTable.Model,
|
||||||
private val myTable: VimShortcutConflictsTable,
|
private val myTable: VimShortcutConflictsTable,
|
||||||
) : DumbAwareActionButton("Reset Handlers", "Reset handlers", AllIcons.General.Reset) {
|
) : DumbAwareAction("Reset Handlers", "Reset handlers", AllIcons.General.Reset) {
|
||||||
override fun updateButton(e: AnActionEvent) {
|
override fun update(e: AnActionEvent) {
|
||||||
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
||||||
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
||||||
}
|
}
|
||||||
e.presentation.isEnabled = enabled
|
e.presentation.isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
|
||||||
|
|
||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
TableUtil.stopEditing(myTable)
|
TableUtil.stopEditing(myTable)
|
||||||
for (row in myModel.rows) {
|
for (row in myModel.rows) {
|
||||||
|
@@ -121,16 +121,11 @@ public class ExTextField extends JTextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setType(@NotNull String type) {
|
void setType(@NotNull String type) {
|
||||||
String hkey = null;
|
String hkey = switch (type.charAt(0)) {
|
||||||
switch (type.charAt(0)) {
|
case '/', '?' -> HistoryConstants.SEARCH;
|
||||||
case '/':
|
case ':' -> HistoryConstants.COMMAND;
|
||||||
case '?':
|
default -> null;
|
||||||
hkey = HistoryConstants.SEARCH;
|
};
|
||||||
break;
|
|
||||||
case ':':
|
|
||||||
hkey = HistoryConstants.COMMAND;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hkey != null) {
|
if (hkey != null) {
|
||||||
history = VimPlugin.getHistory().getEntries(hkey, 0, 0);
|
history = VimPlugin.getHistory().getEntries(hkey, 0, 0);
|
||||||
@@ -140,7 +135,7 @@ public class ExTextField extends JTextField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the current text for use in filtering history. Required for scrolling through multiple history entries
|
* Stores the current text for use in filtering history. Required for scrolling through multiple history entries
|
||||||
*
|
* <p>
|
||||||
* Called whenever the text is changed, either by typing, or by special characters altering the text (e.g. Delete)
|
* Called whenever the text is changed, either by typing, or by special characters altering the text (e.g. Delete)
|
||||||
*/
|
*/
|
||||||
void saveLastEntry() {
|
void saveLastEntry() {
|
||||||
@@ -304,7 +299,10 @@ public class ExTextField extends JTextField {
|
|||||||
*/
|
*/
|
||||||
void cancel() {
|
void cancel() {
|
||||||
clearCurrentAction();
|
clearCurrentAction();
|
||||||
VimPlugin.getProcess().cancelExEntry(new IjVimEditor(EditorHolderService.getInstance().getEditor()), true);
|
Editor editor = EditorHolderService.getInstance().getEditor();
|
||||||
|
if (editor != null) {
|
||||||
|
VimPlugin.getProcess().cancelExEntry(new IjVimEditor(editor), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentAction(@NotNull MultiStepAction action, char pendingIndicator) {
|
public void setCurrentAction(@NotNull MultiStepAction action, char pendingIndicator) {
|
||||||
@@ -322,7 +320,7 @@ public class ExTextField extends JTextField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Text to show while composing a digraph or inserting a literal or register
|
* Text to show while composing a digraph or inserting a literal or register
|
||||||
*
|
* <p>
|
||||||
* The prompt character is inserted directly into the text of the text field, rather than drawn over the top of the
|
* The prompt character is inserted directly into the text of the text field, rather than drawn over the top of the
|
||||||
* current character. When the action has been completed, the new character(s) are either inserted or overwritten,
|
* current character. When the action has been completed, the new character(s) are either inserted or overwritten,
|
||||||
* depending on the insert/overwrite status of the text field. This mimics Vim's behaviour.
|
* depending on the insert/overwrite status of the text field. This mimics Vim's behaviour.
|
||||||
@@ -491,7 +489,7 @@ public class ExTextField extends JTextField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the bounds of the caret and repaints those bounds.
|
* Updates the bounds of the caret and repaints those bounds.
|
||||||
*
|
* <p>
|
||||||
* This method is not guaranteed to be called before paint(). The bounds are for use by repaint().
|
* This method is not guaranteed to be called before paint(). The bounds are for use by repaint().
|
||||||
*
|
*
|
||||||
* @param r The current location of the caret, usually provided by MapToView. The x and y appear to be the upper
|
* @param r The current location of the caret, usually provided by MapToView. The x and y appear to be the upper
|
||||||
|
@@ -153,7 +153,7 @@ public class ModeWidgetPopup : AnAction() {
|
|||||||
group {
|
group {
|
||||||
row {
|
row {
|
||||||
label(MessageHelper.getMessage("widget.mode.popup.field.theme"))
|
label(MessageHelper.getMessage("widget.mode.popup.field.theme"))
|
||||||
comboBox(ModeWidgetTheme.values().toList()).bindItem(modeColors::theme.toNullableProperty())
|
comboBox(ModeWidgetTheme.entries).bindItem(modeColors::theme.toNullableProperty())
|
||||||
}
|
}
|
||||||
row { browserLink("Suggest your theme", "https://youtrack.jetbrains.com/issue/VIM-1377/Normal-mode-needs-to-be-more-obvious") }
|
row { browserLink("Suggest your theme", "https://youtrack.jetbrains.com/issue/VIM-1377/Normal-mode-needs-to-be-more-obvious") }
|
||||||
}.topGap(TopGap.NONE).visibleIf(!advancedSettings.selected)
|
}.topGap(TopGap.NONE).visibleIf(!advancedSettings.selected)
|
||||||
@@ -360,7 +360,7 @@ public enum class ModeWidgetTheme(private var value: String) {
|
|||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
public fun parseString(string: String): ModeWidgetTheme? {
|
public fun parseString(string: String): ModeWidgetTheme? {
|
||||||
return ModeWidgetTheme.values().firstOrNull { it.value == string }
|
return entries.firstOrNull { it.value == string }
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getDefaultTheme(): ModeWidgetTheme = TERM
|
public fun getDefaultTheme(): ModeWidgetTheme = TERM
|
||||||
|
@@ -8,24 +8,20 @@
|
|||||||
|
|
||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MotionGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ScrollGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ScrollGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimScrollGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimScrollGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimChangeGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimChangeGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.CommandGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimMarkServiceImpl"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimMarkServiceImpl"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimMarkService"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimMarkService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimJumpServiceImpl"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimJumpServiceImpl"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimJumpService"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimJumpService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.register.VimRegisterGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.register.VimRegisterGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.XMLGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.FileGroup"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.FileGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimProcessGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimProcessGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MacroGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimDigraphGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimDigraphGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
|
||||||
@@ -38,7 +34,6 @@
|
|||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimVisualMotionGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimVisualMotionGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.yank.YankGroupBase"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.yank.YankGroupBase"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.copy.PutGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.vimscript.services.IjVariableService"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.vimscript.services.IjVariableService"
|
||||||
serviceInterface="com.maddyhome.idea.vim.vimscript.services.VariableService"/>
|
serviceInterface="com.maddyhome.idea.vim.vimscript.services.VariableService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjStatisticsService"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjStatisticsService"
|
||||||
@@ -53,6 +48,5 @@
|
|||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjVimSystemInfoService"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjVimSystemInfoService"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.SystemInfoService"/>
|
serviceInterface="com.maddyhome.idea.vim.api.SystemInfoService"/>
|
||||||
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
@@ -62,7 +62,6 @@
|
|||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
||||||
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
|
||||||
<projectService serviceImplementation="com.maddyhome.idea.vim.group.LastTabService"/>
|
<projectService serviceImplementation="com.maddyhome.idea.vim.group.LastTabService"/>
|
||||||
<statusBarWidgetFactory id="IdeaVimMode" implementation="com.maddyhome.idea.vim.ui.widgets.mode.ModeWidgetFactory" order="last, before Memory"/>
|
<statusBarWidgetFactory id="IdeaVimMode" implementation="com.maddyhome.idea.vim.ui.widgets.mode.ModeWidgetFactory" order="last, before Memory"/>
|
||||||
<statusBarWidgetFactory id="IdeaVim-Icon" implementation="com.maddyhome.idea.vim.ui.StatusBarIconFactory" order="last, before IdeaVimMode"/>
|
<statusBarWidgetFactory id="IdeaVim-Icon" implementation="com.maddyhome.idea.vim.ui.StatusBarIconFactory" order="last, before IdeaVimMode"/>
|
||||||
|
@@ -137,7 +137,7 @@ widget.mode.popup.tab.dark=Dark Theme
|
|||||||
widget.mode.popup.color.instruction=Use HEX color values for exact colors; use v:status_bar_bg to use your IDE's status bar background color and v:status_bar_fg for the foreground
|
widget.mode.popup.color.instruction=Use HEX color values for exact colors; use v:status_bar_bg to use your IDE's status bar background color and v:status_bar_fg for the foreground
|
||||||
widget.mode.popup.field.theme=Widget theme:
|
widget.mode.popup.field.theme=Widget theme:
|
||||||
widget.mode.popup.field.advanced.settings=Full color customization (advanced)
|
widget.mode.popup.field.advanced.settings=Full color customization (advanced)
|
||||||
widget.mode.popup.group.title.full.customization=Full customization
|
widget.mode.popup.group.title.full.customization=Full Customization
|
||||||
widget.mode.popup.group.normal.title=Normal Mode
|
widget.mode.popup.group.normal.title=Normal Mode
|
||||||
widget.mode.popup.group.insert.title=Insert Mode
|
widget.mode.popup.group.insert.title=Insert Mode
|
||||||
widget.mode.popup.group.replace.title=Replace Mode
|
widget.mode.popup.group.replace.title=Replace Mode
|
||||||
|
@@ -9,10 +9,10 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -15,6 +15,7 @@ import com.maddyhome.idea.vim.key.MappingOwner
|
|||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class RepeatActionTest : VimTestCase() {
|
class RepeatActionTest : VimTestCase() {
|
||||||
@@ -110,4 +111,20 @@ class RepeatActionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled("This test throws `Recursive runForEachCaret invocations are not allowed`")
|
||||||
|
fun `repeat command with execution of ij action`() {
|
||||||
|
doTest(
|
||||||
|
"c<C-End><C-I><esc>.",
|
||||||
|
"""
|
||||||
|
${c}1234567890
|
||||||
|
${c}1234567890
|
||||||
|
""".trimIndent(),
|
||||||
|
"""
|
||||||
|
${c}1234567890
|
||||||
|
${c}1234567890
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,8 +11,8 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.key.MappingOwner
|
import com.maddyhome.idea.vim.key.MappingOwner
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2023 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.plugins.ideavim.action.change
|
||||||
|
|
||||||
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
import org.junit.jupiter.api.Disabled
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
class OperatorActionTest : VimTestCase() {
|
||||||
|
@Test
|
||||||
|
fun `test operator action throws error if operatorfunc is empty`() {
|
||||||
|
doTest("g@w", "lorem ipsum", "lorem ipsum")
|
||||||
|
assertPluginErrorMessageContains("E774: 'operatorfunc' is empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action throws error if operatorfunc is name of unknown function`() {
|
||||||
|
doTest("g@w", "lorem ipsum", "lorem ipsum") {
|
||||||
|
enterCommand("set operatorfunc=Foo")
|
||||||
|
}
|
||||||
|
assertPluginErrorMessageContains("E117: Unknown function: Foo")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action with function name`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"xxxxx ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
executeVimscript("""function! Redact(type)
|
||||||
|
| execute "normal `[v`]rx"
|
||||||
|
|endfunction
|
||||||
|
""".trimMargin())
|
||||||
|
enterCommand("noremap gx :set opfunc=Redact<CR>g@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action with character wise motion`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"charlorem ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
executeVimscript("""function! Redact(type)
|
||||||
|
| execute "normal i" . a:type
|
||||||
|
|endfunction
|
||||||
|
""".trimMargin())
|
||||||
|
enterCommand("noremap gx :set opfunc=Redact<CR>g@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action with linewise motion`() {
|
||||||
|
doTest("Vgx",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"linelorem ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
executeVimscript("""function! Redact(type)
|
||||||
|
| execute "normal i" . a:type
|
||||||
|
|endfunction
|
||||||
|
""".trimMargin())
|
||||||
|
enterCommand("noremap gx <Esc>:set opfunc=Redact<CR>gvg@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action with blockwise motion`() {
|
||||||
|
doTest("<C-V>gx",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"blocklorem ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
executeVimscript("""function! Redact(type)
|
||||||
|
| execute "normal i" . a:type
|
||||||
|
|endfunction
|
||||||
|
""".trimMargin())
|
||||||
|
enterCommand("noremap gx <Esc>:set opfunc=Redact<CR>gvg@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action with function`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"xxxxx ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
executeVimscript("""function! Redact(type)
|
||||||
|
| execute "normal `[v`]rx"
|
||||||
|
|endfunction
|
||||||
|
""".trimMargin())
|
||||||
|
enterCommand("noremap gx :set opfunc=function('Redact')<CR>g@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action throws error with unknown function`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"lorem ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
enterCommand("noremap gx :set opfunc=function('Foo')<CR>g@")
|
||||||
|
}
|
||||||
|
assertPluginErrorMessageContains("E117: Unknown function: Foo")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator function with funcref`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"xxxxx ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
executeVimscript("""function! Redact(type)
|
||||||
|
| execute "normal `[v`]rx"
|
||||||
|
|endfunction
|
||||||
|
""".trimMargin())
|
||||||
|
enterCommand("noremap gx :set opfunc=funcref('Redact')<CR>g@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test operator action throws error with unknown function ref`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"lorem ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
enterCommand("noremap gx :set opfunc=funcref('Foo')<CR>g@")
|
||||||
|
}
|
||||||
|
assertPluginErrorMessageContains("E117: Unknown function: Foo")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled(":set does not correctly parse the quotes in the lambda syntax")
|
||||||
|
// The parser is treating the second double-quote char as a comment. The argument to the command is parsed as:
|
||||||
|
// opfunc={ arg -> execute "`[v`]rx
|
||||||
|
// The map command is properly handled - the `<CR>g@` is correctly understood, and the full lambda is passed to the
|
||||||
|
// parser, but the parser does not fully handle the text
|
||||||
|
fun `test operator function with lambda`() {
|
||||||
|
doTest("gxe",
|
||||||
|
"lorem ipsum dolor sit amet",
|
||||||
|
"lorem ipsum dolor sit amet"
|
||||||
|
) {
|
||||||
|
enterCommand("noremap gx :set opfunc={ arg -> execute \"`[v`]rx\" }<CR>g@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -10,9 +10,9 @@ package org.jetbrains.plugins.ideavim.action.change
|
|||||||
|
|
||||||
import com.intellij.idea.TestFor
|
import com.intellij.idea.TestFor
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.group.visual.IdeaSelectionControl
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.group.visual.IdeaSelectionControl
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -13,10 +13,10 @@ import com.intellij.notification.EventLog
|
|||||||
import com.intellij.notification.Notification
|
import com.intellij.notification.Notification
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.group.NotificationService
|
import com.maddyhome.idea.vim.group.NotificationService
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.impl.OptionTest
|
import org.jetbrains.plugins.ideavim.impl.OptionTest
|
||||||
|
@@ -18,11 +18,11 @@ import com.intellij.testFramework.ExtensionTestUtil
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -13,9 +13,9 @@ import com.intellij.ide.CopyPasteManagerEx
|
|||||||
import com.intellij.openapi.ide.CopyPasteManager
|
import com.intellij.openapi.ide.CopyPasteManager
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -12,11 +12,11 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
|
@@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
|
@@ -12,11 +12,11 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -12,8 +12,8 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -12,8 +12,8 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -11,9 +11,9 @@ import com.intellij.idea.TestFor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -11,9 +11,9 @@ import com.intellij.idea.TestFor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -12,9 +12,9 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -8,11 +8,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.search
|
package org.jetbrains.plugins.ideavim.action.motion.search
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.getVisualLineCount
|
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class SearchAgainNextActionTest : VimTestCase() {
|
class SearchAgainNextActionTest : VimTestCase() {
|
||||||
@Test
|
@Test
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.select
|
package org.jetbrains.plugins.ideavim.action.motion.select
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -12,9 +12,9 @@ package org.jetbrains.plugins.ideavim.action.motion.select
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.updown
|
package org.jetbrains.plugins.ideavim.action.motion.updown
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.updown
|
package org.jetbrains.plugins.ideavim.action.motion.updown
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.updown
|
package org.jetbrains.plugins.ideavim.action.motion.updown
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.updown
|
package org.jetbrains.plugins.ideavim.action.motion.updown
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.visual
|
package org.jetbrains.plugins.ideavim.action.motion.visual
|
||||||
|
|
||||||
|
import com.maddyhome.idea.vim.helper.vimSelectionStart
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.helper.vimSelectionStart
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.scroll
|
package org.jetbrains.plugins.ideavim.action.scroll
|
||||||
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.scroll
|
package org.jetbrains.plugins.ideavim.action.scroll
|
||||||
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.scroll
|
package org.jetbrains.plugins.ideavim.action.scroll
|
||||||
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.scroll
|
package org.jetbrains.plugins.ideavim.action.scroll
|
||||||
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.scroll
|
package org.jetbrains.plugins.ideavim.action.scroll
|
||||||
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.scroll
|
package org.jetbrains.plugins.ideavim.action.scroll
|
||||||
|
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.ex
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.ui.ex.ExDocument
|
import com.maddyhome.idea.vim.ui.ex.ExDocument
|
||||||
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel
|
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -10,11 +10,11 @@ package org.jetbrains.plugins.ideavim.ex
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -28,7 +28,7 @@ class BufferListCommandTest : VimTestCase() {
|
|||||||
|
|
||||||
val output = getInstance(fixture.editor).text
|
val output = getInstance(fixture.editor).text
|
||||||
kotlin.test.assertNotNull<Any>(output)
|
kotlin.test.assertNotNull<Any>(output)
|
||||||
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
|
val displayedLines = output.split("\n".toRegex()).toTypedArray()
|
||||||
kotlin.test.assertEquals(DEFAULT_LS_OUTPUT, displayedLines[0])
|
kotlin.test.assertEquals(DEFAULT_LS_OUTPUT, displayedLines[0])
|
||||||
|
|
||||||
assertPluginError(false)
|
assertPluginError(false)
|
||||||
@@ -41,7 +41,7 @@ class BufferListCommandTest : VimTestCase() {
|
|||||||
|
|
||||||
val output = getInstance(fixture.editor).text
|
val output = getInstance(fixture.editor).text
|
||||||
kotlin.test.assertNotNull<Any>(output)
|
kotlin.test.assertNotNull<Any>(output)
|
||||||
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
|
val displayedLines = output.split("\n".toRegex()).toTypedArray()
|
||||||
kotlin.test.assertEquals(" 1 %a \"/src/aaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt\" line: 1", displayedLines[0])
|
kotlin.test.assertEquals(" 1 %a \"/src/aaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt\" line: 1", displayedLines[0])
|
||||||
|
|
||||||
assertPluginError(false)
|
assertPluginError(false)
|
||||||
@@ -69,7 +69,7 @@ class BufferListCommandTest : VimTestCase() {
|
|||||||
|
|
||||||
val output = getInstance(fixture.editor).text
|
val output = getInstance(fixture.editor).text
|
||||||
kotlin.test.assertNotNull<Any>(output)
|
kotlin.test.assertNotNull<Any>(output)
|
||||||
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
|
val displayedLines = output.split("\n".toRegex()).toTypedArray()
|
||||||
|
|
||||||
// Ignore buffer number because IJ sometimes returns different order of buffers
|
// Ignore buffer number because IJ sometimes returns different order of buffers
|
||||||
val line = displayedLines[0].replaceRange(3, 4, "_")
|
val line = displayedLines[0].replaceRange(3, 4, "_")
|
||||||
@@ -85,7 +85,7 @@ class BufferListCommandTest : VimTestCase() {
|
|||||||
|
|
||||||
val output = getInstance(fixture.editor).text
|
val output = getInstance(fixture.editor).text
|
||||||
kotlin.test.assertNotNull<Any>(output)
|
kotlin.test.assertNotNull<Any>(output)
|
||||||
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
|
val displayedLines = output.split("\n".toRegex()).toTypedArray()
|
||||||
kotlin.test.assertEquals("", displayedLines[0])
|
kotlin.test.assertEquals("", displayedLines[0])
|
||||||
|
|
||||||
assertPluginError(false)
|
assertPluginError(false)
|
||||||
@@ -98,7 +98,7 @@ class BufferListCommandTest : VimTestCase() {
|
|||||||
|
|
||||||
val output = getInstance(fixture.editor).text
|
val output = getInstance(fixture.editor).text
|
||||||
kotlin.test.assertNotNull<Any>(output)
|
kotlin.test.assertNotNull<Any>(output)
|
||||||
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
|
val displayedLines = output.split("\n".toRegex()).toTypedArray()
|
||||||
kotlin.test.assertEquals(DEFAULT_LS_OUTPUT, displayedLines[0])
|
kotlin.test.assertEquals(DEFAULT_LS_OUTPUT, displayedLines[0])
|
||||||
|
|
||||||
assertPluginError(false)
|
assertPluginError(false)
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.history.HistoryConstants
|
import com.maddyhome.idea.vim.history.HistoryConstants
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -10,8 +10,8 @@ package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.register.Register
|
import com.maddyhome.idea.vim.register.Register
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.annotations.TestWithPrimaryClipboard
|
import org.jetbrains.plugins.ideavim.annotations.TestWithPrimaryClipboard
|
||||||
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
||||||
|
@@ -153,7 +153,7 @@ class SetCommandTest : VimTestCase() {
|
|||||||
assertCommandOutput("set",
|
assertCommandOutput("set",
|
||||||
"""
|
"""
|
||||||
|--- Options ---
|
|--- Options ---
|
||||||
| ideastrictmode number relativenumber
|
| number relativenumber
|
||||||
|
|
|
|
||||||
""".trimMargin())
|
""".trimMargin())
|
||||||
}
|
}
|
||||||
@@ -164,22 +164,20 @@ class SetCommandTest : VimTestCase() {
|
|||||||
assertCommandOutput("set all",
|
assertCommandOutput("set all",
|
||||||
"""
|
"""
|
||||||
|--- Options ---
|
|--- Options ---
|
||||||
|noargtextobj ideawrite=all scrolloff=0 notextobj-indent
|
|noargtextobj noincsearch selectmode= notextobj-indent
|
||||||
| closenotebooks noignorecase selectmode= timeout
|
|nocommentary nomatchit shellcmdflag=-x timeout
|
||||||
|nocommentary noincsearch shellcmdflag=-x timeoutlen=1000
|
|nodigraph maxmapdepth=20 shellxescape=@ timeoutlen=1000
|
||||||
|nodigraph nomatchit shellxescape=@ notrackactionids
|
|noexchange more shellxquote={ notrackactionids
|
||||||
|noexchange maxmapdepth=20 shellxquote={ undolevels=1000
|
|nogdefault nomultiple-cursors showcmd undolevels=1000
|
||||||
|nogdefault more showcmd unifyjumps
|
|nohighlightedyank noNERDTree showmode virtualedit=
|
||||||
|nohighlightedyank nomultiple-cursors showmode virtualedit=
|
| history=50 nrformats=hex sidescroll=0 novisualbell
|
||||||
| history=50 noNERDTree sidescroll=0 novisualbell
|
|nohlsearch nonumber sidescrolloff=0 visualdelay=100
|
||||||
|nohlsearch nrformats=hex sidescrolloff=0 visualdelay=100
|
|noideaglobalmode operatorfunc= nosmartcase whichwrap=b,s
|
||||||
|noideaglobalmode nonumber nosmartcase whichwrap=b,s
|
|noideajoin norelativenumber nosneak wrapscan
|
||||||
|noideajoin octopushandler nosneak wrapscan
|
| ideamarks scroll=0 startofline
|
||||||
| ideamarks norelativenumber startofline
|
| ideawrite=all scrolljump=1 nosurround
|
||||||
| ideastrictmode scroll=0 nosurround
|
|noignorecase scrolloff=0 notextobj-entire
|
||||||
|noideatracetime scrolljump=1 notextobj-entire
|
|
||||||
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
||||||
| excommandannotation
|
|
||||||
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
||||||
| ide=IntelliJ IDEA Community Edition
|
| ide=IntelliJ IDEA Community Edition
|
||||||
|noideacopypreprocess
|
|noideacopypreprocess
|
||||||
@@ -213,7 +211,6 @@ class SetCommandTest : VimTestCase() {
|
|||||||
assertCommandOutput("set!",
|
assertCommandOutput("set!",
|
||||||
"""
|
"""
|
||||||
|--- Options ---
|
|--- Options ---
|
||||||
| ideastrictmode
|
|
||||||
| number
|
| number
|
||||||
| relativenumber
|
| relativenumber
|
||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
@@ -227,11 +224,9 @@ class SetCommandTest : VimTestCase() {
|
|||||||
|--- Options ---
|
|--- Options ---
|
||||||
|noargtextobj
|
|noargtextobj
|
||||||
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
||||||
| closenotebooks
|
|
||||||
|nocommentary
|
|nocommentary
|
||||||
|nodigraph
|
|nodigraph
|
||||||
|noexchange
|
|noexchange
|
||||||
| excommandannotation
|
|
||||||
|nogdefault
|
|nogdefault
|
||||||
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
||||||
|nohighlightedyank
|
|nohighlightedyank
|
||||||
@@ -244,8 +239,6 @@ class SetCommandTest : VimTestCase() {
|
|||||||
| ideamarks
|
| ideamarks
|
||||||
| idearefactormode=select
|
| idearefactormode=select
|
||||||
| ideastatusicon=enabled
|
| ideastatusicon=enabled
|
||||||
| ideastrictmode
|
|
||||||
|noideatracetime
|
|
||||||
| ideavimsupport=dialog
|
| ideavimsupport=dialog
|
||||||
| ideawrite=all
|
| ideawrite=all
|
||||||
|noignorecase
|
|noignorecase
|
||||||
@@ -261,7 +254,7 @@ class SetCommandTest : VimTestCase() {
|
|||||||
|noNERDTree
|
|noNERDTree
|
||||||
| nrformats=hex
|
| nrformats=hex
|
||||||
|nonumber
|
|nonumber
|
||||||
| octopushandler
|
| operatorfunc=
|
||||||
|norelativenumber
|
|norelativenumber
|
||||||
|noReplaceWithRegister
|
|noReplaceWithRegister
|
||||||
| scroll=0
|
| scroll=0
|
||||||
@@ -287,7 +280,6 @@ class SetCommandTest : VimTestCase() {
|
|||||||
| timeoutlen=1000
|
| timeoutlen=1000
|
||||||
|notrackactionids
|
|notrackactionids
|
||||||
| undolevels=1000
|
| undolevels=1000
|
||||||
| unifyjumps
|
|
||||||
|novim-paragraph-motion
|
|novim-paragraph-motion
|
||||||
| viminfo='100,<50,s10,h
|
| viminfo='100,<50,s10,h
|
||||||
| virtualedit=
|
| virtualedit=
|
||||||
|
@@ -328,7 +328,6 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
fun `test show all modified global option values`() {
|
fun `test show all modified global option values`() {
|
||||||
assertCommandOutput("setglobal", """
|
assertCommandOutput("setglobal", """
|
||||||
|--- Global option values ---
|
|--- Global option values ---
|
||||||
| ideastrictmode
|
|
||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -338,8 +337,7 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
enterCommand("setglobal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
|
enterCommand("setglobal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
|
||||||
assertCommandOutput("setglobal", """
|
assertCommandOutput("setglobal", """
|
||||||
|--- Global option values ---
|
|--- Global option values ---
|
||||||
| ideastrictmode relativenumber sidescrolloff=10
|
| number relativenumber scrolloff=10 sidescrolloff=10
|
||||||
| number scrolloff=10
|
|
||||||
| nrformats=alpha,hex,octal
|
| nrformats=alpha,hex,octal
|
||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
)
|
)
|
||||||
@@ -350,22 +348,20 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
setOsSpecificOptionsToSafeValues()
|
setOsSpecificOptionsToSafeValues()
|
||||||
assertCommandOutput("setglobal all", """
|
assertCommandOutput("setglobal all", """
|
||||||
|--- Global option values ---
|
|--- Global option values ---
|
||||||
|noargtextobj ideawrite=all scrolloff=0 notextobj-indent
|
|noargtextobj noincsearch selectmode= notextobj-indent
|
||||||
| closenotebooks noignorecase selectmode= timeout
|
|nocommentary nomatchit shellcmdflag=-x timeout
|
||||||
|nocommentary noincsearch shellcmdflag=-x timeoutlen=1000
|
|nodigraph maxmapdepth=20 shellxescape=@ timeoutlen=1000
|
||||||
|nodigraph nomatchit shellxescape=@ notrackactionids
|
|noexchange more shellxquote={ notrackactionids
|
||||||
|noexchange maxmapdepth=20 shellxquote={ undolevels=1000
|
|nogdefault nomultiple-cursors showcmd undolevels=1000
|
||||||
|nogdefault more showcmd unifyjumps
|
|nohighlightedyank noNERDTree showmode virtualedit=
|
||||||
|nohighlightedyank nomultiple-cursors showmode virtualedit=
|
| history=50 nrformats=hex sidescroll=0 novisualbell
|
||||||
| history=50 noNERDTree sidescroll=0 novisualbell
|
|nohlsearch nonumber sidescrolloff=0 visualdelay=100
|
||||||
|nohlsearch nrformats=hex sidescrolloff=0 visualdelay=100
|
|noideaglobalmode operatorfunc= nosmartcase whichwrap=b,s
|
||||||
|noideaglobalmode nonumber nosmartcase whichwrap=b,s
|
|noideajoin norelativenumber nosneak wrapscan
|
||||||
|noideajoin octopushandler nosneak wrapscan
|
| ideamarks scroll=0 startofline
|
||||||
| ideamarks norelativenumber startofline
|
| ideawrite=all scrolljump=1 nosurround
|
||||||
| ideastrictmode scroll=0 nosurround
|
|noignorecase scrolloff=0 notextobj-entire
|
||||||
|noideatracetime scrolljump=1 notextobj-entire
|
|
||||||
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
||||||
| excommandannotation
|
|
||||||
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
||||||
| ide=IntelliJ IDEA Community Edition
|
| ide=IntelliJ IDEA Community Edition
|
||||||
|noideacopypreprocess
|
|noideacopypreprocess
|
||||||
@@ -397,7 +393,20 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
fun `test show all modified global option values in single column`() {
|
fun `test show all modified global option values in single column`() {
|
||||||
assertCommandOutput("setglobal!", """
|
assertCommandOutput("setglobal!", """
|
||||||
|--- Global option values ---
|
|--- Global option values ---
|
||||||
| ideastrictmode
|
|""".trimMargin()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `test show all modified global option values in single column 2`() {
|
||||||
|
enterCommand("setglobal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
|
||||||
|
assertCommandOutput("setglobal!", """
|
||||||
|
|--- Global option values ---
|
||||||
|
| nrformats=alpha,hex,octal
|
||||||
|
| number
|
||||||
|
| relativenumber
|
||||||
|
| scrolloff=10
|
||||||
|
| sidescrolloff=10
|
||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -409,11 +418,9 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
|--- Global option values ---
|
|--- Global option values ---
|
||||||
|noargtextobj
|
|noargtextobj
|
||||||
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
||||||
| closenotebooks
|
|
||||||
|nocommentary
|
|nocommentary
|
||||||
|nodigraph
|
|nodigraph
|
||||||
|noexchange
|
|noexchange
|
||||||
| excommandannotation
|
|
||||||
|nogdefault
|
|nogdefault
|
||||||
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
||||||
|nohighlightedyank
|
|nohighlightedyank
|
||||||
@@ -426,8 +433,6 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
| ideamarks
|
| ideamarks
|
||||||
| idearefactormode=select
|
| idearefactormode=select
|
||||||
| ideastatusicon=enabled
|
| ideastatusicon=enabled
|
||||||
| ideastrictmode
|
|
||||||
|noideatracetime
|
|
||||||
| ideavimsupport=dialog
|
| ideavimsupport=dialog
|
||||||
| ideawrite=all
|
| ideawrite=all
|
||||||
|noignorecase
|
|noignorecase
|
||||||
@@ -443,7 +448,7 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
|noNERDTree
|
|noNERDTree
|
||||||
| nrformats=hex
|
| nrformats=hex
|
||||||
|nonumber
|
|nonumber
|
||||||
| octopushandler
|
| operatorfunc=
|
||||||
|norelativenumber
|
|norelativenumber
|
||||||
|noReplaceWithRegister
|
|noReplaceWithRegister
|
||||||
| scroll=0
|
| scroll=0
|
||||||
@@ -469,7 +474,6 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
| timeoutlen=1000
|
| timeoutlen=1000
|
||||||
|notrackactionids
|
|notrackactionids
|
||||||
| undolevels=1000
|
| undolevels=1000
|
||||||
| unifyjumps
|
|
||||||
|novim-paragraph-motion
|
|novim-paragraph-motion
|
||||||
| viminfo='100,<50,s10,h
|
| viminfo='100,<50,s10,h
|
||||||
| virtualedit=
|
| virtualedit=
|
||||||
@@ -491,4 +495,4 @@ class SetglobalCommandTest : VimTestCase() {
|
|||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -355,8 +355,7 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
fun `test show all modified local option and unset global-local values`() {
|
fun `test show all modified local option and unset global-local values`() {
|
||||||
assertCommandOutput("setlocal", """
|
assertCommandOutput("setlocal", """
|
||||||
|--- Local option values ---
|
|--- Local option values ---
|
||||||
|--ideajoin ideastrictmode sidescrolloff=-1
|
|--ideajoin idearefactormode= scrolloff=-1 sidescrolloff=-1
|
||||||
| idearefactormode= scrolloff=-1
|
|
||||||
|--ideacopypreprocess
|
|--ideacopypreprocess
|
||||||
| undolevels=-123456
|
| undolevels=-123456
|
||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
@@ -368,8 +367,8 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
enterCommand("setlocal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
|
enterCommand("setlocal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
|
||||||
assertCommandOutput("setlocal", """
|
assertCommandOutput("setlocal", """
|
||||||
|--- Local option values ---
|
|--- Local option values ---
|
||||||
|--ideajoin ideastrictmode relativenumber sidescrolloff=10
|
|--ideajoin number scrolloff=10
|
||||||
| idearefactormode= number scrolloff=10
|
| idearefactormode= relativenumber sidescrolloff=10
|
||||||
|--ideacopypreprocess
|
|--ideacopypreprocess
|
||||||
| nrformats=alpha,hex,octal
|
| nrformats=alpha,hex,octal
|
||||||
| undolevels=-123456
|
| undolevels=-123456
|
||||||
@@ -382,22 +381,20 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
setOsSpecificOptionsToSafeValues()
|
setOsSpecificOptionsToSafeValues()
|
||||||
assertCommandOutput("setlocal all", """
|
assertCommandOutput("setlocal all", """
|
||||||
|--- Local option values ---
|
|--- Local option values ---
|
||||||
|noargtextobj noideatracetime scrolljump=1 notextobj-entire
|
|noargtextobj noignorecase scrolloff=-1 notextobj-entire
|
||||||
| closenotebooks ideawrite=all scrolloff=-1 notextobj-indent
|
|nocommentary noincsearch selectmode= notextobj-indent
|
||||||
|nocommentary noignorecase selectmode= timeout
|
|nodigraph nomatchit shellcmdflag=-x timeout
|
||||||
|nodigraph noincsearch shellcmdflag=-x timeoutlen=1000
|
|noexchange maxmapdepth=20 shellxescape=@ timeoutlen=1000
|
||||||
|noexchange nomatchit shellxescape=@ notrackactionids
|
|nogdefault more shellxquote={ notrackactionids
|
||||||
|nogdefault maxmapdepth=20 shellxquote={ unifyjumps
|
|nohighlightedyank nomultiple-cursors showcmd virtualedit=
|
||||||
|nohighlightedyank more showcmd virtualedit=
|
| history=50 noNERDTree showmode novisualbell
|
||||||
| history=50 nomultiple-cursors showmode novisualbell
|
|nohlsearch nrformats=hex sidescroll=0 visualdelay=100
|
||||||
|nohlsearch noNERDTree sidescroll=0 visualdelay=100
|
|noideaglobalmode nonumber sidescrolloff=-1 whichwrap=b,s
|
||||||
|noideaglobalmode nrformats=hex sidescrolloff=-1 whichwrap=b,s
|
|--ideajoin operatorfunc= nosmartcase wrapscan
|
||||||
|--ideajoin nonumber nosmartcase wrapscan
|
| ideamarks norelativenumber nosneak
|
||||||
| ideamarks octopushandler nosneak
|
| idearefactormode= scroll=0 startofline
|
||||||
| idearefactormode= norelativenumber startofline
|
| ideawrite=all scrolljump=1 nosurround
|
||||||
| ideastrictmode scroll=0 nosurround
|
|
||||||
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
||||||
| excommandannotation
|
|
||||||
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
||||||
| ide=IntelliJ IDEA Community Edition
|
| ide=IntelliJ IDEA Community Edition
|
||||||
|--ideacopypreprocess
|
|--ideacopypreprocess
|
||||||
@@ -432,7 +429,6 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
|--ideacopypreprocess
|
|--ideacopypreprocess
|
||||||
|--ideajoin
|
|--ideajoin
|
||||||
| idearefactormode=
|
| idearefactormode=
|
||||||
| ideastrictmode
|
|
||||||
| scrolloff=-1
|
| scrolloff=-1
|
||||||
| sidescrolloff=-1
|
| sidescrolloff=-1
|
||||||
| undolevels=-123456
|
| undolevels=-123456
|
||||||
@@ -447,11 +443,9 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
|--- Local option values ---
|
|--- Local option values ---
|
||||||
|noargtextobj
|
|noargtextobj
|
||||||
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
| clipboard=ideaput,autoselect,exclude:cons\|linux
|
||||||
| closenotebooks
|
|
||||||
|nocommentary
|
|nocommentary
|
||||||
|nodigraph
|
|nodigraph
|
||||||
|noexchange
|
|noexchange
|
||||||
| excommandannotation
|
|
||||||
|nogdefault
|
|nogdefault
|
||||||
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|
||||||
|nohighlightedyank
|
|nohighlightedyank
|
||||||
@@ -464,8 +458,6 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
| ideamarks
|
| ideamarks
|
||||||
| idearefactormode=
|
| idearefactormode=
|
||||||
| ideastatusicon=enabled
|
| ideastatusicon=enabled
|
||||||
| ideastrictmode
|
|
||||||
|noideatracetime
|
|
||||||
| ideavimsupport=dialog
|
| ideavimsupport=dialog
|
||||||
| ideawrite=all
|
| ideawrite=all
|
||||||
|noignorecase
|
|noignorecase
|
||||||
@@ -481,7 +473,7 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
|noNERDTree
|
|noNERDTree
|
||||||
| nrformats=hex
|
| nrformats=hex
|
||||||
|nonumber
|
|nonumber
|
||||||
| octopushandler
|
| operatorfunc=
|
||||||
|norelativenumber
|
|norelativenumber
|
||||||
|noReplaceWithRegister
|
|noReplaceWithRegister
|
||||||
| scroll=0
|
| scroll=0
|
||||||
@@ -507,7 +499,6 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
| timeoutlen=1000
|
| timeoutlen=1000
|
||||||
|notrackactionids
|
|notrackactionids
|
||||||
| undolevels=-123456
|
| undolevels=-123456
|
||||||
| unifyjumps
|
|
||||||
|novim-paragraph-motion
|
|novim-paragraph-motion
|
||||||
| viminfo='100,<50,s10,h
|
| viminfo='100,<50,s10,h
|
||||||
| virtualedit=
|
| virtualedit=
|
||||||
@@ -529,4 +520,4 @@ class SetlocalCommandTest : VimTestCase() {
|
|||||||
|""".trimMargin()
|
|""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user