Hard wrap and pipe to external command

Post Reply
smartmic
Posts: 8
Joined: 16.11.2021 10:11

Hard wrap and pipe to external command

Post by smartmic »

Hi again,
there is the 'word-wrap mode' which can also use a margin for wrapping text. However, this is a soft wrap. I am wondering if it is possible to hard wrap text around a defined margin. With hard wrapping I mean that the editor will insert newlines. In other editors, such a functionality is often built in or delegated to an (external) formatter command. By the way, can I pass a selection to an external command as filter (e.g. pipe a text to stdin of the `fmt` command and insert its stdout)?
Kind regards,
—Martin
main Alexey
Posts: 2308
Joined: 25.08.2021 18:15

Post by main Alexey »

if it is possible to hard wrap text around a defined margin.
Plugin CudaExt has the command for this. in the Command Palette:
plugin: Cuda-Ext: Align: Re-wrap/split lines by margin.

It does the work on every call, not during the typing.
By the way, can I pass a selection to an external command as filter (e.g. pipe a text to stdin of the `fmt` command and insert its stdout)?
Plugin External Tools supports this for its tools. In the 'Tools properties" dialog (in the Tools top menu item), press "Add", find macro: {SelectedText}

https://wiki.freepascal.org/CudaText_pl ... rnal_Tools

Plugin Runner maybe supports this too,
https://wiki.freepascal.org/CudaText_plugins#Runner
Post Reply