Magit split screen
A couple of months ago I started using Magit. Magit is a great interface for Git in Emacs, which lets you work efficiently and with great control. I'm not going to explain how Magit works in this post, so if you're interested in learning more about Magit, take a look at the Magit repository and this great introduction by the Mastering Emacs blog.
The magit split screen comes alive
I was really impressed with Magit and started to use it as my main tool for working with Git. However, I quickly found a few things I needed to improve to make it perfect for my environment. One of those were to have an easy way for opening Magit for several repositories in split screen.
So I put together a simple function that opens Magit for the three repositories I needed in a split screen:
(defun magit-split () (interactive) (progn (magit-status "~/path/to/first/repo") (magit-status "~/path/to/second") (split-window-horizontally) (magit-status "~/path/to/third") (balance-windows)))
This function does the following:
magit-statuscommand for the path that is given as an argument.
- Repeat step 1 with another repo as an argument.
- Split the window horizontally.
magit-statusfor the last repo.
- Balance the windows, so they have the same width.
The function will result in following screen:
As with all my Emacs commands, I've created a shortcut for the
(global-set-key (kbd "C-x C-g") 'magit-split)
So there you have it. My Magit split screen command.