about summary refs log tree commit diff
path: root/init
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2018-06-18T14·39+0200
committerVincent Ambo <mail@tazj.in>2018-06-18T14·39+0200
commitf0dfc8b06de568e57050510a5b56fcbb725a6733 (patch)
treed5429ee24ec27295752503fbf871bf23738ec730 /init
parente743ea28c50ffd8a702b943260f05cbeee642bcc (diff)
feat(functions): Add ivy-browse-repositories function
Quick helper to switch between all relevant projects.
Diffstat (limited to 'init')
-rw-r--r--init/bindings.el1
-rw-r--r--init/functions.el10
-rw-r--r--init/mail-setup.el3
-rw-r--r--init/settings.el4
4 files changed, 16 insertions, 2 deletions
diff --git a/init/bindings.el b/init/bindings.el
index 5918e8f8fc30..cb793f7253ec 100644
--- a/init/bindings.el
+++ b/init/bindings.el
@@ -35,6 +35,7 @@
 
 ;; Magit!
 (global-set-key (kbd "C-c g") 'magit-status)
+(global-set-key (kbd "C-x p") 'ivy-browse-repositories)
 
 ;; Replace standard goto-line with ace-jump-line-mode
 (global-set-key (kbd "M-g g") 'avy-goto-line)
diff --git a/init/functions.el b/init/functions.el
index 4ca7cedb2797..c0169955a19a 100644
--- a/init/functions.el
+++ b/init/functions.el
@@ -195,6 +195,16 @@ Including indent-buffer, which should not be called automatically on save."
                               (run-at-time (password-store-timeout)
                                            nil 'password-store-clear))))))
 
+(defun ivy-browse-repositories ()
+  "Select a git repository and open its associated magit buffer."
+
+  (interactive)
+  (ivy-read "Repository: "
+            (magit-list-repos)
+            :require-match t
+            :sort t
+            :action #'magit-status))
+
 (defun warmup-gpg-agent (arg &optional exit)
   "Function used to warm up the GPG agent before use. This is
    useful in cases where there is no easy way to make pinentry run
diff --git a/init/mail-setup.el b/init/mail-setup.el
index 8db2662d17b3..a277af7dbe97 100644
--- a/init/mail-setup.el
+++ b/init/mail-setup.el
@@ -32,6 +32,9 @@
 (setq mail-host-address (system-name))
 (setq notmuch-mua-cite-function #'message-cite-original-without-signature)
 
+;; Close mail buffers after sending mail
+(setq message-kill-buffer-on-exit t)
+
 ;; Ensure sender is correctly passed to msmtp
 (setq mail-specify-envelope-from t
       message-sendmail-envelope-from 'header
diff --git a/init/settings.el b/init/settings.el
index 1c801cd09a07..5d09dfb4d37d 100644
--- a/init/settings.el
+++ b/init/settings.el
@@ -76,7 +76,7 @@
 (require 'auth-source-pass)
 (auth-source-pass-enable)
 
-;; Close mail buffers after sending mail
-(setq message-kill-buffer-on-exit t)
+;; Configure magit-repository-list
+(setq magit-repository-directories '(("/home/vincent/projects" . 2)))
 
 (provide 'settings)