mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-06-06 07:34:04 +02:00
Implement smap and snoremap
Support for sunmap and smapclear already exists, and vmap would introduce a Select mode map. Fixes VIM-2260
This commit is contained in:
parent
5fc4462b03
commit
976771d11a
src/test/java/org/jetbrains/plugins/ideavim/ex/implementation/commands
vim-engine/src/main
@ -124,12 +124,12 @@ class MapCommandTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun addTestMaps() {
|
private fun addTestMaps() {
|
||||||
// TODO: Support smap and lmap
|
// TODO: Support lmap
|
||||||
enterCommand("map all foo") // NVO
|
enterCommand("map all foo") // NVO
|
||||||
enterCommand("nmap normal foo")
|
enterCommand("nmap normal foo")
|
||||||
enterCommand("imap insert foo")
|
enterCommand("imap insert foo")
|
||||||
enterCommand("vmap visual+select foo") // V -> Visual+Select
|
enterCommand("vmap visual+select foo") // V -> Visual+Select
|
||||||
// enterCommand("smap select foo") // TODO: Support smap
|
enterCommand("smap select foo")
|
||||||
enterCommand("xmap visual foo")
|
enterCommand("xmap visual foo")
|
||||||
enterCommand("omap op-pending foo")
|
enterCommand("omap op-pending foo")
|
||||||
enterCommand("map! insert+cmdline foo") // IC
|
enterCommand("map! insert+cmdline foo") // IC
|
||||||
@ -151,6 +151,7 @@ class MapCommandTest : VimTestCase() {
|
|||||||
| all foo
|
| all foo
|
||||||
|n normal foo
|
|n normal foo
|
||||||
|o op-pending foo
|
|o op-pending foo
|
||||||
|
|s select foo
|
||||||
|x visual foo
|
|x visual foo
|
||||||
|v visual+select foo
|
|v visual+select foo
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
@ -182,6 +183,7 @@ class MapCommandTest : VimTestCase() {
|
|||||||
assertExOutput(
|
assertExOutput(
|
||||||
"""
|
"""
|
||||||
| all foo
|
| all foo
|
||||||
|
|s select foo
|
||||||
|x visual foo
|
|x visual foo
|
||||||
|v visual+select foo
|
|v visual+select foo
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
@ -189,7 +191,6 @@ class MapCommandTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled("smap not yet supported")
|
|
||||||
fun `test output of smap shows maps for Select mode`() {
|
fun `test output of smap shows maps for Select mode`() {
|
||||||
configureByText("\n")
|
configureByText("\n")
|
||||||
addTestMaps()
|
addTestMaps()
|
||||||
@ -320,6 +321,7 @@ class MapCommandTest : VimTestCase() {
|
|||||||
|noxall foo
|
|noxall foo
|
||||||
|n normal foo
|
|n normal foo
|
||||||
|o op-pending foo
|
|o op-pending foo
|
||||||
|
|s select foo
|
||||||
|x visual foo
|
|x visual foo
|
||||||
|v visual+select foo
|
|v visual+select foo
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
@ -339,6 +341,7 @@ class MapCommandTest : VimTestCase() {
|
|||||||
|no all foo
|
|no all foo
|
||||||
|n normal foo
|
|n normal foo
|
||||||
|o op-pending foo
|
|o op-pending foo
|
||||||
|
|s select foo
|
||||||
|x visual foo
|
|x visual foo
|
||||||
|v visual+select foo
|
|v visual+select foo
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
|
@ -692,6 +692,7 @@ MAP_CLEAR: ('mapc' | 'nmapc' | 'vmapc' | 'xmapc' | 'smapc' | 'omapc
|
|||||||
| (('mapc' | 'nmapc' | 'vmapc' | 'xmapc' | 'smapc' | 'omapc' | 'imapc' | 'cmapc') 'lea')
|
| (('mapc' | 'nmapc' | 'vmapc' | 'xmapc' | 'smapc' | 'omapc' | 'imapc' | 'cmapc') 'lea')
|
||||||
| (('mapc' | 'nmapc' | 'vmapc' | 'xmapc' | 'smapc' | 'omapc' | 'imapc' | 'cmapc') 'lear');
|
| (('mapc' | 'nmapc' | 'vmapc' | 'xmapc' | 'smapc' | 'omapc' | 'imapc' | 'cmapc') 'lear');
|
||||||
MAP: 'map'
|
MAP: 'map'
|
||||||
|
| 'smap'
|
||||||
| 'nm' | 'vm' | 'xm' | 'om' | 'im' | 'cm'
|
| 'nm' | 'vm' | 'xm' | 'om' | 'im' | 'cm'
|
||||||
| (('nm' | 'vm' | 'xm' | 'om' | 'im' | 'cm') 'a')
|
| (('nm' | 'vm' | 'xm' | 'om' | 'im' | 'cm') 'a')
|
||||||
| (('nm' | 'vm' | 'xm' | 'om' | 'im' | 'cm') 'ap')
|
| (('nm' | 'vm' | 'xm' | 'om' | 'im' | 'cm') 'ap')
|
||||||
@ -701,7 +702,8 @@ MAP: 'map'
|
|||||||
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 're')
|
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 're')
|
||||||
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 'rem')
|
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 'rem')
|
||||||
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 'rema')
|
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 'rema')
|
||||||
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 'remap');
|
| (('no' | 'nno' | 'vno' | 'xno' | 'ono' | 'ino' | 'cno') 'remap')
|
||||||
|
| ('snor' | 'snore' | 'snorem' | 'snorema' | 'snoremap');
|
||||||
UNMAP: 'unm' | 'nun' | 'vu' | 'xu' | 'sunm' | 'ou' | 'iu' | 'cu'
|
UNMAP: 'unm' | 'nun' | 'vu' | 'xu' | 'sunm' | 'ou' | 'iu' | 'cu'
|
||||||
| 'vun' | 'xun' | 'oun' | 'iun' | 'cun'
|
| 'vun' | 'xun' | 'oun' | 'iun' | 'cun'
|
||||||
| 'nunm' | 'vunm' | 'xunm' | 'ounm' | 'iunm' | 'cunm'
|
| 'nunm' | 'vunm' | 'xunm' | 'ounm' | 'iunm' | 'cunm'
|
||||||
|
@ -148,22 +148,24 @@ data class MapCommand(val range: Range, val cmd: String, val modifier: CommandMo
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val COMMAND_INFOS = arrayOf(
|
private val COMMAND_INFOS = arrayOf(
|
||||||
// TODO: Support smap, lmap
|
// TODO: Support lmap
|
||||||
CommandInfo("map", "", MappingMode.NVO, true),
|
CommandInfo("map", "", MappingMode.NVO, true),
|
||||||
CommandInfo("map", "", MappingMode.IC, true, bang = true),
|
CommandInfo("map", "", MappingMode.IC, true, bang = true),
|
||||||
CommandInfo("nm", "ap", MappingMode.N, true),
|
CommandInfo("nm", "ap", MappingMode.N, true),
|
||||||
CommandInfo("vm", "ap", MappingMode.V, true),
|
CommandInfo("vm", "ap", MappingMode.V, true),
|
||||||
CommandInfo("xm", "ap", MappingMode.X, true),
|
CommandInfo("xm", "ap", MappingMode.X, true),
|
||||||
|
CommandInfo("smap", "", MappingMode.S, true),
|
||||||
CommandInfo("om", "ap", MappingMode.O, true),
|
CommandInfo("om", "ap", MappingMode.O, true),
|
||||||
CommandInfo("im", "ap", MappingMode.I, true),
|
CommandInfo("im", "ap", MappingMode.I, true),
|
||||||
CommandInfo("cm", "ap", MappingMode.C, true),
|
CommandInfo("cm", "ap", MappingMode.C, true),
|
||||||
|
|
||||||
// TODO: Support snoremap, noremap!, lnoremap
|
// TODO: Support lnoremap
|
||||||
CommandInfo("no", "remap", MappingMode.NVO, false),
|
CommandInfo("no", "remap", MappingMode.NVO, false),
|
||||||
CommandInfo("no", "remap", MappingMode.IC, false, bang = true),
|
CommandInfo("no", "remap", MappingMode.IC, false, bang = true),
|
||||||
CommandInfo("nn", "oremap", MappingMode.N, false),
|
CommandInfo("nn", "oremap", MappingMode.N, false),
|
||||||
CommandInfo("vn", "oremap", MappingMode.V, false),
|
CommandInfo("vn", "oremap", MappingMode.V, false),
|
||||||
CommandInfo("xn", "oremap", MappingMode.X, false),
|
CommandInfo("xn", "oremap", MappingMode.X, false),
|
||||||
|
CommandInfo("snor", "emap", MappingMode.S, false),
|
||||||
CommandInfo("ono", "remap", MappingMode.O, false),
|
CommandInfo("ono", "remap", MappingMode.O, false),
|
||||||
CommandInfo("ino", "remap", MappingMode.I, false),
|
CommandInfo("ino", "remap", MappingMode.I, false),
|
||||||
CommandInfo("cno", "remap", MappingMode.C, false),
|
CommandInfo("cno", "remap", MappingMode.C, false),
|
||||||
|
Loading…
Reference in New Issue
Block a user