3 ms·
A bit off topic, but how do people usually write code here or on Reddit, I always find it to be really cumbersome to make sure there's two spaces etc in front o
by mewpmewp2 2y ago
A bit off topic, but how do people usually write code here or on Reddit, I always find it to be really cumbersome to make sure there's two spaces etc in front of everything? Is there some formatting tool that I'm not aware of that everyone else uses?
Because in both forums I keep coming back to edits, and it takes forever to edit some of the things, manually. I feel like I'm being stupid or the UX of all of that is just so terrible.
- satvikpendem 2y agoI actually use a formatting tool online if on mobile, or just vim if on the computer, which can add two spaces in front of every line.
- Izkata 2y ago> or just vim if on the computer I use Firefox + Tridactyl + the native extension, so with the cursor in any text field I can hit Ctrl+i and it pops up a gvim window with the contents of that text field. When you save+quit, it copies the contents back into the field. So glad someone figured out how to do this again once Vimperator died.
- steveklabnik 2y agoI write it in play.rust-lang.org, then indent using the vim keybindings. I do this even for not rust code.
- pjmlp 2y agoCode editor and then paste.
- School-Cotton 2y agoI paste the code into an invocation of sed s/^/ /
- jasomill 2y agoSpecifically: 1. Copy code to clipboard. 2. From a shell prompt on macOS, pbpaste | sed 's/^/ /' | pbcopy Linux (Wayland), wl-paste | sed 's/^/ /' | wl-copy Linux (X11), xclip -o -se c | sed 's/^/ /' | xclip -se c Windows (PowerShell), Get-Clipboard | % { $_ -replace '^',' ' } | Set-Clipboard 3. Paste into HN.
- School-Cotton 2y agoThanks, I didn't know about xclip -se c I've been typing out "-selection clipboard" this whole time!