about summary refs log tree commit diff stats
path: root/.emacs.d/lisp
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2023-05-17 12:56:42 +0100
committerDavid Morgan <djm_uk@protonmail.com>2023-05-17 12:56:42 +0100
commit119fda8cc0e0bddcf33cbc25ad3af16dcb2498c1 (patch)
treee321cc8d061c7b1959ae6a04654820a99cb6c193 /.emacs.d/lisp
parent69faf78c2837d69fa08f225ee7d2d4c227f55cf4 (diff)
downloaddotfiles-119fda8cc0e0bddcf33cbc25ad3af16dcb2498c1.tar.gz
Add my/magit-stage-and-commit-file
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r--.emacs.d/lisp/init-git.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-git.el b/.emacs.d/lisp/init-git.el
index 0773a4e..e1f8d68 100644
--- a/.emacs.d/lisp/init-git.el
+++ b/.emacs.d/lisp/init-git.el
@@ -74,6 +74,7 @@
   ("C-c g u" . my/magit-set-upstream)
   ("C-c g r" . my/magit-refresh-state)
   ("C-c g m" . my/magit-update-master)
+  ("C-c g C-c" . my/magit-stage-and-commit-file)
   :config
   ;; Requires the following gitconfig:
   ;; [alias]
@@ -112,6 +113,12 @@
             (magit-shell-command-topdir command)))
       (message "Not a git repository")))
 
+  (defun my/magit-stage-and-commit-file ()
+    "Stage and commit the current the currently visited file."
+    (interactive)
+    (magit-stage-file (magit-file-relative-name))
+    (magit-commit-create))
+
   ;; difftastic code copied from https://tsdh.org/posts/2022-08-01-difftastic-diffing-with-magit.html
   (defun my/magit--with-difftastic (buffer command)
     "Run COMMAND with GIT_EXTERNAL_DIFF=difft then show result in BUFFER."