0

I just install Emacs with magit & git-gutter. Initialise a git repo then create and manipulate some files but I cannot see any sign. I hit

magit-status Then stage and commit and make some changes (add, modify and delete lines) then save but nothing happen.

My init.el:

(use-package magit
 :ensure t)
(use-package git-gutter
  :ensure t)

(require 'git-gutter)

;; If you enable global minor mode
(global-git-gutter-mode t)

;; If you would like to use git-gutter.el and linum-mode
(git-gutter:linum-setup)

(custom-set-variables
 '(git-gutter:update-interval 2))

(custom-set-variables
 '(git-gutter:modified-sign "=") ;; two space
 '(git-gutter:added-sign "+")    ;; multiple character is OK
 '(git-gutter:deleted-sign "-"))

(set-face-background 'git-gutter:modified "#0174fc") ;; background color
(set-face-foreground 'git-gutter:added "#64a888")
(set-face-foreground 'git-gutter:deleted "#c5332c")

I dont have any other packages installed.

enter image description here

Emacs 27.1 (build1, x86_64_pc-linux-gnu) GTK+ Version 3.24.30, cairo version 1.16.0)

2
  • 2
    Calling require is unnecessary as you have already called use-package for it, but that won’t prevent it from working either. Calling (global-git-gutter-mode t) was all I needed to do to get it working, but then I don’t use linum-mode. Perhaps they don’t work together properly? The webpage says that this is experimental, so perhaps try without it.
    – db48x
    Commented Nov 22, 2022 at 12:44
  • I disabled linum-mode and seems working fine. Thank
    – mcp
    Commented Nov 27, 2022 at 8:17

1 Answer 1

0

Here is an example of proper way to do with use-package

(use-package magit
  :ensure t
  :config
  (setq magit-push-always-verify nil)
  (setq git-commit-summary-max-length 50)
  :bind ("C-x g" . magit-status))

(use-package git-gutter
  :ensure t
  :hook ((prog-mode org-mode) . git-gutter-mode )
  :config
  (setq git-gutter:update-interval 2)
  (setq git-gutter:modified-sign "†")
  (setq git-gutter:added-sign "†")
  (setq git-gutter:deleted-sign "†")
  (set-face-foreground 'git-gutter:added "Green")
  (set-face-foreground 'git-gutter:modified "Gold")
  (set-face-foreground 'git-gutter:deleted "Red"))

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.