mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-08 06:34:08 +02:00
Add an ability to enable matchit using packadd syntax
This commit is contained in:
parent
99a0dc6c53
commit
e097880e95
doc
src
main
java/com/maddyhome/idea/vim/vimscript/model/commands
resources/dictionaries
test/java/org/jetbrains/plugins/ideavim/extension
2
doc
2
doc
@ -1 +1 @@
|
||||
Subproject commit ccca4feb484593f366ad792b93e85f7aff12b7d4
|
||||
Subproject commit 86688f31694966bd98df897eb35ba1150a7907db
|
@ -30,12 +30,7 @@ class PackaddCommand(val ranges: Ranges, val argument: String) : Command.SingleE
|
||||
override val argFlags = flags(RangeFlag.RANGE_FORBIDDEN, ArgumentFlag.ARGUMENT_REQUIRED, Access.READ_ONLY)
|
||||
|
||||
override fun processCommand(editor: Editor, context: DataContext): ExecutionResult {
|
||||
val argument = argument
|
||||
val firstChar = argument[0]
|
||||
if (firstChar != '"' && firstChar != '\'') return ExecutionResult.Error
|
||||
|
||||
val pluginAlias = argument.drop(1).takeWhile { it != firstChar }
|
||||
if (pluginAlias == "matchit") {
|
||||
if (argument == "matchit" || (argument.startsWith("!") && argument.drop(1).trim() == "matchit")) {
|
||||
VimPlugin.getOptionService().setOption(OptionService.Scope.GLOBAL, "matchit", null)
|
||||
}
|
||||
return ExecutionResult.Success
|
||||
|
@ -46,10 +46,14 @@ swapfile
|
||||
noswapfile
|
||||
|
||||
sethandler
|
||||
packadd
|
||||
|
||||
nvim
|
||||
|
||||
easymotion
|
||||
matchit
|
||||
textobj
|
||||
argtextobj
|
||||
|
||||
|
||||
nmap
|
||||
@ -130,3 +134,5 @@ tmapclear
|
||||
|
||||
getreg
|
||||
getregtype
|
||||
|
||||
endfunction
|
@ -35,6 +35,8 @@ import com.maddyhome.idea.vim.extension.VimExtensionRegistrar
|
||||
import com.maddyhome.idea.vim.group.MotionGroup
|
||||
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||
import com.maddyhome.idea.vim.helper.isEndAllowed
|
||||
import com.maddyhome.idea.vim.option.OptionsManager
|
||||
import com.maddyhome.idea.vim.option.ToggleOption
|
||||
import com.maddyhome.idea.vim.vimscript.Executor
|
||||
import com.maddyhome.idea.vim.vimscript.Executor.executingVimScript
|
||||
import junit.framework.TestCase
|
||||
@ -263,6 +265,26 @@ class PlugMissingKeysTest : VimTestCase() {
|
||||
TestCase.assertEquals(parseKeys("L"), iKeyMappings.first().first)
|
||||
}
|
||||
|
||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
||||
fun `test packadd`() {
|
||||
assertFalse((OptionsManager.getOption("matchit") as ToggleOption).isSet)
|
||||
executeLikeVimrc(
|
||||
"packadd matchit",
|
||||
)
|
||||
|
||||
assertTrue((OptionsManager.getOption("matchit") as ToggleOption).isSet)
|
||||
}
|
||||
|
||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
||||
fun `test packadd ex`() {
|
||||
assertFalse((OptionsManager.getOption("matchit") as ToggleOption).isSet)
|
||||
executeLikeVimrc(
|
||||
"packadd! matchit",
|
||||
)
|
||||
|
||||
assertTrue((OptionsManager.getOption("matchit") as ToggleOption).isSet)
|
||||
}
|
||||
|
||||
private fun executeLikeVimrc(vararg text: String) {
|
||||
executingVimScript = true
|
||||
Executor.execute(text.joinToString("\n"), false)
|
||||
|
Loading…
Reference in New Issue
Block a user