diff options
Diffstat (limited to 'emacs/custom/my-git.el')
-rw-r--r-- | emacs/custom/my-git.el | 83 |
1 files changed, 21 insertions, 62 deletions
diff --git a/emacs/custom/my-git.el b/emacs/custom/my-git.el index 5855590..bbc946f 100644 --- a/emacs/custom/my-git.el +++ b/emacs/custom/my-git.el @@ -1,73 +1,32 @@ -;;; my-git --- configures git for emacs +;;; my-git --- configures git for emacs -*- lexical-binding: t -*- + ;;; Commentary: -;;; Code: -(require 'use-package) -(use-package git-modes - :ensure t - :mode - ("/\\.gitconfig\\'" . gitconfig-mode) - ("/\\.gitmodules\\'" . gitconfig-mode) - ("/\\.git/config\\'" . gitconfig-mode) - ("/\\.gitignore\\'" . gitignore-mode) - ("/.dockerignore\\'" . gitignore-mode) - ("/\\.gitattributes//" . gitattributes-mode)) +;;; Code: -(use-package magit - :ensure t - :after (flyspell) - :bind (("C-x g" . magit-status)) - :custom - (vc-follow-symlinks t)) +(add-to-list 'auto-mode-alist '("\\.gitconfig\\'" . gitconfig-mode)) +(add-to-list 'auto-mode-alist '("\\.git/config\\'" . gitconfig-mode)) +(add-to-list 'auto-mode-alist '("\\.gitmodules\\'" . gitconfig-mode)) +(add-to-list 'auto-mode-alist '("\\.gitignore\\'" . gitconfig-mode)) +(add-to-list 'auto-mode-alist '("\\.dockerignore\\'" . gitconfig-mode)) +(add-to-list 'auto-mode-alist '("\\.gitattributes\\'" . gitattributes-mode)) -(use-package magit-repos - :ensure nil - :after (magit) - :custom - (magit-repository-directories '(("~/workspace" . 1)))) +(setq vc-follow-symlinks t) +(global-set-key (kbd "C-x g") 'magit-status) -(use-package forge - :ensure t - :after (magit) - :custom - (forge-database-file (expand-file-name "var/forge-database.sqlite" user-emacs-directory)) - (forge-topic-list-columns - '(("#" 5 forge-topic-list-sort-by-number (:right-align t) number nil) - ("Title" 60 t nil title nil) - ("State" 6 t nil state nil) - ("Marks" 8 t nil marks nil) - ("Labels" 8 t nil labels nil) - ("Assignees" 10 t nil assignees nil) - ("Updated" 10 t nill updated nil)))) +(defun my/git-commit-auto-fill () + "Ensures that the commit body does not exceed 72 characters." + (setq-local fill-column 72) + (setq-local comment-auto-fill-only-comments nil)) -(with-eval-after-load 'forge - (setq forge-alist - (quote - (("github.com" "api.github.com" "github.com" forge-github-repository) - ("gitlab.com" "gitlab.com/api/v4" "gitlab.com" forge-gitlab-repository) - ("git.fcuny.net" "git.fcuny.net/api/v1" "git.fcuny.net" forge-gitea-repository) - ("github.rbx.com" "github.rbx.com/api/v3" "github.rbx.com" forge-github-repository) - ("git.kernel.org" nil "git.kernel.org" forge-cgit-repository))))) +(add-hook 'git-commit-mode-hook 'my/git-commit-auto-fill) -(use-package git-commit - :ensure t - :after magit - :hook (git-commit-mode . my/git-commit-auto-fill) - :custom - (git-commit-summary-max-length 50) - :preface - (defun my/git-commit-auto-fill () - "Ensures that the commit body does not exceed 72 characters." - (setq-local fill-column 72) - (setq-local comment-auto-fill-only-comments nil))) +(customize-set-variable 'git-commit-summary-max-length 50) -(use-package git-link - :ensure t - :after magit - :bind (("C-c g l" . git-link) - ("C-c g a" . git-link-commit)) - :custom - (git-link-open-in-browser 't)) +(global-set-key (kbd "C-c g l") 'git-link) +(global-set-key (kbd "C-c g c") 'git-link-commit) +(customize-set-variable 'git-link-open-in-browser 't) (provide 'my-git) + ;;; my-git.el ends here |