← Back to context

Comment by sirn

19 hours ago

When I still used Git, I used to have a minimized `magit-init.el` that essentially did:

    (setq user-emacs-directory (format "~/.emacs.d/magit/%s/" emacs-version))
    (setq custom-file (concat user-emacs-directory "custom.el"))
    (setq make-backup-files nil)
    (setq auto-save-default nil)
    (setq create-lockfiles nil)
    (setq inhibit-startup-screen t)
    (setq initial-scratch-message nil)

    (require 'magit)
    (defun setup-standalone-magit ()
      (magit-project-status)
      (delete-other-windows))
    (add-hook 'after-init-hook 'setup-standalone-magit)

And a small wrapper (`~/.local/bin/magit`):

    #!/bin/sh
    if [ "$(git rev-parse --is-inside-work-tree)" = "true" ]; then
        exec emacs -nw -q --no-splash -l "/path/to/magit-init.el"
    fi

It worked well for me because I can reuse all my keybindings (evil + leader keys with `general`) and my workflow is fully in the terminal. (I have since moved on to Jujutsu, and `jjui` is filling this gap for me right now, but it's not quite a magit-for-jj).