On 2025-08-14, Maxim Kim wrote:
> >  I presume that the purpose of this is to allow the user to check for
> errors in their gawk code, but it seems wrong to me to hijack the
> formatting command for that purpose, mainly because doing so
> prevents the user from actually reformatting their code.
> 
> The purpose is to format awk code as far as I know. gq was designed to be used
> with external formatters, to always (almost) use vim's internal formatter, use
> gw
> 
> :help gw
> 
> I have just tried to use formatprg you showed and it works to format awk code 
> I
> grabbed from internet:
> 
> https://asciinema.org/a/QUuoVqgTi25qYIRpUeBucml64
> 
> On Thursday, August 14, 2025 at 5:37:39 PM UTC+10 Maxim Kim wrote:
> 
>     The issue is that gq (with internal formatter) was used to format a
>     comment, now we have formatprg set which in this case formats the code, 
> not
>     comments.
> 
>     The usual substitute is gw -- it should still work. 

gw does allow text to be reformatted without using 'formatprg'.
Thanks for pointing that out.  It's not a replacement for gq,
though, since it leaves the cursor where it was so you can't repeat
commands such as gwj on subsequent lines without also moving the
cursor.

I could train my fingers to use gw instead of gq, but repeating a gq
command by using . is just too convenient to forgo.

I can see now why someone might want to set 'formatprg' to use gawk
-o, but having tried it, I don't particularly like gawk's idea of
"pretty", so I'll keep my workaround.  Thanks for the explanations.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/20250814081632.GI24703%40phoenix.

Raspunde prin e-mail lui