doomemacs/core/core-vcs.el

76 lines
2.9 KiB
EmacsLisp
Raw Normal View History

2015-06-15 15:05:52 +08:00
;;; core-vcs.el --- version control awareness
(use-package gitconfig-mode
2015-08-14 00:14:41 +08:00
:mode ("/\\.?git/?config$" "/\\.gitmodules$")
2015-12-11 05:15:09 +08:00
:init (add-hook! gitconfig-mode 'flyspell-mode))
2015-06-15 15:05:52 +08:00
(use-package gitignore-mode
2015-08-14 00:14:41 +08:00
:mode ("/\\.gitignore$"
"/\\.git/info/exclude$"
"/git/ignore$"))
2015-06-15 15:05:52 +08:00
2015-12-09 14:16:31 +08:00
(use-package git-gutter
:commands (git-gutter-mode narf/vcs-next-hunk narf/vcs-prev-hunk
narf/vcs-show-hunk narf/vcs-stage-hunk narf/vcs-revert-hunk)
:init
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
(add-hook! (text-mode prog-mode conf-mode) 'git-gutter-mode)
2015-12-09 14:16:31 +08:00
:config
(require 'git-gutter-fringe)
(defalias 'narf/vcs-next-hunk 'git-gutter:next-hunk)
(defalias 'narf/vcs-prev-hunk 'git-gutter:previous-hunk)
(defalias 'narf/vcs-show-hunk 'git-gutter:popup-hunk)
(defalias 'narf/vcs-stage-hunk 'git-gutter:stage-hunk)
(defalias 'narf/vcs-revert-hunk 'git-gutter:revert-hunk)
(define-fringe-bitmap 'git-gutter-fr:added
[240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240]
2015-12-09 14:16:31 +08:00
nil nil 'center)
(define-fringe-bitmap 'git-gutter-fr:modified
[240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240 240]
2015-12-09 14:16:31 +08:00
nil nil 'center)
(define-fringe-bitmap 'git-gutter-fr:deleted
[0 0 0 0 0 0 0 128 192 224 240 248]
2015-12-09 14:16:31 +08:00
nil nil 'center)
(advice-add 'evil-force-normal-state :after 'git-gutter)
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
(add-hook! focus-in 'git-gutter:update-all-windows))
2015-12-09 14:16:31 +08:00
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
(after! vc-annotate
(evil-set-initial-state 'vc-annotate-mode 'normal)
(evil-set-initial-state 'vc-git-log-view-mode 'normal)
(map! :map vc-annotate-mode-map
:n "q" 'kill-this-buffer
:n "d" 'vc-annotate-show-diff-revision-at-line
:n "D" 'vc-annotate-show-changeset-diff-revision-at-line
:n "SPC" 'vc-annotate-show-log-revision-at-line
:n "]]" 'vc-annotate-next-revision
:n "[[" 'vc-annotate-prev-revision
:n [tab] 'vc-annotate-toggle-annotation-visibility
:n "RET" 'vc-annotate-find-revision-at-line))
(use-package browse-at-remote
:commands (browse-at-remote/browse browse-at-remote/to-clipboard)
:init
(evil-define-command narf:git-remote-browse (&optional bang)
"Open the website for the current (or specified) version controlled FILE. If BANG,
then use hub to do it."
(interactive "<!>")
(let (url)
(condition-case err
(setq url (browse-at-remote/get-url))
(error
(setq url (shell-command-to-string "hub browse -u --"))
(setq url (if url
(concat (s-trim url) "/" (f-relative (buffer-file-name) (narf/project-root))
(when (use-region-p) (format "#L%s-L%s"
(line-number-at-pos (region-beginning))
(line-number-at-pos (region-end)))))))))
(when url
(if bang
(message "Url copied to clipboard: %s" (kill-new url))
(browse-url url))))))
2015-06-15 15:05:52 +08:00
(provide 'core-vcs)
;;; core-vcs.el ends here