4 ms·
I spend many hours of each day ~programming~ wrangling text files and I use macos + zsh + textmate2 for my daily drivers. I see shell as an important proficien
by larkinrichards 6y ago
I spend many hours of each day ~programming~ wrangling text files and I use macos + zsh + textmate2 for my daily drivers. I see shell as an important proficiency because it helps maintain a lower-level understanding of how the "magical" GUI "works," which often helps in debugging obtuse errors, and I'm sad to encounter more engineers who are completely unfamiliar with it.
When it comes to examples like that posted by the OP, I like the combination of piping/pasting to mate and multi-caret editing for most scenarios where others would reach for awk/xargs.
Here's me following the same example scenario but with multi-caret editing (slowed down slightly):
https://user-images.githubusercontent.com/226503/101993951-6480cb80-3c73-11eb-9608-c6912011954b.gif https://user-images.githubusercontent.com/226503/101993951-6...
Step by step:
1. git status -s | mate
2. select " D" with arrow keys + shift
3. command-E macos default for "use selection to find"
4. option-command-F to find all (multi-caret editing starts)
5. type "git checkout" to replace " D"
6. command-left to move cursor to start of line, then shift-command-right to select to end of line.
7. copy
8. select all + delete (clear document)
9. paste,
10. press return to insert newlines
11. select all + copy
12. switch back to terminal
13. paste
To me, this is many small steps, but each step is more mechanical and flows naturally, and the general flexibility of multi-caret editing means it is applicable more often in my daily work.
- doppioandante 6y agoThis is exactly how I would have done it, just using my editor of choice (kakoune) instead. I also wrote on Drew's mailing list in case anyone is interested: https://lists.sr.ht/~sircmpwn/public-inbox/%3CCAKW6382rV5iW28YfyK%2BUsAfX3%2BLzYNQXetW3B2qd%3D7cZ5LjNDg%40mail.gmail.com%3E https://lists.sr.ht/~sircmpwn/public-inbox/%3CCAKW6382rV5iW2...