Skip to content

Best way to load arbitrary git command output into the quickfix/location list #2105

Answered by tpope
vyasr asked this question in Q&A
Discussion options

You must be logged in to vote

There's no built-in way to route Git output directly into the quickfix list. I've thought about adding it but it seems extremely unhelpful to do so with the default value of 'errorformat'. For the niches where it's helpful, your 2 step solution gets the job done.

But in terms of solving your actual problem, you can do that much more elegantly by tapping into the FugitiveChanged event, which triggers on every :Git call. Here's an example that operates on the whitespace error checking provided by pre-commit.sample:

function! s:AfterGit() abort
  if !exists('*FugitiveResult')
    return
  endif
  let result = FugitiveResult()
  if !filereadable(get(result, 'file', '')) || get(result.args, 0, ''

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@vyasr
Comment options

@tpope
Comment options

@tpope
Comment options

@vyasr
Comment options

Answer selected by tpope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants