Description
I suggest that there would be keyboard commands to jump to the beginning and end of the enclosing square brackets. I present them here as Alt+Home and Alt+End, but they can change accoding to what is viable. There would be also Alt+Shift+Home and Alt+Shift+End which would move the cursor in the same way but also select the text between the old position and the new position.
I suggest that they would behave so (where the vertical bar | represents the text cursor):
- Pressing Alt+Home would move the cursor to the inner side of the innermost opening square bracket enclosing the cursor.
Alt+Home →
- Analogically, pressing Alt+End would move the cursor to the inner side of the innermost closing square bracket enclosing the cursor.
Alt+End →
- This would work regardless of lines.
#quote[a wise|
multiline quote]
Alt+End →
#quote[a wise
multiline quote|]
- Nested brackets would be skipped.
#title[title| with a #smallcaps[small capital] part]
Alt+End →
#title[title with a #smallcaps[small-cap] part|]
- If the cursor already is at the inner side of a square bracket, such movement in the direction of the bracket would move the cursor out of the bracket. I don't know how to word this better, but the idea is that pressing the key combination again would move the cursor to successively outer brackets.
#title[title with a #smallcaps[|small-cap] part]
Alt+Home →
#title[|title with a #smallcaps[small capital] part]
- If there are no outer square brackets, the cursor jumps to the beginning or end of the file. I do not consider this useful, but it is an intuitive extension of the behavior.
some text
on multiple| lines
Alt+Home →
|some text
on multiple lines
I intend to use this for working with pieces of content, but I do not see any downside of that it would work the same way with other brackets, and it may be easier to implement it for all types of brackets at once.
Use Case
Typst is structured as pieces of content, and these pieces are delimited from outer code by square brackets. I often meet cases where I edit multiple pieces of content, and moving in them is not practical. Home and End are used to jump to the beginning and end of the line, but limits of content in typst do not correspond to lines in source code. So keyboard commands for jumping to delimiting brackets would improve my workflow significantly.
A realistic example is that I want to replace a content argument of a function like this:
#figure(
image("glacier.jpg"),
caption: [A curious figure.],
)
I want to change the caption. I cannot use selection by words using Ctrl+Shift+arrows or double click because I would either omit the period or select also the right bracket. So I have to select it by characters. After I select the text, I can overwrite it with new text.
With my proposal, I could click anywhere in the caption, press Alt+Home, Alt+Shift+End and write the new text.
This is amplified while using functions with multiple content arguments.
Description
I suggest that there would be keyboard commands to jump to the beginning and end of the enclosing square brackets. I present them here as Alt+Home and Alt+End, but they can change accoding to what is viable. There would be also Alt+Shift+Home and Alt+Shift+End which would move the cursor in the same way but also select the text between the old position and the new position.
I suggest that they would behave so (where the vertical bar
|represents the text cursor):I intend to use this for working with pieces of content, but I do not see any downside of that it would work the same way with other brackets, and it may be easier to implement it for all types of brackets at once.
Use Case
Typst is structured as pieces of content, and these pieces are delimited from outer code by square brackets. I often meet cases where I edit multiple pieces of content, and moving in them is not practical. Home and End are used to jump to the beginning and end of the line, but limits of content in typst do not correspond to lines in source code. So keyboard commands for jumping to delimiting brackets would improve my workflow significantly.
A realistic example is that I want to replace a content argument of a function like this:
I want to change the caption. I cannot use selection by words using Ctrl+Shift+arrows or double click because I would either omit the period or select also the right bracket. So I have to select it by characters. After I select the text, I can overwrite it with new text.
With my proposal, I could click anywhere in the caption, press Alt+Home, Alt+Shift+End and write the new text.
This is amplified while using functions with multiple content arguments.