0

Powerline shows git branch information for a buffer that are under version control vc-mode. Only when vc-mode is set for a buffer the Git branch information is displayed. When inside dired there is no Version Control information shown. Is there a way to enable vc-mode for dired so that at least the branch information is shown without needing to patch powerline.el ?

To visualize what I mean: This is the powerline for buffers that have vc-mode set: enter image description here The powerline for the dired buffer has no vc-mode set and the branch information is missing: enter image description here

1 Answer 1

0

One possibility is to patch powerline.el using:

modified .emacs.d/lisp/lib/powerline.el @@ -473,14 +473,27 @@ static char * %s[] = { 'local-map (make-mode-line-mouse-map 'mouse-1 'mode-line-widen)))) + +(require 'vc-git) + ;;;###autoload (autoload 'powerline-vc "powerline") (defpowerline powerline-vc - (when (and (buffer-file-name (current-buffer)) vc-mode) + (cond + ((and (symbolp 'major-mode) (string-equal major-mode 'dired-mode) + (vc-git-root default-directory)) + (progn + (vc-mode-line default-directory 'Git) + (format " %s%s" + (char-to-string #xe0a0) + (format-mode-line '(vc-mode vc-mode))))) + ((and (buffer-file-name (current-buffer)) vc-mode) (if (and window-system (not powerline-gui-use-vcs-glyph)) (format-mode-line '(vc-mode vc-mode)) (format " %s%s" (char-to-string #xe0a0) - (format-mode-line '(vc-mode vc-mode)))))) + (format-mode-line '(vc-mode vc-mode)))) + ) + )) ;;;###autoload (autoload 'powerline-encoding "powerline") (defpowerline powerline-encoding 

This makes revision appear inside dired. Using vc-git-root to verify it is a git directory and (vc-mode-line default-directory 'Git) to initialize vc-mode. I wonder weather there is a better solution than this?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.