Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bound counsel-git to gff and move magit-find-file to gfF. #12795

Closed
wants to merge 1 commit into from

Conversation

xuhdev
Copy link
Contributor

@xuhdev xuhdev commented Oct 5, 2019

counsel-git find a file in the current git repository. "gff" is
currently bound to magit-find-file. While counsel-git seemingly performs the
same functionality as magit-find-file, they are substantially different:
magit-find-file is not intended to find a file, contrary to what the
name indicates. See magit/magit#3967 for
explanation. This is why we need another key binding for counsel-git.

@xuhdev
Copy link
Contributor Author

xuhdev commented Oct 16, 2019

@duianto

@duianto
Copy link
Collaborator

duianto commented Oct 16, 2019

If magit-find-file isn't intended for finding files. Is there an equivalent command for opening a file in another branch?

I've found it useful, for example when looking at a master branch file while the develop branch is checked out. Maybe there's another way to accomplish the same thing?

I don't think it's to late to swap them. More frequently used commands should require fewer key presses.

Opening a file in a branch seems like an alternate behavior, therefore it's probably better to have it under SPC g f F.

It would also be easier to remember and expect the following behavior.

  • SPC f f finds a file in the current directory.
  • SPC g f f finds a file in the current project (git/version control).

Could you add entries in changelog.develop. At the end of the Key bindings: sub section in
Layer changes and fixes/ivy.
https://github.com/syl20bnr/spacemacs/blob/develop/CHANGELOG.develop#ivy

It could say something like this:

  - Moved =magit-find-file= from ~SPC g f f~ to ~SPC g f F~ (thanks to Hong Xu)
  - Added =counsel-git= to ~SPC g f f~ (thanks to Hong Xu)

And rewrite the outdated commit title and message.

@xuhdev
Copy link
Contributor Author

xuhdev commented Oct 16, 2019

magit-find-file is intended for opening a file in another branch, but this will be read-only and is very different from the expectation of the regular find-file. It is indeed useful, but I think it's less useful than a counsel-git, which limits the scope to the working directory but confers full editing power. I also agree with you on the easiness to remember the key bindings.

I will make the suggested changes.

counsel-git find a file in the current git repository. "gff" is
currently bound to magit-find-file. While counsel-git seemingly performs the
same functionality as magit-find-file, they are substantially different:
magit-find-file is not intended to find a file, contrary to what the
name indicates. See magit/magit#3967 for
explanation. This is why we need another key binding for counsel-git.
@xuhdev xuhdev changed the title Bound counsel-git to gfF. Bound counsel-git to gff and move magit-find-file to gfF. Oct 16, 2019
@xuhdev
Copy link
Contributor Author

xuhdev commented Oct 16, 2019

@duianto Updated

@duianto
Copy link
Collaborator

duianto commented Oct 16, 2019

Thank you for contributing to Spacemacs. It's safe to delete your branch.
The PRs changes have been cherry picked into the develop branch. e37b70c

Nice catch. Your right the magit-find-file changelog entry goes in the git section.

@duianto duianto closed this Oct 16, 2019
@Miciah
Copy link
Contributor

Miciah commented Oct 16, 2019

I use SPC g f f (magit-find-file) to look at a file from another branch, and I use SPC p f (helm-projectile-find-file / counsel-projectile-find-file) to find a file from the current Git repository. Does counsel-git provide any benefit over projectile-find-file?

@xuhdev xuhdev deleted the counsel-git branch October 17, 2019 03:37
@xuhdev
Copy link
Contributor Author

xuhdev commented Oct 17, 2019

@Miciah counsel-projectle-find-file seems to find any file in in the project, while counsel-git only finds files indexed by git.

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.

None yet

3 participants