On 2025-08-14, Christian Brabandt wrote:
> On Mi, 13 Aug 2025, Gary Johnson wrote:
> 
> > I recently discovered the g:awk_is_gawk variable and set it to 1 in
> > my vimrc since I use gawk rather than awk almost exclusively.
> > Sometime later, I tried reformatting a comment in a file of gawk
> > code using gqj and nothing happened.  Also, the following was left
> > on the command line.
> > 
> >     :.,.+1!gawk -f- -o/dev/stdout
> > 
> > I found the source of the problem to be this line in
> > ftplugin/awk.vim:
> > 
> >     setlocal formatprg=gawk\ -f-\ -o/dev/stdout
> > 
> > which is executed if g:awk_is_gawk exists and the OS is Unix-like.
> > (The line was added at commit d58a3bf7d on Sept. 28, 2020.)
> > 
> > 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.
> 
> Not sure I understand, what exactly the problem is. According to my 
> understanding of the gawk man page, gawk -o should do pretty-printing, 
> so isn't the above correct for re-formatting?

The problem is that gawk -o doesn't reformat the text within
comments as the default internal format function does.  That's what
I expect the gq command to do.  There is no other way to access that
internal function than to use the gq command with an empty
'formatprg', whereas there are other means to execute
a pretty-printer on a buffer.

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/20250814075135.GH24703%40phoenix.

Raspunde prin e-mail lui