Skip to content

Commit

Permalink
magit: Add "b"-"k" keybinding to copy branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
Maverobot committed Jan 31, 2024
1 parent 14ce4b2 commit cededc8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spacemacs.org
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,21 @@ the formatting in a dominant parent directory of the assumed input file path.
*** Require final new line
#+BEGIN_SRC emacs-lisp :tangle user-config.el
(setq-default require-final-newline t)
*** Get current branch name in magit
#+BEGIN_SRC emacs-lisp :tangle user-config.el
(defun magit-add-current-branch-name-to-kill-ring ()
"Show the current branch in the echo-area and add it to the `kill-ring'."
(interactive)
(let ((branch (magit-get-current-branch)))
(if branch
(progn (kill-new branch)
(message "%s" branch))
(user-error "There is not current branch"))))

; TODO: Move this keybinding from "Checkout" to "Do" section
(with-eval-after-load 'magit
(transient-insert-suffix 'magit-branch "b"
'("k" "copy branch name" magit-add-current-branch-name-to-kill-ring)))
#+END_SRC
** Miscellaneous
*** No title bar
Expand Down

0 comments on commit cededc8

Please sign in to comment.