diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2016-11-17 12:50:00 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <msabate@suse.com> | 2016-11-17 12:50:00 +0100 |
| commit | 44a504dc3c8e6171dc066b2c19b7769525388896 (patch) | |
| tree | dba04234c2268a094c6a1ce8d33e0abc24218788 /emacs/settings/init-magit.el | |
| parent | 3e5d6e81072b11c6d7a719cb3f3e484dc61d4c7e (diff) | |
| download | dotfiles-44a504dc3c8e6171dc066b2c19b7769525388896.tar.gz dotfiles-44a504dc3c8e6171dc066b2c19b7769525388896.zip | |
emacs: split init.el into different files
The init.el was about to surpass the 1000 LoC threshold, and it was no
longer easy to structure the code. Thus, I've moved the different pieces
into new files.
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs/settings/init-magit.el')
| -rw-r--r-- | emacs/settings/init-magit.el | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/emacs/settings/init-magit.el b/emacs/settings/init-magit.el new file mode 100644 index 0000000..7ddbc3c --- /dev/null +++ b/emacs/settings/init-magit.el @@ -0,0 +1,56 @@ +;;; init-magit.el --- Magit configuration + +;; Copyright (C) 2016 Miquel Sabaté Solà <mikisabate@gmail.com> +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;;; Commentary: +;; +;; Magit configuration + +;;; Code: + +(require 'use-package) + +(use-package magit + :ensure t + :config + + ; Proper initial states. + (add-hook 'git-commit-mode-hook 'evil-insert-state) + (evil-set-initial-state 'magit-log-edit-mode 'insert) + + ; When showing the status, hide the usually-redundant "branch" section and + ; show the rest. + (add-hook 'magit-section-set-visibility-hook + '(lambda (section) + (if (string= (magit-section-type section) "branch") + 'hide + 'show))) + + (eval-after-load 'evil-leader + '(progn + (evil-leader/set-key "s" 'magit-status) + + (use-package evil-magit + :ensure t + :config + + ; The magit + evil-magit combo messes up some chords, let's fix this. + (evil-define-key 'normal magit-mode-map + "\C-h" 'evil-window-left + "\C-l" 'evil-window-right + "\C-j" 'evil-window-down + "\C-k" 'evil-window-up + "\M-p" 'helm-projectile-switch-project))))) + +(provide 'init-magit) +;;; init-magit.el ends here |
