Skip to content

Conversation

@Konfekt
Copy link
Contributor

@Konfekt Konfekt commented Dec 8, 2025

Let :GFiles take a count to restrict to those files altered in last commits.
Count 0 corresponds to :GFiles? kept for backwards compatibility.
Builds in this snippet

Konfekt referenced this pull request in jparise/dotfiles Dec 9, 2025
Unfortunately, in its current form, matchit is not able to support
Python's `if` syntax. It expects there to be a reliable "end" pattern,
whereas Python allows either `elif` and `else` to be the final keyword
(which zero or more `elif`s in between).

Given that, remove this partial support until its possible to implement
a more complete solution.
@Konfekt
Copy link
Contributor Author

Konfekt commented Dec 21, 2025

Glad to see you generalizing this in junegunn/fzf-git.sh#104

"last N" commits, which to me feels a bit arbitrary and restrictive.

I agree that there's only so much one can restrict to given a single number (though often the more recent commits are usually the ones one is most concerned with); so it came to my mind that Vim allows for more general contiguous ranges. Would a rangen,m for the files changed in between the nth and mth commit make this sufficiently generally applicable? That's also likely as general as it gets to be able to display the diffs of these files changed in a set of commits.

@junegunn
Copy link
Owner

Thanks.

Would a rangen,m for the files changed in between the nth and mth commit make this sufficiently generally applicable?

I'm not sure. The commits can be non-contiguous? It feels like we might be trying to overload the :GFiles command a bit too much, which could make its behavior harder to reason about.

Defining a command that does what the suggested :[X]Gfiles isn't particularly complicated. So until we have a clearer idea of what we want to do, users can use a custom command tailored to their needs. For example:

command! -nargs=1 GDT call fzf#run(fzf#wrap({
  \ 'source': printf("git diff-tree --no-commit-id --name-only -r 'HEAD~%d..HEAD'", <q-args>),
  \ 'options': ['--multi', '--preview', printf('git diff --color=always "HEAD~%d..HEAD" -- {}', <q-args>)]}))

@Konfekt
Copy link
Contributor Author

Konfekt commented Dec 28, 2025

commits can be non-contiguous?

Maybe, but at least with a HEAD~n...HEAD~m there's a chance; necessary, not sufficient a condition as in math speak.

It feels like we might be trying to overload the :GFiles command a bit too much

I had that feeling for :Gfiles? which demands special parsing and seems more coherently labeled 0Gfiles.

users can use a custom command tailored to their needs

Wow, that's indeed much simpler than my involved snippet (@jparise might be interested as well).

I will try to package it into a command taking the n,m range and falling back to :Gfiles for no range given; maybe that's where much code went into

@junegunn
Copy link
Owner

Maybe, but at least with a HEADn...HEADm there's a chance

Oh, I mean, there can be cases where the user might want to see the list of modified files from non-continguous commits, which is supported in junegunn/fzf-git.sh#104. e.g. <ctrl-g><ctrl-h> ... select commits with <tab>s ... press <alt-f> to list files.

I had that feeling for :Gfiles? which demands special parsing and seems more coherently labeled 0Gfiles.

Right. Probably not the best decision I made :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants