Skip to content

g:ledger_dangerous_formatprg sets formatprg, but doesn't change gq behavior #177

Closed

Description

@benknoble

gq uses formatexpr over formatprg if both are set, and even with the config mentioned in the title, both are set.

Thus if you really want to use the dangerous formatprg, you have to also setup an ftplugin to unset formatexpr. (Should vim-ledger do this automatically? I'm not sure, hence this issue as a discussion forum.)

Activity

  1. alerque commented on Feb 10, 2026

    @alerque
    Member

    Does #178 do what you expect? Caveat ... I haven't tested it myself yet, hence the draft PR. It might be there is a different way to unset that or perhaps we actually need to add a hook to the function we're binding to formatexpr and have the logic for passing off to the external formatter in there.

    However the implementation needs to work I do think it is reasonable to assume if people set the dangerous option they probably want that to take effect.

  2. benknoble commented on Feb 10, 2026

    @benknoble
    ContributorAuthor

    I'll take a look; at first glance, execute can be dropped. I'll have to go refresh my memory on the various ways to {un,re}set options, though, as I think there's a "correct" way for this case (which might be exactly what you have).

  3. benknoble commented on Feb 12, 2026

    @benknoble
    ContributorAuthor

    Commented on the PR; you're definitely in the right direction :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions