Function: vc-dir-mode
vc-dir-mode is an interactive and byte-compiled function defined in
vc-dir.el.gz.
Signature
(vc-dir-mode)
Documentation
Major mode for VC directory buffers.
Marking/Unmarking key bindings and actions: m (vc-dir-mark) - mark a file/directory
- if the region is active, mark all the files in region.
Restrictions: - a file cannot be marked if any parent directory is marked
- a directory cannot be marked if any child file or
directory is marked
u (vc-dir-unmark) - unmark a file/directory
- if the region is active, unmark all the files in region.
M (vc-dir-mark-all-files) - if the cursor is on a file: mark all the files with the same state as
the current file
- if the cursor is on a directory: mark all child files
- with a prefix argument: mark all files
U (vc-dir-unmark-all-files) - if the cursor is on a file: unmark all the files with the same state
as the current file
- if the cursor is on a directory: unmark all child files
- with a prefix argument: unmark all files
VC commands
VC commands in the C-x v (vc-prefix-map) prefix can be used.
VC commands act on the marked entries. If nothing is marked, VC
commands act on the current entry.
Search & Replace
S (vc-dir-search) - searches the marked files
Q (vc-dir-query-replace-regexp) - does a query replace on the marked files
M-s a C-s (vc-dir-isearch) - does an isearch on the marked files
M-s a C-M-s (vc-dir-isearch-regexp) - does a regexp isearch on the marked files
If nothing is marked, these commands act on the current entry.
When a directory is current or marked, the Search & Replace
commands act on the child files of that directory that are displayed in
the *vc-dir* buffer.
% m vc-dir-mark-by-regexp
* % vc-dir-mark-by-regexp
* r vc-dir-mark-registered-files
+ vc-pull
<backtab> vc-dir-previous-directory
<down-mouse-3> vc-dir-menu
<follow-link> mouse-face
= vc-diff
C-<down> vc-dir-next-directory
C-<up> vc-dir-previous-directory
C-c C-c vc-dir-kill-dir-status-process
C-k vc-dir-kill-line
C-o vc-dir-display-file
D vc-root-diff
DEL vc-dir-unmark-file-up
G vc-dir-ignore
I vc-log-incoming
L vc-print-root-log
M vc-dir-mark-all-files
M-DEL vc-dir-unmark-all-files
M-s a C-M-s vc-dir-isearch-regexp
M-s a C-s vc-dir-isearch
M-{ vc-dir-previous-directory
M-} vc-dir-next-directory
O vc-log-outgoing
P vc-push
Q vc-dir-query-replace-regexp
RET vc-dir-find-file
S vc-dir-search
S-SPC vc-dir-previous-line
SPC vc-dir-next-line
TAB vc-dir-next-directory
U vc-dir-unmark-all-files
b L vc-print-root-branch-log
b c vc-create-branch
b l vc-print-fileset-branch-log
b s vc-switch-branch
d vc-dir-delete-file
e vc-dir-find-file
f vc-dir-find-file
i vc-register
l vc-print-log
m vc-dir-mark
n vc-dir-next-line
o vc-dir-find-file-other-window
p vc-dir-previous-line
u vc-dir-unmark
v vc-next-action
x vc-dir-hide-up-to-date
In addition to any hooks its parent mode special-mode might have run,
this mode runs the hook vc-dir-mode-hook, as the final or penultimate
step during initialization.
Probably introduced at or before Emacs version 26.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-dir.el.gz
(defvar use-vc-backend) ;; dynamically bound
(define-derived-mode vc-dir-mode special-mode "VC dir"
"Major mode for VC directory buffers.
Marking/Unmarking key bindings and actions: \\<vc-dir-mode-map>
\\[vc-dir-mark] - mark a file/directory
- if the region is active, mark all the files in region.
Restrictions: - a file cannot be marked if any parent directory is marked
- a directory cannot be marked if any child file or
directory is marked
\\[vc-dir-unmark] - unmark a file/directory
- if the region is active, unmark all the files in region.
\\[vc-dir-mark-all-files] - if the cursor is on a file: mark all the files with the same state as
the current file
- if the cursor is on a directory: mark all child files
- with a prefix argument: mark all files
\\[vc-dir-unmark-all-files] - if the cursor is on a file: unmark all the files with the same state
as the current file
- if the cursor is on a directory: unmark all child files
- with a prefix argument: unmark all files
VC commands
VC commands in the \\[vc-prefix-map] prefix can be used.
VC commands act on the marked entries. If nothing is marked, VC
commands act on the current entry.
Search & Replace
\\[vc-dir-search] - searches the marked files
\\[vc-dir-query-replace-regexp] - does a query replace on the marked files
\\[vc-dir-isearch] - does an isearch on the marked files
\\[vc-dir-isearch-regexp] - does a regexp isearch on the marked files
If nothing is marked, these commands act on the current entry.
When a directory is current or marked, the Search & Replace
commands act on the child files of that directory that are displayed in
the *vc-dir* buffer.
\\{vc-dir-mode-map}"
(setq-local vc-dir-backend use-vc-backend)
(setq-local desktop-save-buffer 'vc-dir-desktop-buffer-misc-data)
(setq-local bookmark-make-record-function #'vc-dir-bookmark-make-record)
(setq-local project-find-matching-buffer-function #'vc-dir-find-matching-buffer)
(setq buffer-read-only t)
(when (boundp 'tool-bar-map)
(setq-local tool-bar-map vc-dir-tool-bar-map))
(let ((buffer-read-only nil))
(erase-buffer)
(setq-local vc-dir-process-buffer nil)
(setq-local vc-ewoc (ewoc-create #'vc-dir-printer))
(setq-local revert-buffer-function 'vc-dir-revert-buffer-function)
(setq list-buffers-directory (expand-file-name "*vc-dir*" default-directory))
(add-to-list 'vc-dir-buffers (current-buffer))
;; Make sure that if the directory buffer is killed, the update
;; process running in the background is also killed.
(add-hook 'kill-buffer-query-functions #'vc-dir-kill-query nil t)
(hack-dir-local-variables-non-file-buffer)
(vc-dir-refresh)))