On 2019-10-18, Christian Weisgerber wrote:
> On 2019-10-18, cho...@jtan.com wrote:
>
>> I didn't know [how] ! took movement commands. Thanks. I'll have a play
>> with that one.
>>
>> It's not quite M-q (it's M not C) but I'm using vi after all.
>
> Since 'q' is unused in nvi, I have this in my .nexrc:
>
> map q !}fmt
>
> Close enough to emacs's M-q.
>

I just wanted to add that you can Ctrl-v Enter to produce the ^M at the end.
This way it inputs and executes the command for you.

It could be like this if you want it to press Enter for you:
map q !}fmt^M

I like joining lines before using fmt on a single line, hence the '.'. I had
forgotten about the '}' motion and may need to incorporate that. I also did not
know that the ':' can be omitted.

I currently use:
map gq :.!fmt -w 72^M
map q0 :.!fmt -w 77^M
map q1 :.!fmt -w 69^M
map q2 :.!fmt -w 61^M
map q3 :.!fmt -w 53^M
map qq :.!fmt -w 80^M

Reply via email to