0

I want to rename a number of tracked but unchanged files via magit. I know that I can use R (magit-file-rename). However, magit-status does not show me unchanged files.

How can I toggle the visibility of the unchanged files?

1 Answer 1

1

You can add a section with 'tracked-files' to the git status buffer using

(magit-add-section-hook 'magit-status-sections-hook
                        #'magit-insert-tracked-files nil t)

(refresh the git-status buffer after adding the hook function).

Read the docstring of magit-add-section-hook to find how to control the insert location of the new section.

I guess there is no need to 'toggle' it as you can just fold/unfold the section.

Toggling the section is not supported, you would have to write your own function for that.

B.t.w. there is also the vc-dir command (C-x v d), which might be more useful for listing files in a single dir (and there is vc-rename-file also).

2
  • I was thinking I could toggle the visibility of the section, but as you point out, folding and unfolding the section is sufficient. Regarding vc-dir, something seems to be wrong with my setup. The VC-Backend, working dir, branch and stash status are OK, but the remote is missing and, more importantly, no files or directories are listed, just ./.
    – loris
    Commented Nov 1, 2022 at 9:23
  • I think vc-dir lets you choose a single directory to list. That's why I mentioned it might be handier 'only' when listing files in a single dir. I am otherwise not sure how it works, I have never used it (just found it while answering here) Commented Nov 1, 2022 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.