summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/me/kyren223/trident/actions/TridentAppendAction.kt32
-rw-r--r--src/main/kotlin/me/kyren223/trident/actions/TridentListAction.kt26
-rw-r--r--src/main/kotlin/me/kyren223/trident/actions/TridentListSelectAction.kt22
-rw-r--r--src/main/kotlin/me/kyren223/trident/actions/TridentMappingsAction.kt24
-rw-r--r--src/main/kotlin/me/kyren223/trident/actions/TridentSelectAction.kt88
-rw-r--r--src/main/kotlin/me/kyren223/trident/data/Settings.kt66
-rw-r--r--src/main/kotlin/me/kyren223/trident/data/SettingsData.kt350
-rw-r--r--src/main/kotlin/me/kyren223/trident/tests/MappingsExpansionTest.kt82
-rw-r--r--src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt120
-rw-r--r--src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt134
-rw-r--r--src/main/kotlin/me/kyren223/trident/ui/TridentListMenu.kt204
-rw-r--r--src/main/kotlin/me/kyren223/trident/ui/TridentMappingsMenu.kt171
-rw-r--r--src/main/kotlin/me/kyren223/trident/utils/TridentUtils.kt390
-rw-r--r--src/main/kotlin/me/kyren223/trident/utils/Utils.kt42
-rw-r--r--src/main/resources/META-INF/Trident-IdeaVim.xml4
-rw-r--r--src/main/resources/META-INF/plugin.xml264
-rw-r--r--src/main/resources/META-INF/pluginIcon.svg52
17 files changed, 1030 insertions, 1041 deletions
diff --git a/src/main/kotlin/me/kyren223/trident/actions/TridentAppendAction.kt b/src/main/kotlin/me/kyren223/trident/actions/TridentAppendAction.kt
index 1b0d33a..571eb0f 100644
--- a/src/main/kotlin/me/kyren223/trident/actions/TridentAppendAction.kt
+++ b/src/main/kotlin/me/kyren223/trident/actions/TridentAppendAction.kt
@@ -1,16 +1,16 @@
-package me.kyren223.trident.actions
-
-import com.intellij.openapi.actionSystem.AnAction
-import com.intellij.openapi.actionSystem.AnActionEvent
-import com.intellij.openapi.actionSystem.PlatformDataKeys
-import com.intellij.openapi.project.Project
-import com.intellij.openapi.vfs.VirtualFile
-import me.kyren223.trident.utils.TridentList
-
-class TridentAppendAction : AnAction() {
- override fun actionPerformed(e: AnActionEvent) {
- val project: Project = e.project ?: return
- val file: VirtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE) ?: return
- TridentList.append(project, file)
- }
-}
+package me.kyren223.trident.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.actionSystem.PlatformDataKeys
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.vfs.VirtualFile
+import me.kyren223.trident.utils.TridentList
+
+class TridentAppendAction : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val project: Project = e.project ?: return
+ val file: VirtualFile = e.getData(PlatformDataKeys.VIRTUAL_FILE) ?: return
+ TridentList.append(project, file)
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/actions/TridentListAction.kt b/src/main/kotlin/me/kyren223/trident/actions/TridentListAction.kt
index 0d733f3..f37f0aa 100644
--- a/src/main/kotlin/me/kyren223/trident/actions/TridentListAction.kt
+++ b/src/main/kotlin/me/kyren223/trident/actions/TridentListAction.kt
@@ -1,13 +1,13 @@
-package me.kyren223.trident.actions
-
-import com.intellij.openapi.actionSystem.AnAction
-import com.intellij.openapi.actionSystem.AnActionEvent
-import me.kyren223.trident.ui.TridentListMenu
-
-class TridentListAction : AnAction() {
- override fun actionPerformed(e: AnActionEvent) {
- val project = e.project ?: return
- TridentListMenu.open(project)
- }
-
-}
+package me.kyren223.trident.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import me.kyren223.trident.ui.TridentListMenu
+
+class TridentListAction : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val project = e.project ?: return
+ TridentListMenu.open(project)
+ }
+
+}
diff --git a/src/main/kotlin/me/kyren223/trident/actions/TridentListSelectAction.kt b/src/main/kotlin/me/kyren223/trident/actions/TridentListSelectAction.kt
index 1b68a59..4161927 100644
--- a/src/main/kotlin/me/kyren223/trident/actions/TridentListSelectAction.kt
+++ b/src/main/kotlin/me/kyren223/trident/actions/TridentListSelectAction.kt
@@ -1,11 +1,11 @@
-package me.kyren223.trident.actions
-
-import com.intellij.openapi.actionSystem.AnAction
-import com.intellij.openapi.actionSystem.AnActionEvent
-import me.kyren223.trident.ui.TridentListMenu
-
-class TridentListSelectAction : AnAction() {
- override fun actionPerformed(e: AnActionEvent) {
- TridentListMenu.instance?.select()
- }
-}
+package me.kyren223.trident.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import me.kyren223.trident.ui.TridentListMenu
+
+class TridentListSelectAction : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ TridentListMenu.instance?.select()
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/actions/TridentMappingsAction.kt b/src/main/kotlin/me/kyren223/trident/actions/TridentMappingsAction.kt
index b303c9e..77e3a11 100644
--- a/src/main/kotlin/me/kyren223/trident/actions/TridentMappingsAction.kt
+++ b/src/main/kotlin/me/kyren223/trident/actions/TridentMappingsAction.kt
@@ -1,12 +1,12 @@
-package me.kyren223.trident.actions
-
-import com.intellij.openapi.actionSystem.AnAction
-import com.intellij.openapi.actionSystem.AnActionEvent
-import me.kyren223.trident.ui.TridentMappingsMenu
-
-class TridentMappingsAction : AnAction() {
- override fun actionPerformed(e: AnActionEvent) {
- val project = e.project ?: return
- TridentMappingsMenu.open(project)
- }
-}
+package me.kyren223.trident.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import me.kyren223.trident.ui.TridentMappingsMenu
+
+class TridentMappingsAction : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val project = e.project ?: return
+ TridentMappingsMenu.open(project)
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/actions/TridentSelectAction.kt b/src/main/kotlin/me/kyren223/trident/actions/TridentSelectAction.kt
index 60973f2..2eeada3 100644
--- a/src/main/kotlin/me/kyren223/trident/actions/TridentSelectAction.kt
+++ b/src/main/kotlin/me/kyren223/trident/actions/TridentSelectAction.kt
@@ -1,44 +1,44 @@
-package me.kyren223.trident.actions
-
-import com.intellij.openapi.actionSystem.AnAction
-import com.intellij.openapi.actionSystem.AnActionEvent
-import com.intellij.openapi.actionSystem.PlatformDataKeys
-import com.intellij.openapi.fileEditor.FileEditorManager
-import me.kyren223.trident.utils.TridentList
-
-class TridentSelectAction : AnAction() {
- override fun actionPerformed(e: AnActionEvent) {
- val project = e.project ?: return
- val index = when (val actionId = e.actionManager.getId(this)) {
- NEXT -> {
- val file = e.getData(PlatformDataKeys.VIRTUAL_FILE) ?: return
- val current = TridentList.getIndexOfFile(project, file) ?: return
- current + 1
- }
-
- PREV -> {
- val file = e.getData(PlatformDataKeys.VIRTUAL_FILE) ?: return
- val current = TridentList.getIndexOfFile(project, file) ?: return
- current - 1
- }
-
- else -> {
- getIndex(actionId!!)
- }
- }
-
- val file = TridentList.select(project, index) ?: return
- FileEditorManager.getInstance(project).openFile(file, true)
- }
-
- private fun getIndex(actionId: String): Int {
- return actionId.substring(SELECT.length).toInt() - 1
- }
-
- companion object {
- const val NEXT = "TridentSelectNext"
- const val PREV = "TridentSelectPrev"
- const val SELECT = "TridentSelect"
- }
-}
-
+package me.kyren223.trident.actions
+
+import com.intellij.openapi.actionSystem.AnAction
+import com.intellij.openapi.actionSystem.AnActionEvent
+import com.intellij.openapi.actionSystem.PlatformDataKeys
+import com.intellij.openapi.fileEditor.FileEditorManager
+import me.kyren223.trident.utils.TridentList
+
+class TridentSelectAction : AnAction() {
+ override fun actionPerformed(e: AnActionEvent) {
+ val project = e.project ?: return
+ val index = when (val actionId = e.actionManager.getId(this)) {
+ NEXT -> {
+ val file = e.getData(PlatformDataKeys.VIRTUAL_FILE) ?: return
+ val current = TridentList.getIndexOfFile(project, file) ?: return
+ current + 1
+ }
+
+ PREV -> {
+ val file = e.getData(PlatformDataKeys.VIRTUAL_FILE) ?: return
+ val current = TridentList.getIndexOfFile(project, file) ?: return
+ current - 1
+ }
+
+ else -> {
+ getIndex(actionId!!)
+ }
+ }
+
+ val file = TridentList.select(project, index) ?: return
+ FileEditorManager.getInstance(project).openFile(file, true)
+ }
+
+ private fun getIndex(actionId: String): Int {
+ return actionId.substring(SELECT.length).toInt() - 1
+ }
+
+ companion object {
+ const val NEXT = "TridentSelectNext"
+ const val PREV = "TridentSelectPrev"
+ const val SELECT = "TridentSelect"
+ }
+}
+
diff --git a/src/main/kotlin/me/kyren223/trident/data/Settings.kt b/src/main/kotlin/me/kyren223/trident/data/Settings.kt
index e97737c..4c9204a 100644
--- a/src/main/kotlin/me/kyren223/trident/data/Settings.kt
+++ b/src/main/kotlin/me/kyren223/trident/data/Settings.kt
@@ -1,33 +1,33 @@
-package me.kyren223.trident.data
-
-import com.intellij.openapi.application.ApplicationManager
-import com.intellij.openapi.components.*
-import com.intellij.util.xmlb.XmlSerializerUtil
-
-// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-@Service
-@State(name = "me.kyren223.trident.data.SettingsState", storages = [Storage("SdkSettingsPlugin.xml")])
-class SettingsState : PersistentStateComponent<SettingsState?> {
- var width = 800
- var height = 400
- var fontSize = 20
- var enterToSelect = true
- var automaticMapping = AutomaticMapping.Disabled
- var automaticReplacing = AutomaticReplacing.Smart
- var recursiveMapping = false
- var rememberLine = false
- var indexCycling = false
-
- override fun getState(): SettingsState {
- return this
- }
-
- override fun loadState(state: SettingsState) {
- XmlSerializerUtil.copyBean(state, this)
- }
-
- companion object {
- val instance: SettingsState
- get() = ApplicationManager.getApplication().getService(SettingsState::class.java)
- }
-}
+package me.kyren223.trident.data
+
+import com.intellij.openapi.application.ApplicationManager
+import com.intellij.openapi.components.*
+import com.intellij.util.xmlb.XmlSerializerUtil
+
+// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+@Service
+@State(name = "me.kyren223.trident.data.SettingsState", storages = [Storage("SdkSettingsPlugin.xml")])
+class SettingsState : PersistentStateComponent<SettingsState?> {
+ var width = 800
+ var height = 400
+ var fontSize = 20
+ var enterToSelect = true
+ var automaticMapping = AutomaticMapping.Disabled
+ var automaticReplacing = AutomaticReplacing.Smart
+ var recursiveMapping = false
+ var rememberLine = false
+ var indexCycling = false
+
+ override fun getState(): SettingsState {
+ return this
+ }
+
+ override fun loadState(state: SettingsState) {
+ XmlSerializerUtil.copyBean(state, this)
+ }
+
+ companion object {
+ val instance: SettingsState
+ get() = ApplicationManager.getApplication().getService(SettingsState::class.java)
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/data/SettingsData.kt b/src/main/kotlin/me/kyren223/trident/data/SettingsData.kt
index 26cb1d1..49ca322 100644
--- a/src/main/kotlin/me/kyren223/trident/data/SettingsData.kt
+++ b/src/main/kotlin/me/kyren223/trident/data/SettingsData.kt
@@ -1,175 +1,175 @@
-package me.kyren223.trident.data
-
-import com.intellij.openapi.ui.ComboBox
-import com.intellij.ui.JBColor
-import com.intellij.ui.JBIntSpinner
-import com.intellij.ui.components.JBCheckBox
-import com.intellij.ui.components.JBLabel
-import com.intellij.util.ui.FormBuilder
-import com.intellij.util.ui.JBFont
-import javax.swing.JPanel
-
-class SettingsData {
-
- private val minValue = 1
- private val maxValue = 5000
- private val step = 10
-
- val panel: JPanel
-
- private val width = JBIntSpinner(SettingsState.instance.width, minValue, maxValue, step)
- private val height = JBIntSpinner(SettingsState.instance.height, minValue, maxValue, step)
- private val fontSize = JBIntSpinner(SettingsState.instance.fontSize, minValue, maxValue, step)
-
- private val enterToSelect = JBCheckBox(null, SettingsState.instance.enterToSelect)
- private val rememberLine = JBCheckBox(null, SettingsState.instance.rememberLine)
- private val automaticMapping = ComboBox(AutomaticMapping.entries.toTypedArray())
- private val automaticReplacing = ComboBox(AutomaticReplacing.entries.toTypedArray())
- private val recursiveMapping = JBCheckBox(null, SettingsState.instance.recursiveMapping)
- private val indexCycling = JBCheckBox(null, SettingsState.instance.indexCycling)
-
- init {
- automaticMapping.selectedItem = SettingsState.instance.automaticMapping
- automaticReplacing.selectedItem = SettingsState.instance.automaticReplacing
-
- panel = FormBuilder.createFormBuilder()
- .addComponent(JBLabel("Popup settings").withFont(JBFont.h4()))
- .addLabeledComponent("Popup width", width)
- .addLabeledComponent("Popup height", height)
- .addLabeledComponent("Popup font size", fontSize)
- .addSeparator()
-
- .addComponent(JBLabel("Trident settings").withFont(JBFont.h4()))
- .addLabeledComponent("Enter to select item", enterToSelect)
- .addComponent(desc("If enabled while the TridentList is open, " +
- "pressing enter will select the item in the current line and open the file (if it exists)."))
- .addVerticalGap(step)
-
- .addLabeledComponent("Automatic mapping (when possible)", automaticMapping)
- .addComponent(desc("Disabled - adds the full file path to the Trident Mappings."))
- .addComponent(desc("Filename - Adds the filename (with extension)."))
- .addComponent(desc("Filename (no extension) - Adds the filename (without extension)."))
- .addVerticalGap(step)
-
- .addLabeledComponent("Automatic replacing (when possible)", automaticReplacing)
- .addComponent(desc("Disabled - Keeps the full file path."))
- .addComponent(desc("Exact - Replaces the full path if an exact match is found."))
- .addComponent(desc("Smart - Like exact but if no exact match found, " +
- "it will try to make the path shorter."))
- .addVerticalGap(step)
-
- .addLabeledComponent("Recursive mapping", recursiveMapping)
- .addComponent(desc("If enabled, when expanding a mapping for a path, " +
- "each entry will be expanded recursively."))
- .addComponent(desc("This allows mapping entries to be nested (include other mappings)."))
- .addVerticalGap(step)
-
- .addLabeledComponent("Remember last line", rememberLine)
- .addComponent(desc("If enabled, the current line of the TridentList will be remembered " +
- "and will be selected when the TridentList is opened."))
- .addComponent(desc("Note, this does not persist across restarts, it's run-time only."))
-
- .addLabeledComponent("Index cycling", indexCycling)
- .addComponent(desc("If enabled, indexes will be cyclic, " +
- "For example if you have 3 files and hotkey to 4, it'll cycle to 1."))
-
- .addComponentFillVertically(JPanel(), 0)
- .panel
- }
-
- private fun desc(text: String): JBLabel {
- val label = JBLabel(text).withFont(JBFont.small())
- label.foreground = JBColor.GRAY
- return label
- }
-
- fun getWidth(): Int {
- return width.number
- }
-
- fun getHeight(): Int {
- return height.number
- }
-
- fun getFontSize(): Int {
- return fontSize.number
- }
-
- fun getEnterToSelect(): Boolean {
- return enterToSelect.isSelected
- }
-
- fun setWidth(width: Int) {
- this.width.number = width
- }
-
- fun setHeight(height: Int) {
- this.height.number = height
- }
-
- fun setFontSize(fontSize: Int) {
- this.fontSize.number = fontSize
- }
-
- fun setEnterToSelect(enter: Boolean) {
- this.enterToSelect.isSelected = enter
- }
-
- fun getAutomaticMapping(): AutomaticMapping {
- return automaticMapping.selectedItem as AutomaticMapping
- }
-
- fun setAutomaticMapping(automaticMapping: AutomaticMapping) {
- this.automaticMapping.selectedItem = automaticMapping
- }
-
- fun getAutomaticReplacing(): AutomaticReplacing {
- return automaticReplacing.selectedItem as AutomaticReplacing
- }
-
- fun setAutomaticReplacing(automaticReplacing: AutomaticReplacing) {
- this.automaticReplacing.selectedItem = automaticReplacing
- }
-
- fun getRememberLine(): Boolean {
- return rememberLine.isSelected
- }
-
- fun setRememberLine(rememberLine: Boolean) {
- this.rememberLine.isSelected = rememberLine
- }
-
- fun getRecursiveMapping(): Boolean {
- return recursiveMapping.isSelected
- }
-
- fun setRecursiveMapping(recursiveMapping: Boolean) {
- this.recursiveMapping.isSelected = recursiveMapping
- }
-
- fun getIndexCycling(): Boolean {
- return indexCycling.isSelected
- }
-
- fun setIndexCycling(indexCycling: Boolean) {
- this.indexCycling.isSelected = indexCycling
- }
-}
-
-enum class AutomaticMapping {
- Disabled,
- Filename,
- FilenameNoExtension,
- ;
-
- override fun toString(): String {
- if (this == FilenameNoExtension) return "Filename (without extension)"
- return super.toString()
- }
-}
-
-enum class AutomaticReplacing {
- Disabled,
- Exact,
- Smart,
-}
+package me.kyren223.trident.data
+
+import com.intellij.openapi.ui.ComboBox
+import com.intellij.ui.JBColor
+import com.intellij.ui.JBIntSpinner
+import com.intellij.ui.components.JBCheckBox
+import com.intellij.ui.components.JBLabel
+import com.intellij.util.ui.FormBuilder
+import com.intellij.util.ui.JBFont
+import javax.swing.JPanel
+
+class SettingsData {
+
+ private val minValue = 1
+ private val maxValue = 5000
+ private val step = 10
+
+ val panel: JPanel
+
+ private val width = JBIntSpinner(SettingsState.instance.width, minValue, maxValue, step)
+ private val height = JBIntSpinner(SettingsState.instance.height, minValue, maxValue, step)
+ private val fontSize = JBIntSpinner(SettingsState.instance.fontSize, minValue, maxValue, step)
+
+ private val enterToSelect = JBCheckBox(null, SettingsState.instance.enterToSelect)
+ private val rememberLine = JBCheckBox(null, SettingsState.instance.rememberLine)
+ private val automaticMapping = ComboBox(AutomaticMapping.entries.toTypedArray())
+ private val automaticReplacing = ComboBox(AutomaticReplacing.entries.toTypedArray())
+ private val recursiveMapping = JBCheckBox(null, SettingsState.instance.recursiveMapping)
+ private val indexCycling = JBCheckBox(null, SettingsState.instance.indexCycling)
+
+ init {
+ automaticMapping.selectedItem = SettingsState.instance.automaticMapping
+ automaticReplacing.selectedItem = SettingsState.instance.automaticReplacing
+
+ panel = FormBuilder.createFormBuilder()
+ .addComponent(JBLabel("Popup settings").withFont(JBFont.h4()))
+ .addLabeledComponent("Popup width", width)
+ .addLabeledComponent("Popup height", height)
+ .addLabeledComponent("Popup font size", fontSize)
+ .addSeparator()
+
+ .addComponent(JBLabel("Trident settings").withFont(JBFont.h4()))
+ .addLabeledComponent("Enter to select item", enterToSelect)
+ .addComponent(desc("If enabled while the TridentList is open, " +
+ "pressing enter will select the item in the current line and open the file (if it exists)."))
+ .addVerticalGap(step)
+
+ .addLabeledComponent("Automatic mapping (when possible)", automaticMapping)
+ .addComponent(desc("Disabled - adds the full file path to the Trident Mappings."))
+ .addComponent(desc("Filename - Adds the filename (with extension)."))
+ .addComponent(desc("Filename (no extension) - Adds the filename (without extension)."))
+ .addVerticalGap(step)
+
+ .addLabeledComponent("Automatic replacing (when possible)", automaticReplacing)
+ .addComponent(desc("Disabled - Keeps the full file path."))
+ .addComponent(desc("Exact - Replaces the full path if an exact match is found."))
+ .addComponent(desc("Smart - Like exact but if no exact match found, " +
+ "it will try to make the path shorter."))
+ .addVerticalGap(step)
+
+ .addLabeledComponent("Recursive mapping", recursiveMapping)
+ .addComponent(desc("If enabled, when expanding a mapping for a path, " +
+ "each entry will be expanded recursively."))
+ .addComponent(desc("This allows mapping entries to be nested (include other mappings)."))
+ .addVerticalGap(step)
+
+ .addLabeledComponent("Remember last line", rememberLine)
+ .addComponent(desc("If enabled, the current line of the TridentList will be remembered " +
+ "and will be selected when the TridentList is opened."))
+ .addComponent(desc("Note, this does not persist across restarts, it's run-time only."))
+
+ .addLabeledComponent("Index cycling", indexCycling)
+ .addComponent(desc("If enabled, indexes will be cyclic, " +
+ "For example if you have 3 files and hotkey to 4, it'll cycle to 1."))
+
+ .addComponentFillVertically(JPanel(), 0)
+ .panel
+ }
+
+ private fun desc(text: String): JBLabel {
+ val label = JBLabel(text).withFont(JBFont.small())
+ label.foreground = JBColor.GRAY
+ return label
+ }
+
+ fun getWidth(): Int {
+ return width.number
+ }
+
+ fun getHeight(): Int {
+ return height.number
+ }
+
+ fun getFontSize(): Int {
+ return fontSize.number
+ }
+
+ fun getEnterToSelect(): Boolean {
+ return enterToSelect.isSelected
+ }
+
+ fun setWidth(width: Int) {
+ this.width.number = width
+ }
+
+ fun setHeight(height: Int) {
+ this.height.number = height
+ }
+
+ fun setFontSize(fontSize: Int) {
+ this.fontSize.number = fontSize
+ }
+
+ fun setEnterToSelect(enter: Boolean) {
+ this.enterToSelect.isSelected = enter
+ }
+
+ fun getAutomaticMapping(): AutomaticMapping {
+ return automaticMapping.selectedItem as AutomaticMapping
+ }
+
+ fun setAutomaticMapping(automaticMapping: AutomaticMapping) {
+ this.automaticMapping.selectedItem = automaticMapping
+ }
+
+ fun getAutomaticReplacing(): AutomaticReplacing {
+ return automaticReplacing.selectedItem as AutomaticReplacing
+ }
+
+ fun setAutomaticReplacing(automaticReplacing: AutomaticReplacing) {
+ this.automaticReplacing.selectedItem = automaticReplacing
+ }
+
+ fun getRememberLine(): Boolean {
+ return rememberLine.isSelected
+ }
+
+ fun setRememberLine(rememberLine: Boolean) {
+ this.rememberLine.isSelected = rememberLine
+ }
+
+ fun getRecursiveMapping(): Boolean {
+ return recursiveMapping.isSelected
+ }
+
+ fun setRecursiveMapping(recursiveMapping: Boolean) {
+ this.recursiveMapping.isSelected = recursiveMapping
+ }
+
+ fun getIndexCycling(): Boolean {
+ return indexCycling.isSelected
+ }
+
+ fun setIndexCycling(indexCycling: Boolean) {
+ this.indexCycling.isSelected = indexCycling
+ }
+}
+
+enum class AutomaticMapping {
+ Disabled,
+ Filename,
+ FilenameNoExtension,
+ ;
+
+ override fun toString(): String {
+ if (this == FilenameNoExtension) return "Filename (without extension)"
+ return super.toString()
+ }
+}
+
+enum class AutomaticReplacing {
+ Disabled,
+ Exact,
+ Smart,
+}
diff --git a/src/main/kotlin/me/kyren223/trident/tests/MappingsExpansionTest.kt b/src/main/kotlin/me/kyren223/trident/tests/MappingsExpansionTest.kt
index 0b66c4b..7fe33ad 100644
--- a/src/main/kotlin/me/kyren223/trident/tests/MappingsExpansionTest.kt
+++ b/src/main/kotlin/me/kyren223/trident/tests/MappingsExpansionTest.kt
@@ -1,42 +1,42 @@
-package me.kyren223.trident.tests
-
-import org.junit.Test
-
-class MappingsExpansionTest {
- @Test
- fun testExpand() {
- val mappings = mapOf(
- "\$A" to "A",
- "\$BB" to "B",
- "\$CCC" to "C",
- "\$DDD" to "D",
- "\$EEE" to "E",
- "\$FFFFF" to "F",
- "\$GG" to "G",
- "\$UUU" to "U",
- "\$VVVV" to "V",
- "\$LLLLLL" to "L",
- "\$MM" to "M",
- "\$NN" to "N",
- "\$OOO" to "O",
- "\$PPP" to "P",
- "\$QQQQ" to "Q",
- "\$R" to "R",
- "\$WWW" to "W",
- "\$XX" to "X",
- "\$HI" to "H",
- "\$IJ" to "I",
- "\$JetBrains" to "J",
- "\$Krypton" to "K",
- "\$Soft" to "S",
- "\$Tnt" to "T",
- "\$Ycombinator" to "Y",
- "\$Zig" to "Z",
- ).toList().sortedByDescending { it.first.length }
-
- mappings.forEach { (key, value) ->
- println("$key -> $value")
- }
-
- }
+package me.kyren223.trident.tests
+
+import org.junit.Test
+
+class MappingsExpansionTest {
+ @Test
+ fun testExpand() {
+ val mappings = mapOf(
+ "\$A" to "A",
+ "\$BB" to "B",
+ "\$CCC" to "C",
+ "\$DDD" to "D",
+ "\$EEE" to "E",
+ "\$FFFFF" to "F",
+ "\$GG" to "G",
+ "\$UUU" to "U",
+ "\$VVVV" to "V",
+ "\$LLLLLL" to "L",
+ "\$MM" to "M",
+ "\$NN" to "N",
+ "\$OOO" to "O",
+ "\$PPP" to "P",
+ "\$QQQQ" to "Q",
+ "\$R" to "R",
+ "\$WWW" to "W",
+ "\$XX" to "X",
+ "\$HI" to "H",
+ "\$IJ" to "I",
+ "\$JetBrains" to "J",
+ "\$Krypton" to "K",
+ "\$Soft" to "S",
+ "\$Tnt" to "T",
+ "\$Ycombinator" to "Y",
+ "\$Zig" to "Z",
+ ).toList().sortedByDescending { it.first.length }
+
+ mappings.forEach { (key, value) ->
+ println("$key -> $value")
+ }
+
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt b/src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt
index e4ea477..586fef1 100644
--- a/src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt
+++ b/src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt
@@ -1,61 +1,61 @@
-package me.kyren223.trident.tests
-
-import org.junit.Test
-
-class SplitTest {
-
- @Test
- fun testSplit() {
- val filenameAndExtension = "SplitTest.kt"
- val filename = "SplitTest"
- val dotfile = ".ideavimrc"
-
- val split = filenameAndExtension.split(".")
- assert(split.size == 2)
- assert(split[0] == filename)
- assert(split[1] == "kt")
-
- val split2 = filename.split(".")
- assert(split2.size == 1)
- assert(split2[0] == filename)
-
- val split3 = dotfile.split(".")
- assert(split3.size == 2)
- assert(split3[0] == "")
- assert(split3[1] == "ideavimrc")
-
-
- }
-
- @Test
- fun testSplit2() {
- val path = "C:/Users/Owner/Projects/Trident/src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt"
- testPath(path, "SplitTest", "kt")
- testPath("SplitTest.kt", "SplitTest", "kt")
- testPath("SplitTest", "SplitTest", null)
- testPath(".ideavimrc", null, "ideavimrc")
- testPath("build.gradle.kts", "build.gradle", "kts")
-
- }
-
- private fun testPath(path: String, filename: String?, extension: String?) {
-
- val fullFilename = path.split("/").last()
- println("fullFilename: $fullFilename")
- val lastDot = fullFilename.lastIndexOf(".")
- val noExtension = lastDot == -1
-
- val filename2 = if (noExtension) fullFilename else {
- fullFilename.substring(0, lastDot).ifEmpty { null }
- }
- val extension2 = if (noExtension) null else fullFilename.substring(lastDot + 1)
-
- println("filename: $filename")
- println("extension: $extension")
- println("filename2: $filename2")
- println("extension2: $extension2")
-
- assert(filename2 == filename)
- assert(extension2 == extension)
- }
+package me.kyren223.trident.tests
+
+import org.junit.Test
+
+class SplitTest {
+
+ @Test
+ fun testSplit() {
+ val filenameAndExtension = "SplitTest.kt"
+ val filename = "SplitTest"
+ val dotfile = ".ideavimrc"
+
+ val split = filenameAndExtension.split(".")
+ assert(split.size == 2)
+ assert(split[0] == filename)
+ assert(split[1] == "kt")
+
+ val split2 = filename.split(".")
+ assert(split2.size == 1)
+ assert(split2[0] == filename)
+
+ val split3 = dotfile.split(".")
+ assert(split3.size == 2)
+ assert(split3[0] == "")
+ assert(split3[1] == "ideavimrc")
+
+
+ }
+
+ @Test
+ fun testSplit2() {
+ val path = "C:/Users/Owner/Projects/Trident/src/main/kotlin/me/kyren223/trident/tests/SplitTest.kt"
+ testPath(path, "SplitTest", "kt")
+ testPath("SplitTest.kt", "SplitTest", "kt")
+ testPath("SplitTest", "SplitTest", null)
+ testPath(".ideavimrc", null, "ideavimrc")
+ testPath("build.gradle.kts", "build.gradle", "kts")
+
+ }
+
+ private fun testPath(path: String, filename: String?, extension: String?) {
+
+ val fullFilename = path.split("/").last()
+ println("fullFilename: $fullFilename")
+ val lastDot = fullFilename.lastIndexOf(".")
+ val noExtension = lastDot == -1
+
+ val filename2 = if (noExtension) fullFilename else {
+ fullFilename.substring(0, lastDot).ifEmpty { null }
+ }
+ val extension2 = if (noExtension) null else fullFilename.substring(lastDot + 1)
+
+ println("filename: $filename")
+ println("extension: $extension")
+ println("filename2: $filename2")
+ println("extension2: $extension2")
+
+ assert(filename2 == filename)
+ assert(extension2 == extension)
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt b/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt
index f6979b1..085c6f2 100644
--- a/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt
+++ b/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt
@@ -1,67 +1,67 @@
-// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
-package me.kyren223.trident.ui
-
-import com.intellij.openapi.options.Configurable
-import com.intellij.openapi.util.NlsContexts.ConfigurableName
-import me.kyren223.trident.data.SettingsData
-import me.kyren223.trident.data.SettingsState
-import javax.swing.JComponent
-
-class SettingsConfigurable : Configurable {
-
- private var settings: SettingsData? = null
-
- override fun getDisplayName(): @ConfigurableName String {
- return "Trident Settings"
- }
-
- override fun createComponent(): JComponent {
- settings = SettingsData()
- return settings!!.panel
- }
-
- override fun isModified(): Boolean {
- val settings = SettingsState.instance
- if (settings.width != this.settings!!.getWidth()) return true
- if (settings.height != this.settings!!.getHeight()) return true
- if (settings.fontSize != this.settings!!.getFontSize()) return true
- if (settings.enterToSelect != this.settings!!.getEnterToSelect()) return true
- if (settings.automaticMapping != this.settings!!.getAutomaticMapping()) return true
- if (settings.automaticReplacing != this.settings!!.getAutomaticReplacing()) return true
- if (settings.recursiveMapping != this.settings!!.getRecursiveMapping()) return true
- if (settings.rememberLine != this.settings!!.getRememberLine()) return true
- if (settings.indexCycling != this.settings!!.getIndexCycling()) return true
- return false
- }
-
- override fun apply() {
- val settings = SettingsState.instance
- settings.width = this.settings!!.getWidth()
- settings.height = this.settings!!.getHeight()
- settings.fontSize = this.settings!!.getFontSize()
- settings.enterToSelect = this.settings!!.getEnterToSelect()
- settings.automaticMapping = this.settings!!.getAutomaticMapping()
- settings.automaticReplacing = this.settings!!.getAutomaticReplacing()
- settings.recursiveMapping = this.settings!!.getRecursiveMapping()
- settings.rememberLine = this.settings!!.getRememberLine()
- settings.indexCycling = this.settings!!.getIndexCycling()
- }
-
- override fun reset() {
- val settings = SettingsState.instance
- if (this.settings == null) this.settings = SettingsData()
- this.settings!!.setWidth(settings.width)
- this.settings!!.setHeight(settings.height)
- this.settings!!.setFontSize(settings.fontSize)
- this.settings!!.setEnterToSelect(settings.enterToSelect)
- this.settings!!.setAutomaticMapping(settings.automaticMapping)
- this.settings!!.setAutomaticReplacing(settings.automaticReplacing)
- this.settings!!.setRecursiveMapping(settings.recursiveMapping)
- this.settings!!.setRememberLine(settings.rememberLine)
- this.settings!!.setIndexCycling(settings.indexCycling)
- }
-
- override fun disposeUIResources() {
- settings = null
- }
-}
+// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
+package me.kyren223.trident.ui
+
+import com.intellij.openapi.options.Configurable
+import com.intellij.openapi.util.NlsContexts.ConfigurableName
+import me.kyren223.trident.data.SettingsData
+import me.kyren223.trident.data.SettingsState
+import javax.swing.JComponent
+
+class SettingsConfigurable : Configurable {
+
+ private var settings: SettingsData? = null
+
+ override fun getDisplayName(): @ConfigurableName String {
+ return "Trident Settings"
+ }
+
+ override fun createComponent(): JComponent {
+ settings = SettingsData()
+ return settings!!.panel
+ }
+
+ override fun isModified(): Boolean {
+ val settings = SettingsState.instance
+ if (settings.width != this.settings!!.getWidth()) return true
+ if (settings.height != this.settings!!.getHeight()) return true
+ if (settings.fontSize != this.settings!!.getFontSize()) return true
+ if (settings.enterToSelect != this.settings!!.getEnterToSelect()) return true
+ if (settings.automaticMapping != this.settings!!.getAutomaticMapping()) return true
+ if (settings.automaticReplacing != this.settings!!.getAutomaticReplacing()) return true
+ if (settings.recursiveMapping != this.settings!!.getRecursiveMapping()) return true
+ if (settings.rememberLine != this.settings!!.getRememberLine()) return true
+ if (settings.indexCycling != this.settings!!.getIndexCycling()) return true
+ return false
+ }
+
+ override fun apply() {
+ val settings = SettingsState.instance
+ settings.width = this.settings!!.getWidth()
+ settings.height = this.settings!!.getHeight()
+ settings.fontSize = this.settings!!.getFontSize()
+ settings.enterToSelect = this.settings!!.getEnterToSelect()
+ settings.automaticMapping = this.settings!!.getAutomaticMapping()
+ settings.automaticReplacing = this.settings!!.getAutomaticReplacing()
+ settings.recursiveMapping = this.settings!!.getRecursiveMapping()
+ settings.rememberLine = this.settings!!.getRememberLine()
+ settings.indexCycling = this.settings!!.getIndexCycling()
+ }
+
+ override fun reset() {
+ val settings = SettingsState.instance
+ if (this.settings == null) this.settings = SettingsData()
+ this.settings!!.setWidth(settings.width)
+ this.settings!!.setHeight(settings.height)
+ this.settings!!.setFontSize(settings.fontSize)
+ this.settings!!.setEnterToSelect(settings.enterToSelect)
+ this.settings!!.setAutomaticMapping(settings.automaticMapping)
+ this.settings!!.setAutomaticReplacing(settings.automaticReplacing)
+ this.settings!!.setRecursiveMapping(settings.recursiveMapping)
+ this.settings!!.setRememberLine(settings.rememberLine)
+ this.settings!!.setIndexCycling(settings.indexCycling)
+ }
+
+ override fun disposeUIResources() {
+ settings = null
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/ui/TridentListMenu.kt b/src/main/kotlin/me/kyren223/trident/ui/TridentListMenu.kt
index 75e059a..45eaf76 100644
--- a/src/main/kotlin/me/kyren223/trident/ui/TridentListMenu.kt
+++ b/src/main/kotlin/me/kyren223/trident/ui/TridentListMenu.kt
@@ -1,102 +1,102 @@
-package me.kyren223.trident.ui
-
-import com.intellij.openapi.editor.EditorSettings
-import com.intellij.openapi.editor.LogicalPosition
-import com.intellij.openapi.fileEditor.FileEditorManager
-import com.intellij.openapi.project.Project
-import com.intellij.openapi.ui.DialogWrapper
-import com.intellij.ui.EditorTextField
-import com.maddyhome.idea.vim.newapi.vim
-import com.maddyhome.idea.vim.state.mode.Mode
-import me.kyren223.trident.data.SettingsState
-import me.kyren223.trident.utils.TridentList
-import me.kyren223.trident.utils.injectEnterToSelectMapping
-import me.kyren223.trident.utils.setEditorMode
-import java.awt.event.FocusEvent
-import java.awt.event.FocusListener
-import javax.swing.JComponent
-
-class TridentListMenu(private val content: String) : DialogWrapper(true) {
-
- private lateinit var editor: EditorTextField
-
- init {
- this.title = "Trident List"
- val settings = SettingsState.instance
- setSize(settings.width, settings.height)
- super.init()
- }
-
- override fun createCenterPanel(): JComponent {
- editor = EditorTextField(this.content)
- editor.setOneLineMode(false)
- editor.addSettingsProvider {
- it.setFontSize(SettingsState.instance.fontSize)
- it.isInsertMode = false
- val lineNumber = if (SettingsState.instance.rememberLine) line else 0
- it.caretModel.moveToLogicalPosition(LogicalPosition(lineNumber, 0))
- it.settings.isLineNumbersShown = true
- it.settings.lineNumerationType = EditorSettings.LineNumerationType.ABSOLUTE
- }
-
- editor.addFocusListener(object : FocusListener {
- override fun focusGained(e: FocusEvent?) {
- val editor = editor.editor!!.vim
- setEditorMode(editor, Mode.NORMAL())
- }
-
- override fun focusLost(e: FocusEvent?) { /* Do nothing */
- }
- })
-
- return editor
- }
-
-
- override fun getPreferredFocusedComponent(): JComponent {
- return this.editor
- }
-
- fun select() {
- doOKAction()
- }
-
- override fun doOKAction() {
- save()
- super.doOKAction()
- }
-
- override fun doCancelAction() {
- save()
- super.doCancelAction()
- }
-
- private fun save() {
- instance = null
- files = editor.text.split("\n")
- line = editor.editor?.caretModel?.logicalPosition?.line ?: 0
- }
-
- override fun createSouthPanel(): JComponent? {
- return null
- }
-
- companion object {
- var instance: TridentListMenu? = null
- var files: List<String>? = null
- var line = 0
- fun open(project: Project) {
- val content = TridentList.get(project).joinToString("\n")
- instance = TridentListMenu(content)
- injectEnterToSelectMapping()
- val selected = instance!!.showAndGet()
-
- files?.let { TridentList.set(project, it) }
- files = null
-
- if (!selected) return
- val file = TridentList.select(project, line) ?: return
- FileEditorManager.getInstance(project).openFile(file, true)
- }
- }
-}
+package me.kyren223.trident.ui
+
+import com.intellij.openapi.editor.EditorSettings
+import com.intellij.openapi.editor.LogicalPosition
+import com.intellij.openapi.fileEditor.FileEditorManager
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.ui.DialogWrapper
+import com.intellij.ui.EditorTextField
+import com.maddyhome.idea.vim.newapi.vim
+import com.maddyhome.idea.vim.state.mode.Mode
+import me.kyren223.trident.data.SettingsState
+import me.kyren223.trident.utils.TridentList
+import me.kyren223.trident.utils.injectEnterToSelectMapping
+import java.awt.event.FocusEvent
+import java.awt.event.FocusListener
+import javax.swing.JComponent
+
+class TridentListMenu(private val content: String) : DialogWrapper(true) {
+
+ private lateinit var editor: EditorTextField
+
+ init {
+ this.title = "Trident List"
+ val settings = SettingsState.instance
+ setSize(settings.width, settings.height)
+ super.init()
+ }
+
+ override fun createCenterPanel(): JComponent {
+ editor = EditorTextField(this.content)
+ editor.setOneLineMode(false)
+ editor.addSettingsProvider {
+ it.setFontSize(SettingsState.instance.fontSize)
+ it.isInsertMode = false
+ val lineNumber = if (SettingsState.instance.rememberLine) line else 0
+ it.caretModel.moveToLogicalPosition(LogicalPosition(lineNumber, 0))
+ it.settings.isLineNumbersShown = true
+ it.settings.lineNumerationType = EditorSettings.LineNumerationType.ABSOLUTE
+ }
+
+ editor.addFocusListener(object : FocusListener {
+ override fun focusGained(e: FocusEvent?) {
+ val editor = editor.editor!!.vim
+ editor.mode = Mode.NORMAL()
+// setEditorMode(editor, Mode.NORMAL())
+ }
+
+ override fun focusLost(e: FocusEvent?) { /* Do nothing */
+ }
+ })
+
+ return editor
+ }
+
+
+ override fun getPreferredFocusedComponent(): JComponent {
+ return this.editor
+ }
+
+ fun select() {
+ doOKAction()
+ }
+
+ override fun doOKAction() {
+ save()
+ super.doOKAction()
+ }
+
+ override fun doCancelAction() {
+ save()
+ super.doCancelAction()
+ }
+
+ private fun save() {
+ instance = null
+ files = editor.text.split("\n")
+ line = editor.editor?.caretModel?.logicalPosition?.line ?: 0
+ }
+
+ override fun createSouthPanel(): JComponent? {
+ return null
+ }
+
+ companion object {
+ var instance: TridentListMenu? = null
+ var files: List<String>? = null
+ var line = 0
+ fun open(project: Project) {
+ val content = TridentList.get(project).joinToString("\n")
+ instance = TridentListMenu(content)
+ injectEnterToSelectMapping()
+ val selected = instance!!.showAndGet()
+
+ files?.let { TridentList.set(project, it) }
+ files = null
+
+ if (!selected) return
+ val file = TridentList.select(project, line) ?: return
+ FileEditorManager.getInstance(project).openFile(file, true)
+ }
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/ui/TridentMappingsMenu.kt b/src/main/kotlin/me/kyren223/trident/ui/TridentMappingsMenu.kt
index 79f1df8..062c618 100644
--- a/src/main/kotlin/me/kyren223/trident/ui/TridentMappingsMenu.kt
+++ b/src/main/kotlin/me/kyren223/trident/ui/TridentMappingsMenu.kt
@@ -1,86 +1,85 @@
-package me.kyren223.trident.ui
-
-import com.intellij.openapi.editor.EditorSettings
-import com.intellij.openapi.editor.LogicalPosition
-import com.intellij.openapi.project.Project
-import com.intellij.openapi.ui.DialogWrapper
-import com.intellij.ui.EditorTextField
-import com.maddyhome.idea.vim.newapi.vim
-import com.maddyhome.idea.vim.state.mode.Mode
-import me.kyren223.trident.data.SettingsState
-import me.kyren223.trident.utils.TridentMappings
-import me.kyren223.trident.utils.setEditorMode
-import java.awt.event.FocusEvent
-import java.awt.event.FocusListener
-import javax.swing.JComponent
-
-class TridentMappingsMenu(private val content: String) : DialogWrapper(true) {
- private lateinit var editor: EditorTextField
-
- init {
- val settings = SettingsState.instance.state
- this.title = "Trident Mappings"
- setSize(settings.width, settings.height)
- super.init()
- }
-
- override fun createCenterPanel(): JComponent {
- editor = EditorTextField(this.content)
- editor.setOneLineMode(false)
- editor.addSettingsProvider {
- it.setFontSize(SettingsState.instance.fontSize)
- it.isInsertMode = false
- it.caretModel.moveToLogicalPosition(LogicalPosition(0, 0))
- it.settings.isLineNumbersShown = true
- it.settings.lineNumerationType = EditorSettings.LineNumerationType.ABSOLUTE
- }
-
- editor.addFocusListener(object : FocusListener {
- override fun focusGained(e: FocusEvent?) {
- val editor = editor.editor!!.vim
- setEditorMode(editor, Mode.NORMAL())
- }
-
- override fun focusLost(e: FocusEvent?) { /* Do nothing */ }
- })
-
- return editor
- }
-
- override fun getPreferredFocusedComponent(): JComponent {
- return this.editor
- }
-
- override fun doOKAction() {
- save()
- super.doOKAction()
- }
-
- override fun doCancelAction() {
- save()
- super.doCancelAction()
- }
-
- private fun save() {
- map = editor.text.split("\n")
- .map { entry -> entry.split("=") }
- .filter { entry -> entry.size == 2 }
- .associate { it[0] to it[1] }
- }
-
- override fun createSouthPanel(): JComponent? {
- return null
- }
-
- companion object {
- var map: Map<String, String>? = null
- fun open(project: Project) {
- val content = TridentMappings.get(project).entries
- .joinToString("\n") { "${it.key}=${it.value}" }
- val menu = TridentMappingsMenu(content)
- menu.show()
- map?.let { TridentMappings.set(project, it) }
- map = null
- }
- }
-}
+package me.kyren223.trident.ui
+
+import com.intellij.openapi.editor.EditorSettings
+import com.intellij.openapi.editor.LogicalPosition
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.ui.DialogWrapper
+import com.intellij.ui.EditorTextField
+import com.maddyhome.idea.vim.newapi.vim
+import com.maddyhome.idea.vim.state.mode.Mode
+import me.kyren223.trident.data.SettingsState
+import me.kyren223.trident.utils.TridentMappings
+import java.awt.event.FocusEvent
+import java.awt.event.FocusListener
+import javax.swing.JComponent
+
+class TridentMappingsMenu(private val content: String) : DialogWrapper(true) {
+ private lateinit var editor: EditorTextField
+
+ init {
+ val settings = SettingsState.instance.state
+ this.title = "Trident Mappings"
+ setSize(settings.width, settings.height)
+ super.init()
+ }
+
+ override fun createCenterPanel(): JComponent {
+ editor = EditorTextField(this.content)
+ editor.setOneLineMode(false)
+ editor.addSettingsProvider {
+ it.setFontSize(SettingsState.instance.fontSize)
+ it.isInsertMode = false
+ it.caretModel.moveToLogicalPosition(LogicalPosition(0, 0))
+ it.settings.isLineNumbersShown = true
+ it.settings.lineNumerationType = EditorSettings.LineNumerationType.ABSOLUTE
+ }
+
+ editor.addFocusListener(object : FocusListener {
+ override fun focusGained(e: FocusEvent?) {
+ val editor = editor.editor!!.vim
+ editor.mode = Mode.NORMAL()
+ }
+
+ override fun focusLost(e: FocusEvent?) { /* Do nothing */ }
+ })
+
+ return editor
+ }
+
+ override fun getPreferredFocusedComponent(): JComponent {
+ return this.editor
+ }
+
+ override fun doOKAction() {
+ save()
+ super.doOKAction()
+ }
+
+ override fun doCancelAction() {
+ save()
+ super.doCancelAction()
+ }
+
+ private fun save() {
+ map = editor.text.split("\n")
+ .map { entry -> entry.split("=") }
+ .filter { entry -> entry.size == 2 }
+ .associate { it[0] to it[1] }
+ }
+
+ override fun createSouthPanel(): JComponent? {
+ return null
+ }
+
+ companion object {
+ var map: Map<String, String>? = null
+ fun open(project: Project) {
+ val content = TridentMappings.get(project).entries
+ .joinToString("\n") { "${it.key}=${it.value}" }
+ val menu = TridentMappingsMenu(content)
+ menu.show()
+ map?.let { TridentMappings.set(project, it) }
+ map = null
+ }
+ }
+}
diff --git a/src/main/kotlin/me/kyren223/trident/utils/TridentUtils.kt b/src/main/kotlin/me/kyren223/trident/utils/TridentUtils.kt
index 96ab454..5f96bd3 100644
--- a/src/main/kotlin/me/kyren223/trident/utils/TridentUtils.kt
+++ b/src/main/kotlin/me/kyren223/trident/utils/TridentUtils.kt
@@ -1,196 +1,196 @@
-package me.kyren223.trident.utils
-
-import com.intellij.ide.util.PropertiesComponent
-import com.intellij.openapi.project.Project
-import com.intellij.openapi.project.guessProjectDir
-import com.intellij.openapi.vfs.LocalFileSystem
-import com.intellij.openapi.vfs.VirtualFile
-import me.kyren223.trident.data.AutomaticMapping
-import me.kyren223.trident.data.AutomaticReplacing
-import me.kyren223.trident.data.SettingsState
-
-object TridentList {
- private const val PROPERTIES_KEY = "TridentList"
-
- private fun isValidFile(project: Project, path: String): Boolean {
- // Requirements:
- // - File must exist on disk after expansion
- val expandedPath = TridentMappings.expand(project, path)
- return expandedPath.isNotBlank() && LocalFileSystem.getInstance().findFileByPath(expandedPath) != null
- }
-
- private fun getModifiedPath(project: Project, path: String): String {
- val automaticMapping = SettingsState.instance.automaticMapping
- val automaticReplacing = SettingsState.instance.automaticReplacing
- val mappings = TridentMappings.get(project)
-
- val hasReplacement = automaticReplacing != AutomaticReplacing.Disabled
- && mappings.containsValue(path)
-
- if (hasReplacement) {
- return mappings.filterValues { it == path }.keys.firstOrNull()!!
- }
-
- if (automaticMapping == AutomaticMapping.Disabled) {
- return if (automaticReplacing == AutomaticReplacing.Smart) {
- return smartReplacement(path, mappings)
- } else path
- }
-
- return path.split("/")
- .lastOrNull()
- ?.let {
- if (automaticMapping == AutomaticMapping.Filename) {
- return@let it
- }
- val dotIndex = it.lastIndexOf(".")
- val filename = if (dotIndex == -1) it else it.substring(0, dotIndex).ifBlank { null }
- val extension = if (dotIndex == -1) null else it.substring(dotIndex + 1)
- return@let (filename ?: extension)!!
- }?.let {
- val key = "\$$it"
- if (TridentMappings.exists(project, key)) {
- return@let null
- }
- TridentMappings.append(project, key, path)
- return@let key
- } ?: (if (automaticReplacing == AutomaticReplacing.Smart) smartReplacement(path, mappings) else path)
- }
-
- private fun smartReplacement(path: String, mappings: Map<String, String>): String {
- // This is technically redundant,
- // The smart path is sorted based on length, so the longest path will be the first
- // And the longest path will be the first path that exactly matches
- val exactPath = mappings.filter { it.value == path }.keys.firstOrNull()
- exactPath?.let { return it }
-
- var smartPath = path
- for ((key, value) in mappings
- .toList()
- .sortedByDescending { it.second.length }
- .associate { it.first to it.second }) {
- smartPath = smartPath.replace(value, key)
- }
- return smartPath
- }
-
- fun append(project: Project, file: VirtualFile) {
- println("TridentList.append - file: ${file.path}")
- val files = get(project).toMutableList()
- val path = getModifiedPath(project, file.path)
- println("TridentList.append - path: $path")
- files.add(path)
- println("TridentList.append - add: " + files.joinToString(", "))
- set(project, files)
- println("TridentList.append - set")
-
- println("TridentList.append - TridentList: " + get(project).joinToString(", "))
- println("TridentList.append - TridentMappings: " + TridentMappings.get(project)
- .map { "${it.key}=${it.value}" }
- .joinToString(", "))
- }
-
- fun set(project: Project, files: List<String>) {
- val properties = PropertiesComponent.getInstance(project)
- val list = files.filter { isValidFile(project, it) }
- properties.setList(PROPERTIES_KEY, list)
- }
-
- fun get(project: Project): List<String> {
- val properties = PropertiesComponent.getInstance(project)
- return properties.getList(PROPERTIES_KEY) ?: emptyList()
- }
-
- private fun getFiles(project: Project): List<VirtualFile> {
- return get(project)
- .map { TridentMappings.expand(project, it) }
- .mapNotNull { LocalFileSystem.getInstance().findFileByPath(it) }
- }
-
- fun getIndexOfFile(project: Project, file: VirtualFile): Int? {
- val files = getFiles(project)
- return files.indexOfFirst { it.path == file.path }.takeUnless { it == -1 }
- }
-
- fun select(project: Project, index: Int): VirtualFile? {
- val cycle = SettingsState.instance.indexCycling
- val count = getFiles(project).size
- val i = if (cycle) ((index % count) + count) % count else index
- val files = getFiles(project)
- return files.getOrNull(i)
- }
-}
-
-object TridentMappings {
- private const val PROPERTIES_KEY = "TridentMappings"
-
- private fun isValidEntry(key: String, value: String): Boolean {
- // Requirements:
- // - Key and value must not be blank
- // - key must start with $
- // - key must only contain alphanumeric characters, underscores, hyphens, and dots
- // - value must not contain =
- return key.isNotBlank() && value.isNotBlank() &&
- key.matches(Regex("""^\$[a-zA-Z0-9_.\-]+$""")) &&
- value.matches(Regex("""^[^=]+$"""))
- }
-
- fun append(project: Project, key: String, value: String, overwrite: Boolean = false) {
- println("TridentMappings.append - key: $key, value: $value")
- val map = get(project).toMutableMap()
- if (map.containsKey(key) && !overwrite) return
- println("TridentMappings.append - map: $map")
- map[key] = value
- println("TridentMappings.append - map after: $map")
- set(project, map)
- println("TridentMappings.append - set: ${get(project).map { "${it.key}=${it.value}" }.joinToString(", ")}")
- }
-
- fun set(project: Project, mappings: Map<String, String>) {
- val properties = PropertiesComponent.getInstance(project)
-
- val list = mappings
- .filter { isValidEntry(it.key, it.value) }
- .map { "${it.key}=${it.value}" }
- .toMutableList()
-
- properties.setList(PROPERTIES_KEY, list)
- }
-
- fun get(project: Project): Map<String, String> {
- val properties = PropertiesComponent.getInstance(project)
- val list = properties.getList(PROPERTIES_KEY) ?: return emptyMap()
- val map = list
- .map { it.split("=") }
- .associate { it[0] to it[1] }
- .toMutableMap()
- project.guessProjectDir()?.let {
- map["..."] = it.path
- map["\$project"] = it.path
- }
- return map
- }
-
- fun expand(project: Project, path: String): String {
- val recursive = SettingsState.instance.recursiveMapping
- val mappings = get(project).toList().sortedByDescending { it.first.length }
- var expandedPath = path
- while (true) {
- var expanded = false
- mappings.forEach { (key, value) ->
- val expansion = expandedPath.replace(key, value)
- if (expansion != expandedPath) {
- expandedPath = expansion
- expanded = true
- }
- }
- if (!recursive || !expanded) break
- }
-
- return expandedPath
- }
-
- fun exists(project: Project, key: String): Boolean {
- return get(project).containsKey(key)
- }
+package me.kyren223.trident.utils
+
+import com.intellij.ide.util.PropertiesComponent
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.project.guessProjectDir
+import com.intellij.openapi.vfs.LocalFileSystem
+import com.intellij.openapi.vfs.VirtualFile
+import me.kyren223.trident.data.AutomaticMapping
+import me.kyren223.trident.data.AutomaticReplacing
+import me.kyren223.trident.data.SettingsState
+
+object TridentList {
+ private const val PROPERTIES_KEY = "TridentList"
+
+ private fun isValidFile(project: Project, path: String): Boolean {
+ // Requirements:
+ // - File must exist on disk after expansion
+ val expandedPath = TridentMappings.expand(project, path)
+ return expandedPath.isNotBlank() && LocalFileSystem.getInstance().findFileByPath(expandedPath) != null
+ }
+
+ private fun getModifiedPath(project: Project, path: String): String {
+ val automaticMapping = SettingsState.instance.automaticMapping
+ val automaticReplacing = SettingsState.instance.automaticReplacing
+ val mappings = TridentMappings.get(project)
+
+ val hasReplacement = automaticReplacing != AutomaticReplacing.Disabled
+ && mappings.containsValue(path)
+
+ if (hasReplacement) {
+ return mappings.filterValues { it == path }.keys.firstOrNull()!!
+ }
+
+ if (automaticMapping == AutomaticMapping.Disabled) {
+ return if (automaticReplacing == AutomaticReplacing.Smart) {
+ return smartReplacement(path, mappings)
+ } else path
+ }
+
+ return path.split("/")
+ .lastOrNull()
+ ?.let {
+ if (automaticMapping == AutomaticMapping.Filename) {
+ return@let it
+ }
+ val dotIndex = it.lastIndexOf(".")
+ val filename = if (dotIndex == -1) it else it.substring(0, dotIndex).ifBlank { null }
+ val extension = if (dotIndex == -1) null else it.substring(dotIndex + 1)
+ return@let (filename ?: extension)!!
+ }?.let {
+ val key = "\$$it"
+ if (TridentMappings.exists(project, key)) {
+ return@let null
+ }
+ TridentMappings.append(project, key, path)
+ return@let key
+ } ?: (if (automaticReplacing == AutomaticReplacing.Smart) smartReplacement(path, mappings) else path)
+ }
+
+ private fun smartReplacement(path: String, mappings: Map<String, String>): String {
+ // This is technically redundant,
+ // The smart path is sorted based on length, so the longest path will be the first
+ // And the longest path will be the first path that exactly matches
+ val exactPath = mappings.filter { it.value == path }.keys.firstOrNull()
+ exactPath?.let { return it }
+
+ var smartPath = path
+ for ((key, value) in mappings
+ .toList()
+ .sortedByDescending { it.second.length }
+ .associate { it.first to it.second }) {
+ smartPath = smartPath.replace(value, key)
+ }
+ return smartPath
+ }
+
+ fun append(project: Project, file: VirtualFile) {
+ println("TridentList.append - file: ${file.path}")
+ val files = get(project).toMutableList()
+ val path = getModifiedPath(project, file.path)
+ println("TridentList.append - path: $path")
+ files.add(path)
+ println("TridentList.append - add: " + files.joinToString(", "))
+ set(project, files)
+ println("TridentList.append - set")
+
+ println("TridentList.append - TridentList: " + get(project).joinToString(", "))
+ println("TridentList.append - TridentMappings: " + TridentMappings.get(project)
+ .map { "${it.key}=${it.value}" }
+ .joinToString(", "))
+ }
+
+ fun set(project: Project, files: List<String>) {
+ val properties = PropertiesComponent.getInstance(project)
+ val list = files.filter { isValidFile(project, it) }
+ properties.setList(PROPERTIES_KEY, list)
+ }
+
+ fun get(project: Project): List<String> {
+ val properties = PropertiesComponent.getInstance(project)
+ return properties.getList(PROPERTIES_KEY) ?: emptyList()
+ }
+
+ private fun getFiles(project: Project): List<VirtualFile> {
+ return get(project)
+ .map { TridentMappings.expand(project, it) }
+ .mapNotNull { LocalFileSystem.getInstance().findFileByPath(it) }
+ }
+
+ fun getIndexOfFile(project: Project, file: VirtualFile): Int? {
+ val files = getFiles(project)
+ return files.indexOfFirst { it.path == file.path }.takeUnless { it == -1 }
+ }
+
+ fun select(project: Project, index: Int): VirtualFile? {
+ val cycle = SettingsState.instance.indexCycling
+ val count = getFiles(project).size
+ val i = if (cycle) ((index % count) + count) % count else index
+ val files = getFiles(project)
+ return files.getOrNull(i)
+ }
+}
+
+object TridentMappings {
+ private const val PROPERTIES_KEY = "TridentMappings"
+
+ private fun isValidEntry(key: String, value: String): Boolean {
+ // Requirements:
+ // - Key and value must not be blank
+ // - key must start with $
+ // - key must only contain alphanumeric characters, underscores, hyphens, and dots
+ // - value must not contain =
+ return key.isNotBlank() && value.isNotBlank() &&
+ key.matches(Regex("""^\$[a-zA-Z0-9_.\-]+$""")) &&
+ value.matches(Regex("""^[^=]+$"""))
+ }
+
+ fun append(project: Project, key: String, value: String, overwrite: Boolean = false) {
+ println("TridentMappings.append - key: $key, value: $value")
+ val map = get(project).toMutableMap()
+ if (map.containsKey(key) && !overwrite) return
+ println("TridentMappings.append - map: $map")
+ map[key] = value
+ println("TridentMappings.append - map after: $map")
+ set(project, map)
+ println("TridentMappings.append - set: ${get(project).map { "${it.key}=${it.value}" }.joinToString(", ")}")
+ }
+
+ fun set(project: Project, mappings: Map<String, String>) {
+ val properties = PropertiesComponent.getInstance(project)
+
+ val list = mappings
+ .filter { isValidEntry(it.key, it.value) }
+ .map { "${it.key}=${it.value}" }
+ .toMutableList()
+
+ properties.setList(PROPERTIES_KEY, list)
+ }
+
+ fun get(project: Project): Map<String, String> {
+ val properties = PropertiesComponent.getInstance(project)
+ val list = properties.getList(PROPERTIES_KEY) ?: return emptyMap()
+ val map = list
+ .map { it.split("=") }
+ .associate { it[0] to it[1] }
+ .toMutableMap()
+ project.guessProjectDir()?.let {
+ map["..."] = it.path
+ map["\$project"] = it.path
+ }
+ return map
+ }
+
+ fun expand(project: Project, path: String): String {
+ val recursive = SettingsState.instance.recursiveMapping
+ val mappings = get(project).toList().sortedByDescending { it.first.length }
+ var expandedPath = path
+ while (true) {
+ var expanded = false
+ mappings.forEach { (key, value) ->
+ val expansion = expandedPath.replace(key, value)
+ if (expansion != expandedPath) {
+ expandedPath = expansion
+ expanded = true
+ }
+ }
+ if (!recursive || !expanded) break
+ }
+
+ return expandedPath
+ }
+
+ fun exists(project: Project, key: String): Boolean {
+ return get(project).containsKey(key)
+ }
} \ No newline at end of file
diff --git a/src/main/kotlin/me/kyren223/trident/utils/Utils.kt b/src/main/kotlin/me/kyren223/trident/utils/Utils.kt
index e688dd8..d9b4f34 100644
--- a/src/main/kotlin/me/kyren223/trident/utils/Utils.kt
+++ b/src/main/kotlin/me/kyren223/trident/utils/Utils.kt
@@ -1,26 +1,16 @@
-package me.kyren223.trident.utils
-
-import com.maddyhome.idea.vim.api.VimEditor
-import com.maddyhome.idea.vim.api.injector
-import com.maddyhome.idea.vim.command.MappingMode
-import com.maddyhome.idea.vim.command.OperatorArguments
-import com.maddyhome.idea.vim.key.MappingOwner
-import com.maddyhome.idea.vim.state.mode.Mode
-
-fun setEditorMode(editor: VimEditor, mode: Mode) {
- val context = injector.executionContextManager.onEditor(editor, null)
- val operatorArguments = OperatorArguments(false, 0, mode)
- editor.exitInsertMode(context, operatorArguments)
- editor.vimChangeActionSwitchMode = Mode.NORMAL()
-}
-
-fun injectEnterToSelectMapping() {
- injector.keyGroup.putKeyMapping(
- MappingMode.NV,
- injector.parser.parseKeys("<cr>"),
- MappingOwner.Plugin.get("Trident"),
- injector.parser.parseKeys(":action TridentListSelect<cr>"),
- false
- )
-}
-
+package me.kyren223.trident.utils
+
+import com.maddyhome.idea.vim.api.injector
+import com.maddyhome.idea.vim.command.MappingMode
+import com.maddyhome.idea.vim.key.MappingOwner
+
+fun injectEnterToSelectMapping() {
+ injector.keyGroup.putKeyMapping(
+ MappingMode.NV,
+ injector.parser.parseKeys("<cr>"),
+ MappingOwner.Plugin.get("Trident"),
+ injector.parser.parseKeys(":action TridentListSelect<cr>"),
+ false
+ )
+}
+
diff --git a/src/main/resources/META-INF/Trident-IdeaVim.xml b/src/main/resources/META-INF/Trident-IdeaVim.xml
index 164f46c..b72ce85 100644
--- a/src/main/resources/META-INF/Trident-IdeaVim.xml
+++ b/src/main/resources/META-INF/Trident-IdeaVim.xml
@@ -1,2 +1,2 @@
-<idea-plugin>
-</idea-plugin>
+<idea-plugin>
+</idea-plugin>
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index e52e798..60095a7 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -1,133 +1,133 @@
-<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
-<idea-plugin>
- <!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. -->
- <id>me.kyren223.trident</id>
-
- <!-- Public plugin name should be written in Title Case.
- Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name -->
- <name>Trident</name>
-
- <!-- A displayed Vendor name or Organization ID displayed on the Plugins Page. -->
- <vendor email="ulmliad223@gmail.com" url="https://discord.gg/7vpTv7m3QR">Kyren223</vendor>
-
- <!-- Description of the plugin displayed on the Plugin Page and IDE Plugin Manager.
- Simple HTML elements (text formatting, paragraphs, and lists) can be added inside of <![CDATA[ ]]> tag.
- Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-description -->
- <description><![CDATA[
- <h3>Trident</h3>
- Trident is a plugin for JetBrains IDEs that provides a fast and intuitive<br>
- way to navigate between files effortlessly.<br>
- <br>
- The plugin is inspired by the "Harpoon" plugin made<br>
- by ThePrimeagen for Neovim.<br>
- <br>
- Trident aims to bring the same experience to JetBrains IDEs.<br>
- but with additional features and proper integration with the IDE.<br>
- <br>
- Want to help contribute to the project?<br>
- Source code: <a href="https://github.com/Kyren223/Trident">GitHub Repo</a><br>
- ]]></description>
-
- <!-- Product and plugin compatibility requirements.
- Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
- <depends>com.intellij.modules.platform</depends>
- <depends optional="true" config-file="Trident-IdeaVim.xml">IdeaVIM</depends>
- <!-- Extension points defined by the plugin.
- Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
- <extensions defaultExtensionNs="com.intellij">
- <applicationConfigurable
- parentId="tools"
- instance="me.kyren223.trident.ui.SettingsConfigurable"
- id="me.kyren223.trident.ui.SettingsConfigurable"
- displayName="Trident Settings"/>
- <applicationService serviceImplementation="me.kyren223.trident.data.SettingsState"/>
- </extensions>
-
- <actions>
- <group id="me.kyren223.trident.mainGroup"
- text="Trident" description="Trident"
- popup="true">
- </group>
-
- <!-- Trident Select Buffer -->
- <action id="TridentSelect1" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 1">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect2" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 2">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect3" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 3">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect4" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 4">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect5" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 5">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect6" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 6">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect7" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 7">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect8" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 8">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect9" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 9">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelect10" class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Buffer 10">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
-
- <!-- Select Previous & Next Buffer -->
- <action id="TridentSelectPrev"
- class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Previous Buffer">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- <action id="TridentSelectNext"
- class="me.kyren223.trident.actions.TridentSelectAction"
- text="Select Next Buffer">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
-
- <!-- Append -->
- <action id="TridentAppend"
- class="me.kyren223.trident.actions.TridentAppendAction"
- text="Append File">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
-
- <!-- UI Actions -->
- <action id="TridentList"
- class="me.kyren223.trident.actions.TridentListAction"
- text="Toggle Quick Menu">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
-
- <action id="TridentListSelect"
- class="me.kyren223.trident.actions.TridentListSelectAction"
- text="Quick Menu Select">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
-
- <action id="TridentMappings"
- class="me.kyren223.trident.actions.TridentMappingsAction"
- text="Toggle Path Mappings Menu">
- <add-to-group group-id="me.kyren223.trident.mainGroup"/>
- </action>
- </actions>
-
+<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html -->
+<idea-plugin>
+ <!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. -->
+ <id>me.kyren223.trident</id>
+
+ <!-- Public plugin name should be written in Title Case.
+ Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name -->
+ <name>Trident</name>
+
+ <!-- A displayed Vendor name or Organization ID displayed on the Plugins Page. -->
+ <vendor email="ulmliad223@gmail.com" url="https://discord.gg/7vpTv7m3QR">Kyren223</vendor>
+
+ <!-- Description of the plugin displayed on the Plugin Page and IDE Plugin Manager.
+ Simple HTML elements (text formatting, paragraphs, and lists) can be added inside of <![CDATA[ ]]> tag.
+ Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-description -->
+ <description><![CDATA[
+ <h3>Trident</h3>
+ Trident is a plugin for JetBrains IDEs that provides a fast and intuitive<br>
+ way to navigate between files effortlessly.<br>
+ <br>
+ The plugin is inspired by the "Harpoon" plugin made<br>
+ by ThePrimeagen for Neovim.<br>
+ <br>
+ Trident aims to bring the same experience to JetBrains IDEs.<br>
+ but with additional features and proper integration with the IDE.<br>
+ <br>
+ Want to help contribute to the project?<br>
+ Source code: <a href="https://github.com/Kyren223/Trident">GitHub Repo</a><br>
+ ]]></description>
+
+ <!-- Product and plugin compatibility requirements.
+ Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html -->
+ <depends>com.intellij.modules.platform</depends>
+ <depends optional="true" config-file="Trident-IdeaVim.xml">IdeaVIM</depends>
+ <!-- Extension points defined by the plugin.
+ Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html -->
+ <extensions defaultExtensionNs="com.intellij">
+ <applicationConfigurable
+ parentId="tools"
+ instance="me.kyren223.trident.ui.SettingsConfigurable"
+ id="me.kyren223.trident.ui.SettingsConfigurable"
+ displayName="Trident Settings"/>
+ <applicationService serviceImplementation="me.kyren223.trident.data.SettingsState"/>
+ </extensions>
+
+ <actions>
+ <group id="me.kyren223.trident.mainGroup"
+ text="Trident" description="Trident"
+ popup="true">
+ </group>
+
+ <!-- Trident Select Buffer -->
+ <action id="TridentSelect1" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 1">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect2" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 2">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect3" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 3">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect4" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 4">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect5" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 5">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect6" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 6">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect7" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 7">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect8" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 8">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect9" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 9">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelect10" class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Buffer 10">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+
+ <!-- Select Previous & Next Buffer -->
+ <action id="TridentSelectPrev"
+ class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Previous Buffer">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ <action id="TridentSelectNext"
+ class="me.kyren223.trident.actions.TridentSelectAction"
+ text="Select Next Buffer">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+
+ <!-- Append -->
+ <action id="TridentAppend"
+ class="me.kyren223.trident.actions.TridentAppendAction"
+ text="Append File">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+
+ <!-- UI Actions -->
+ <action id="TridentList"
+ class="me.kyren223.trident.actions.TridentListAction"
+ text="Toggle Quick Menu">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+
+ <action id="TridentListSelect"
+ class="me.kyren223.trident.actions.TridentListSelectAction"
+ text="Quick Menu Select">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+
+ <action id="TridentMappings"
+ class="me.kyren223.trident.actions.TridentMappingsAction"
+ text="Toggle Path Mappings Menu">
+ <add-to-group group-id="me.kyren223.trident.mainGroup"/>
+ </action>
+ </actions>
+
</idea-plugin> \ No newline at end of file
diff --git a/src/main/resources/META-INF/pluginIcon.svg b/src/main/resources/META-INF/pluginIcon.svg
index e79cf98..1bcfd45 100644
--- a/src/main/resources/META-INF/pluginIcon.svg
+++ b/src/main/resources/META-INF/pluginIcon.svg
@@ -1,26 +1,26 @@
-<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M19.4431 20.5569V23.4283H16.5717V20.5569H19.4431Z" fill="#2B3339"/>
-<path d="M18.022 21.9781V24.8495H15.1506V21.9781H18.022Z" fill="#2B3339"/>
-<path d="M16.6008 23.3994V26.2708H13.7295V23.3994H16.6008Z" fill="#2B3339"/>
-<path d="M15.1797 24.8207V27.6921H12.3083V24.8207H15.1797Z" fill="#2B3339"/>
-<path d="M13.7581 26.2419V29.1133H10.8867V26.2419H13.7581Z" fill="#2B3339"/>
-<path d="M12.3372 27.6631V30.5345H9.46578V27.6631H12.3372Z" fill="#2B3339"/>
-<path d="M10.9155 29.0844V31.9557H8.04415V29.0844H10.9155Z" fill="#2B3339"/>
-<path d="M9.49463 30.5059V33.3772H6.62326V30.5059H9.49463Z" fill="#2B3339"/>
-<path d="M8.07324 31.9271V34.7985H5.20187V31.9271H8.07324Z" fill="#2B3339"/>
-<path d="M6.6521 33.3483V36.2196H3.78073V33.3483H6.6521Z" fill="#2B3339"/>
-<path d="M5.23071 34.7695V37.6409H2.35934V34.7695H5.23071Z" fill="#2B3339"/>
-<path d="M27.7678 12.2323V15.1037H24.8964V12.2323H27.7678Z" fill="#487494"/>
-<path d="M37.5647 12.2831V15.1545H34.6933V12.2831H37.5647Z" fill="#487494"/>
-<path d="M32.6411 7.3595V10.2309H29.7697V7.3595H32.6411Z" fill="#487494"/>
-<path d="M32.6917 17.1559V20.0273H29.8203V17.1559H32.6917Z" fill="#487494"/>
-<path d="M22.8953 17.1055V19.9768H20.0239V17.1055H22.8953Z" fill="#487494"/>
-<path d="M22.8442 7.30872V10.1801H19.9729V7.30872H22.8442Z" fill="#487494"/>
-<path d="M27.7173 2.43579V5.30716H24.8459V2.43579H27.7173Z" fill="#487494"/>
-<path d="M17.9717 12.1818V15.0531H15.1003V12.1818H17.9717Z" fill="#487494"/>
-<path d="M27.8188 22.0291V24.9004H24.9475V22.0291H27.8188Z" fill="#487494"/>
-<path d="M25.5708 3.1322L26.9921 4.55346L15.2667 16.2788L13.8454 14.8576L25.5708 3.1322Z" fill="#487494"/>
-<path d="M35.4182 12.9795L36.8395 14.4007L25.1141 26.1261L23.6928 24.7049L35.4182 12.9795Z" fill="#487494"/>
-<path d="M30.4944 8.05591L31.9156 9.47717L20.1903 21.2025L18.769 19.7813L30.4944 8.05591Z" fill="#487494"/>
-<path d="M13.8452 14.8575L25.1138 26.1261L23.6417 27.5981L12.3732 16.3296L13.8452 14.8575Z" fill="#487494"/>
-</svg>
+<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M19.4431 20.5569V23.4283H16.5717V20.5569H19.4431Z" fill="#2B3339"/>
+<path d="M18.022 21.9781V24.8495H15.1506V21.9781H18.022Z" fill="#2B3339"/>
+<path d="M16.6008 23.3994V26.2708H13.7295V23.3994H16.6008Z" fill="#2B3339"/>
+<path d="M15.1797 24.8207V27.6921H12.3083V24.8207H15.1797Z" fill="#2B3339"/>
+<path d="M13.7581 26.2419V29.1133H10.8867V26.2419H13.7581Z" fill="#2B3339"/>
+<path d="M12.3372 27.6631V30.5345H9.46578V27.6631H12.3372Z" fill="#2B3339"/>
+<path d="M10.9155 29.0844V31.9557H8.04415V29.0844H10.9155Z" fill="#2B3339"/>
+<path d="M9.49463 30.5059V33.3772H6.62326V30.5059H9.49463Z" fill="#2B3339"/>
+<path d="M8.07324 31.9271V34.7985H5.20187V31.9271H8.07324Z" fill="#2B3339"/>
+<path d="M6.6521 33.3483V36.2196H3.78073V33.3483H6.6521Z" fill="#2B3339"/>
+<path d="M5.23071 34.7695V37.6409H2.35934V34.7695H5.23071Z" fill="#2B3339"/>
+<path d="M27.7678 12.2323V15.1037H24.8964V12.2323H27.7678Z" fill="#487494"/>
+<path d="M37.5647 12.2831V15.1545H34.6933V12.2831H37.5647Z" fill="#487494"/>
+<path d="M32.6411 7.3595V10.2309H29.7697V7.3595H32.6411Z" fill="#487494"/>
+<path d="M32.6917 17.1559V20.0273H29.8203V17.1559H32.6917Z" fill="#487494"/>
+<path d="M22.8953 17.1055V19.9768H20.0239V17.1055H22.8953Z" fill="#487494"/>
+<path d="M22.8442 7.30872V10.1801H19.9729V7.30872H22.8442Z" fill="#487494"/>
+<path d="M27.7173 2.43579V5.30716H24.8459V2.43579H27.7173Z" fill="#487494"/>
+<path d="M17.9717 12.1818V15.0531H15.1003V12.1818H17.9717Z" fill="#487494"/>
+<path d="M27.8188 22.0291V24.9004H24.9475V22.0291H27.8188Z" fill="#487494"/>
+<path d="M25.5708 3.1322L26.9921 4.55346L15.2667 16.2788L13.8454 14.8576L25.5708 3.1322Z" fill="#487494"/>
+<path d="M35.4182 12.9795L36.8395 14.4007L25.1141 26.1261L23.6928 24.7049L35.4182 12.9795Z" fill="#487494"/>
+<path d="M30.4944 8.05591L31.9156 9.47717L20.1903 21.2025L18.769 19.7813L30.4944 8.05591Z" fill="#487494"/>
+<path d="M13.8452 14.8575L25.1138 26.1261L23.6417 27.5981L12.3732 16.3296L13.8452 14.8575Z" fill="#487494"/>
+</svg>