Open itsmewes opened 4 months ago
Ooh! This is really neat! I've dabbled around in Sublime Text and knew there was an arithmetic modal popup, but never realized it could be used across multiple cursors like this - that definitely makes it more of a valuable feature than I originally thought!
Note that the Arithmetic command is quite powerful because it essentially evaluates any Python expression given there and pre-defines a few local variables for the expression, that being s
for the selected text, i
for the current selection index, and x
for the evaluated selected text if it can be evaluated as Python code (e.g. a number literal). The latter allows to increment each selected number by 1, for example.
Note that the Arithmetic command is quite powerful because it essentially evaluates any Python expression given there and pre-defines a few local variables for the expression, that being
s
for the selected text,i
for the current selection index, andx
for the evaluated selected text if it can be evaluated as Python code (e.g. a number literal). The latter allows to increment each selected number by 1, for example.
yeah, I ended up spending about an afternoon playing around with the arithmetic command and now I totally want it in Zed! 😅
Check for existing issues
Describe the feature
Sublime Text has an Arithmetic command that I find myself using quite a bit. Here is a video describing the command in details, but below are some examples for how I use the command. These examples are extremely simplified, but I think get the point across.
Adding incrementing numbers to lists.
https://github.com/zed-industries/zed/assets/974222/a0f0f988-2f27-4799-8920-2553aeca122e
Adding ids/classes in HTML.
https://github.com/zed-industries/zed/assets/974222/38bdd9ef-37e3-4240-9a57-9018ffb3e206
Adding debugging in multiple places. (This is a contrived example from Laravel where the
dd
call is used for debugging.)https://github.com/zed-industries/zed/assets/974222/97861ae5-92a5-4687-a5bb-56e158ee8288
Setting up multiple array items starting from 0.
https://github.com/zed-industries/zed/assets/974222/735c2550-cfc7-421f-b9da-dd1a2466ffa4
Hopefully something like this can be added to Zed 😊
If applicable, add mockups / screenshots to help present your vision of the feature
No response