5 ms·
Is there something similar for Emacs?
by Zambyte 3y ago
Is there something similar for Emacs?
- dsr_ 3y agoIt's an external filter, you can run it from emacs. shell-command-on-region, IIRC.
- cylinder714 3y agoThank you for that. I figured Emacs would permit use of external filters, glad to know the actual incantation.
- teddyh 3y agoThe keyboard shortcut is M-| If you want to replace a section of text, not just see the output in another buffer, use C-u M-|
- cylinder714 3y agoYes, that's it exactly.
- ComputerGuru 3y agoI’m not an emacs user but that gives me strong powershell vibes! (Not a derogatory remark.)
- mgdlbp 3y agoM-x eshell Welcome to the Emacs shell /tmp $ set-variable `x 6; echo $x 6 /tmp $ M-: (term "pwsh") PowerShell 7.4.0 PS /tmp> set-variable `x 6; echo $x 6 PS /tmp> Disturbing.
- neilv 3y agoEmacs calls the concept "fill", and has had it as a basic built-in feature for decades. This documentation page "https://www.gnu.org/software/emacs/manual/html_node/emacs/Fill-Commands.html https://www.gnu.org/software/emacs/manual/html_node/emacs/Fi..." doesn't do it justice, because Emacs will often do smart language- and context-appropriate things in different buffer modes. For example, I use this feature heavily to help make my Markdown files appear semi-wysiwyg to anyone viewing them in plain text (e.g., different levels of bulleted/numbered lists are formatted). It also keeps my code comments tidy, and encourages me to keep them up to date, because I don't have to mess with formatting. There's also a command to temporarily set a "fill prefix" based on the point in the current line, such as if you want to fill something differently than how Emacs would do it by default.
- yaantc 3y agoThere a built-in similar function, `fill-paragraph`, tied to M-q. I use it routinely and it's very nice. It has some language smart, and for example understand code comments, and can format comments nicely. It also has smart to recognize line header, and reformat while keeping those headers, with possibly a different first line. So if you introduce item (unnumbered list) with a "-" for example, you can either align the second line to the "-" or to the start of the text after, your choice. `fill-paragraph` will recognize this and stick to your choice when reformatting the paragraph. I can't compare with `par`, which I've never used. But I'm a very happy user of Emacs M-q.