helix
helix copied to clipboard
feat: Commands for aligning text. `:align-text-left`, `:align-text-right` and `:align-text-center`
This PR adds:
:align-text-centerto center text (alias:atc):align-text-leftto align text to the left (alias:atl):align-text-rightto align text to the right (alias:atr)
Showcase:
https://github.com/user-attachments/assets/697e76f5-5a4b-4fe2-b19f-4a7a39881d05
All commands also take a parameter that allows you to specify what text width to use. If you don't use this parameter, it follows language config -> editor config text_width setting.
Hi! This PR would be so important for my workflow. I just want to add that I built this branch and it seems to be working perfectly.
Note:
I thought about collapsing all :align-text-* commands into a single :align-text with flags --left, --right and --center
I don't think it's a good idea because all the flags are mutually exclusive
And :align-text-left takes 0 arguments while -right and -center take 1 argument
Added tests for each command
Note:
I thought about collapsing all
:align-text-*commands into a single:align-textwith flags--left,--rightand--centerI don't think it's a good idea because all the flags are mutually exclusive And
:align-text-lefttakes 0 arguments while-rightand-centertake 1 argument
There's however a good benefit of collapsing the commands.
I could map a single key to :align-text -- and at the command prompt either type or use tab key to select how I want to be aligned.
Maybe such a command could be added in addition to the three separate ones?