Add Vim digraphs (#14887)
Vim digraphs are a way to insert special characters using sequences of two ASCII characters. I've implemented the feature using a new `Digraph` operator, following the example of `AddSurrounds`. There are still a few issues that I'm not sure what the best way to resolve them is. - To insert `ş`, the user must pause between pressing `ctrl-k` and `s ,`, otherwise it triggers the binding for `ctrl-k s`. Is there a way to disable `ctrl-k *` bindings while in insert, replace or waiting mode? - Is there a better way to insert a string at all of the cursors? At the moment I'm constructing the edits manually. - The table of default digraphs is a 1.4k line rust expression. Is this okay as long as it's in its own module? - I'd like a second opinion on how best to structure the settings.json entry. - I have omitted the "meta character" feature as I don't think it makes sense when editing UTF-8 text. Release Notes: - Added support for Vim digraphs. Resolves #11871
This commit is contained in:
parent
b87028956f
commit
26d0a33e79
14 changed files with 1613 additions and 2 deletions
12
crates/vim/test_data/test_digraph_find.json
Normal file
12
crates/vim/test_data/test_digraph_find.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{"Put":{"state":"ˇHellö world"}}
|
||||
{"Key":"f"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"o"}
|
||||
{"Key":":"}
|
||||
{"Get":{"state":"Hellˇö world","mode":"Normal"}}
|
||||
{"Put":{"state":"ˇHellö world"}}
|
||||
{"Key":"t"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"o"}
|
||||
{"Key":":"}
|
||||
{"Get":{"state":"Helˇlö world","mode":"Normal"}}
|
21
crates/vim/test_data/test_digraph_insert_mode.json
Normal file
21
crates/vim/test_data/test_digraph_insert_mode.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{"Put":{"state":"Hellˇo"}}
|
||||
{"Key":"a"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"o"}
|
||||
{"Key":":"}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"Helloˇö","mode":"Normal"}}
|
||||
{"Put":{"state":"Hellˇo"}}
|
||||
{"Key":"a"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":":"}
|
||||
{"Key":"o"}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"Helloˇö","mode":"Normal"}}
|
||||
{"Put":{"state":"Hellˇo"}}
|
||||
{"Key":"i"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"o"}
|
||||
{"Key":":"}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"Hellˇöo","mode":"Normal"}}
|
7
crates/vim/test_data/test_digraph_keymap_conflict.json
Normal file
7
crates/vim/test_data/test_digraph_keymap_conflict.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{"Put":{"state":"Hellˇo"}}
|
||||
{"Key":"a"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"s"}
|
||||
{"Key":","}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"Helloˇş","mode":"Normal"}}
|
6
crates/vim/test_data/test_digraph_replace.json
Normal file
6
crates/vim/test_data/test_digraph_replace.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{"Put":{"state":"Hellˇo"}}
|
||||
{"Key":"r"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"o"}
|
||||
{"Key":":"}
|
||||
{"Get":{"state":"Hellˇö","mode":"Normal"}}
|
19
crates/vim/test_data/test_digraph_replace_mode.json
Normal file
19
crates/vim/test_data/test_digraph_replace_mode.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{"Put":{"state":"ˇHello"}}
|
||||
{"Key":"shift-r"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"a"}
|
||||
{"Key":"'"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"e"}
|
||||
{"Key":"`"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"i"}
|
||||
{"Key":":"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"o"}
|
||||
{"Key":"~"}
|
||||
{"Key":"ctrl-k"}
|
||||
{"Key":"u"}
|
||||
{"Key":"-"}
|
||||
{"Key":"escape"}
|
||||
{"Get":{"state":"áèïõˇū","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue