From 4962baabad1cd1ded644a5b3603276def67af33a Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Thu, 14 Nov 2024 15:31:47 -0800 Subject: [PATCH] Add support for hlsearch variable --- .../idea/vim/newapi/IjVimSearchGroup.kt | 13 +++ .../variables/HighLightVariableTest.kt | 94 +++++++++++++++++++ .../maddyhome/idea/vim/api/VimSearchGroup.kt | 5 + .../model/variables/HighLightVariable.kt | 29 ++++++ .../services/VimVariableServiceBase.kt | 5 +- 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/jetbrains/plugins/ideavim/ex/implementation/variables/HighLightVariableTest.kt create mode 100644 vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/model/variables/HighLightVariable.kt diff --git a/src/main/java/com/maddyhome/idea/vim/newapi/IjVimSearchGroup.kt b/src/main/java/com/maddyhome/idea/vim/newapi/IjVimSearchGroup.kt index 38948c1b4f..68ad7b0fc9 100644 --- a/src/main/java/com/maddyhome/idea/vim/newapi/IjVimSearchGroup.kt +++ b/src/main/java/com/maddyhome/idea/vim/newapi/IjVimSearchGroup.kt @@ -110,6 +110,19 @@ open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateComponent VimInt(KeyHandler.getInstance().keyHandlerState.commandBuilder.calculateCount0Snapshot()) "count1" -> VimInt(KeyHandler.getInstance().keyHandlerState.commandBuilder.calculateCount0Snapshot().coerceAtLeast(1)) "searchforward" -> VimInt(if (injector.searchGroup.getLastSearchDirection() == Direction.FORWARDS) 1 else 0) + "hlsearch" -> { + HighLightVariable().evaluate(name, editor, context, vimContext) + } "register" -> { RegisterVariable().evaluate(name, editor, context, vimContext) }