| I'll share with you this video that I made ~15 years ago. https://youtu.be/PHskKxkM-nA ...pause it before you watch it, look at the video description, and skip to 1m23s. Grab the text from the video description in the editor of your choice, compare the before and after (heck, I'll probably go in and paste the "after/goal" so you don't even have to work at it). Time yourself in your editor of choice to match the "goal" output. Basically: `var $foo, $bar, $baz;` => `$obj = { "foo": $foo, "bar": $bar, "baz": $baz }` ...I randomly did it in about a minute, conveniently and subconsciously, and thought it was worth making a video about it (15 years ago...). Nowadays I see easy fixups (eg: `gv`, maybe a macro...) that would have made it faster, but it's not about the speed, it's about the accuracy! One of the most important "commandlets" of vim is the `.` command: "repeat last edit" In the video when I perform(!) one "change comma into an arrow", I can `n` to "next" to the next anchor point (eg: a `,`) and repeat the edit(!) Cleverly stringing together "edits" into interactive repetitions is like getting tetrises in Tetris (and about as easy, once you know to look for them). vim is not an "editor", it's an interactive programming language for editing text: `:g/def /norm 0fdf ywA #<c-r>"` ...find lines that match `def ...` (slightly sloppily), find the first 'd', find the following '<space>', yank the subsequent word (also could have yanked until a '('), and then append what was yanked as a comment. Why?! Dunno. But like 30 keystrokes and I can edit the whole file to perform that operation, or any other arbitrary operation, and I can repeat that operation on any file I'd like. It's "editing" in the sense that after a certain point you don't think about it, you just do it, and the text transformation isn't polluted by inaccuracies, as "advanced vim" encourages you to repeat, replace, define as opposed to "type". Nowadays with LLM-autocomplete, and the temptation of "whole-git-repo" refactorings like: "change all my uses of list comprehensions to for loops, and use generators, but only for api responses that come from a particular domain" ... yeah, vim feels pretty baroque. ...but when you actually need to do some editing to fix up the mess that was made by the LLM, come talk to me. ;-) |
Select the $, Ctrl+D to select the other ones, then select and copy the identifiers. Took me 28 seconds in total.