emacs: yasnippet: don’t expand on SPC in git-commit-mode
[~bandali/configs] / .emacs.d / init.el
index cc01a13..6210f90 100644 (file)
@@ -559,15 +559,19 @@ For disabling the behaviour for certain buffers and/or modes."
 ;; *the* right way to do git
 (use-package magit
   :defer 0.5
 ;; *the* right way to do git
 (use-package magit
   :defer 0.5
-  :bind (("C-x g g" . magit-status)
-         ("C-x g s" . magit-status)
-         ("C-x g b" . magit-blame-addition)
-         ("C-x g l" . magit-log-buffer-file))
+  :bind (("C-c g g" . magit-status)
+         ("C-c g s" . magit-status)
+         ("C-c g b" . magit-blame-addition)
+         ("C-c g l" . magit-log-buffer-file))
   :config
   (magit-add-section-hook 'magit-status-sections-hook
                           'magit-insert-modules
                           'magit-insert-stashes
                           'append)
   :config
   (magit-add-section-hook 'magit-status-sections-hook
                           'magit-insert-modules
                           'magit-insert-stashes
                           'append)
+  ;; (magit-add-section-hook 'magit-status-sections-hook
+  ;;                         'magit-insert-ignored-files
+  ;;                         'magit-insert-untracked-files
+  ;;                         'append)
   (setq magit-repository-directories '(("~/" . 0)
                                        ("~/src/git/" . 1)))
   (nconc magit-section-initial-visibility-alist
   (setq magit-repository-directories '(("~/" . 0)
                                        ("~/src/git/" . 1)))
   (nconc magit-section-initial-visibility-alist
@@ -1258,6 +1262,7 @@ This function is intended for use with `ivy-ignore-buffers'."
     "C-c e"   "eval"
     "C-c f"   "files"
     "C-c F"   "frames"
     "C-c e"   "eval"
     "C-c f"   "files"
     "C-c F"   "frames"
+    "C-c g"   "magit"
     "C-S-h"   "help(ful)"
     "C-c m"   "multiple-cursors"
     "C-c P"   "projectile"
     "C-S-h"   "help(ful)"
     "C-c m"   "multiple-cursors"
     "C-c P"   "projectile"
@@ -1267,7 +1272,7 @@ This function is intended for use with `ivy-ignore-buffers'."
     "C-c q"   "boxquote"
     "C-c t"   "themes"
     ;; "s-O"     "outline"
     "C-c q"   "boxquote"
     "C-c t"   "themes"
     ;; "s-O"     "outline"
-    "C-x g"   "magit")
+    )
 
   ;; prefixes for major modes
   (which-key-add-major-mode-key-based-replacements 'message-mode
 
   ;; prefixes for major modes
   (which-key-add-major-mode-key-based-replacements 'message-mode
@@ -1394,7 +1399,8 @@ This function is intended for use with `ivy-ignore-buffers'."
   :delight " typo"
   :config
   (typo-global-mode 1)
   :delight " typo"
   :config
   (typo-global-mode 1)
-  :hook ((text-mode erc-mode) . typo-mode))
+  :hook (((text-mode erc-mode) . typo-mode)
+         (tex-mode             . (lambda ()(typo-mode -1)))))
 
 ;; highlight TODOs in buffers
 (use-package hl-todo
 
 ;; highlight TODOs in buffers
 (use-package hl-todo
@@ -1512,7 +1518,16 @@ This function is intended for use with `ivy-ignore-buffers'."
   (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
   (yas-reload-all)
   (setq yas-verbosity yas-verbosity-cur)
   (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
   (yas-reload-all)
   (setq yas-verbosity yas-verbosity-cur)
-  (define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)
+
+  (defun b/yas--maybe-expand-key-filter (cmd)
+    (when (and (yas--maybe-expand-key-filter cmd)
+               (not (bound-and-true-p git-commit-mode)))
+      cmd))
+  (defconst b/yas-maybe-expand
+    '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter))
+  (define-key yas-minor-mode-map
+    (kbd "SPC") b/yas-maybe-expand)
+
   (yas-global-mode))
 
 (use-package debbugs)
   (yas-global-mode))
 
 (use-package debbugs)