Vico home blog download feedback

Automatically hard-wrap text

There's a question if Vico can automatically hard-wrap text at a certain column. Vim can do this when the textwidth setting is non-zero.

This setting is not natively supported by Vico, so the natural follow up question was: "But can I script it?".

It turns out it can be scripted by listening to the "didModifyDocument" event, and inserting a newline when the line is too long, just like suggested:

Comments

Excellent! Thank you!

Is it possible to have this work in source code? Whatever Vico uses for standard indentation rules when I press enter seems fine to me. Also, I can't seem to get this to eval (even in a .txt file). Could you explain with more detail how to eval this stuff? (Or maybe have it in an auto-loaded .nu file)?

From the Vico menu, select Edit Site Script, paste it in and restart Vico.

If you want to enable this for all document types, remove the (((doc language) name) hasPrefix:"text.") condition. I think it would be annoying for source code though.

Is there a way to get this script to respect indentation rules for source code?

Add a new comment