vim: Support ranges in command (#15985)
The most requested feature here is "search and replace in visual mode", but as a happy side effect we can now support things like :2,12j to join those lines, and much much more. Release Notes: - vim: Added support for range syntax in command ([#9428](https://github.com/zed-industries/zed/issues/9428)). - vim: Prefill command with `:'<,'>` from visual mode ([#13535](https://github.com/zed-industries/zed/issues/13535)).
This commit is contained in:
parent
b7d6b0a096
commit
bd59af1df5
10 changed files with 671 additions and 201 deletions
28
crates/vim/test_data/test_command_ranges.json
Normal file
28
crates/vim/test_data/test_command_ranges.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{"Put":{"state":"ˇ1\n2\n3\n4\n4\n3\n2\n1"}}
|
||||
{"Key":":"}
|
||||
{"Key":"2"}
|
||||
{"Key":","}
|
||||
{"Key":"4"}
|
||||
{"Key":"d"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\nˇ4\n3\n2\n1","mode":"Normal"}}
|
||||
{"Key":":"}
|
||||
{"Key":"2"}
|
||||
{"Key":","}
|
||||
{"Key":"4"}
|
||||
{"Key":"s"}
|
||||
{"Key":"o"}
|
||||
{"Key":"r"}
|
||||
{"Key":"t"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\nˇ2\n3\n4\n1","mode":"Normal"}}
|
||||
{"Key":":"}
|
||||
{"Key":"2"}
|
||||
{"Key":","}
|
||||
{"Key":"4"}
|
||||
{"Key":"j"}
|
||||
{"Key":"o"}
|
||||
{"Key":"i"}
|
||||
{"Key":"n"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\nˇ2 3 4\n1","mode":"Normal"}}
|
12
crates/vim/test_data/test_command_visual_replace.json
Normal file
12
crates/vim/test_data/test_command_visual_replace.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{"Put":{"state":"ˇ1\n2\n3\n4\n4\n3\n2\n1"}}
|
||||
{"Key":"v"}
|
||||
{"Key":"2"}
|
||||
{"Key":"j"}
|
||||
{"Key":":"}
|
||||
{"Key":"s"}
|
||||
{"Key":"/"}
|
||||
{"Key":"."}
|
||||
{"Key":"/"}
|
||||
{"Key":"k"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"k\nk\nˇk\n4\n4\n3\n2\n1","mode":"Normal"}}
|
21
crates/vim/test_data/test_offsets.json
Normal file
21
crates/vim/test_data/test_offsets.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{"Put":{"state":"ˇ1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n"}}
|
||||
{"Key":":"}
|
||||
{"Key":"+"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\nˇ2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n","mode":"Normal"}}
|
||||
{"Key":":"}
|
||||
{"Key":"1"}
|
||||
{"Key":"0"}
|
||||
{"Key":"-"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\n2\n3\n4\n5\n6\n7\n8\nˇ9\n10\n11\n","mode":"Normal"}}
|
||||
{"Key":":"}
|
||||
{"Key":"."}
|
||||
{"Key":"-"}
|
||||
{"Key":"2"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\n2\n3\n4\n5\n6\nˇ7\n8\n9\n10\n11\n","mode":"Normal"}}
|
||||
{"Key":":"}
|
||||
{"Key":"%"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\nˇ","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue