git: move git-link to git layer under SPC g l command prefix
git-link is aimed to work with various git hosting services so it makes sense to move it back to git layer.
This commit is contained in:
parent
b92daec7cf
commit
316dc0765d
|
@ -22,6 +22,7 @@
|
|||
- [[#quick-guide-for-recurring-use-cases-in-magit][Quick guide for recurring use cases in Magit]]
|
||||
- [[#git-flow-1][Git-Flow]]
|
||||
- [[#git-time-machine][Git time machine]]
|
||||
- [[#git-links-to-web-services][Git links to web services]]
|
||||
|
||||
* Description
|
||||
This layers adds extensive support for [[http://git-scm.com/][git]].
|
||||
|
@ -49,8 +50,7 @@ To display the =magit status= buffer in fullscreen set the variable
|
|||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun dotspacemacs/user-init ()
|
||||
(setq-default git-magit-status-fullscreen t)
|
||||
)
|
||||
(setq-default git-magit-status-fullscreen t))
|
||||
#+END_SRC
|
||||
|
||||
** Magit auto-complete
|
||||
|
@ -71,8 +71,7 @@ layer by setting the variable =git-enable-magit-svn-plugin= to =t=.
|
|||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun dotspacemacs/user-init ()
|
||||
(setq-default git-enable-magit-svn-plugin t)
|
||||
)
|
||||
(setq-default git-enable-magit-svn-plugin t))
|
||||
#+END_SRC
|
||||
|
||||
** Global git commit mode
|
||||
|
@ -206,7 +205,6 @@ will discard the commit message.
|
|||
| ~!~ | execute |
|
||||
|
||||
** Quick guide for recurring use cases in Magit
|
||||
|
||||
- Amend a commit:
|
||||
- ~l l~ to open =log buffer=
|
||||
- ~c a~ on the commit you want to amend
|
||||
|
@ -232,7 +230,6 @@ will discard the commit message.
|
|||
- ~P P~ to push the commit to =origin=
|
||||
|
||||
** Git-Flow
|
||||
|
||||
[[https://github.com/jtatarik/magit-gitflow][magit-gitflow]] provides git-flow commands in its own magit menu.
|
||||
|
||||
| Key Binding | Description |
|
||||
|
@ -240,7 +237,6 @@ will discard the commit message.
|
|||
| ~%~ | open magit-gitflow menu |
|
||||
|
||||
** Git time machine
|
||||
|
||||
[[https://github.com/pidu/git-timemachine][git-timemachine]] allows to quickly browse the commits of the current buffer.
|
||||
|
||||
| Key Binding | Description |
|
||||
|
@ -253,4 +249,19 @@ will discard the commit message.
|
|||
| ~q~ | leave transient-state and git timemachine |
|
||||
| ~Y~ | copy current commit hash |
|
||||
|
||||
# LocalWords: unpulled
|
||||
** Git links to web services
|
||||
These key bindings allow to quickly construct URLs pointing to a given commit
|
||||
or lines in a file hosted on Git web services like GitHub, GitLab, Bitbucket...
|
||||
|
||||
| Key Binding | Description |
|
||||
|-------------+------------------------------------------------------------------------|
|
||||
| ~SPC g l c~ | on a commit hash, browse to the current file at this commit |
|
||||
| ~SPC g l C~ | on a commit hash, create link to the file at this commit and copy it |
|
||||
| ~SPC g l l~ | on a region, browse to file at current lines position |
|
||||
| ~SPC g l L~ | on a region, create a link to the file highlighting the selected lines |
|
||||
|
||||
*Notes:*
|
||||
- You can use the universal argument ~SPC u~ to select a remote repository.
|
||||
- When the link is opened, the URL is also copied in the kill ring, you can
|
||||
override this behavior by setting the variable =git-link-open-in-browser= to
|
||||
=nil=.
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
gitconfig-mode
|
||||
gitignore-mode
|
||||
git-commit
|
||||
git-link
|
||||
git-messenger
|
||||
git-timemachine
|
||||
(helm-gitignore :toggle (configuration-layer/package-usedp 'helm))
|
||||
|
@ -42,6 +43,19 @@
|
|||
(use-package git-commit
|
||||
:defer t))
|
||||
|
||||
(defun git/init-git-link ()
|
||||
(use-package git-link
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(spacemacs/set-leader-keys
|
||||
"gll" 'spacemacs/git-link
|
||||
"glL" 'spacemacs/git-link-copy-url-only
|
||||
"glc" 'spacemacs/git-link-commit
|
||||
"glC" 'spacemacs/git-link-commit-copy-url-only)
|
||||
;; default is to open the generated link
|
||||
(setq git-link-open-in-browser t))))
|
||||
|
||||
(defun git/init-git-messenger ()
|
||||
(use-package git-messenger
|
||||
:defer t
|
||||
|
|
|
@ -97,15 +97,4 @@ In the gist list buffer:
|
|||
|
||||
| Key Binding | Description |
|
||||
|-------------+--------------------------------------------------------------------|
|
||||
| ~SPC g h c~ | browse to file on github/bitbucket/etc (on current line at commit) |
|
||||
| ~SPC g h C~ | only copy the generated link on the kill ring |
|
||||
| ~SPC g h l~ | browse to file on github/bitbucket/etc (on current line position) |
|
||||
| ~SPC g h L~ | only copy the generated link on the kill ring |
|
||||
| ~SPC g h o~ | browse to file on github |
|
||||
|
||||
*Notes:*
|
||||
- You can use the universal argument ~SPC u~ to select a remote repository.
|
||||
- You can use =git-link= on a region.
|
||||
- When the link is opened, the URL is also copied in the kill ring, you can
|
||||
override this behavior by setting the variable =git-link-open-in-browser= to
|
||||
=nil=.
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
(setq github-packages
|
||||
'(
|
||||
gist
|
||||
git-link
|
||||
github-browse-file
|
||||
github-clone
|
||||
github-search
|
||||
|
@ -20,9 +19,7 @@
|
|||
;; helm-gist
|
||||
magit-gh-pulls
|
||||
;; this package does not exits, we need it to wrap
|
||||
;; the call to spacemacs/declare-prefix which cannot
|
||||
;; be place in `config.el' because `which-key' is not
|
||||
;; available when `config.el' is loaded.
|
||||
;; the call to spacemacs/declare-prefix.
|
||||
(spacemacs-github :location built-in)
|
||||
))
|
||||
|
||||
|
@ -64,9 +61,7 @@
|
|||
(defun github/init-github-browse-file ()
|
||||
(use-package github-browse-file
|
||||
:defer t
|
||||
:init
|
||||
(spacemacs/set-leader-keys
|
||||
"gho" 'github-browse-file)))
|
||||
:init (spacemacs/set-leader-keys "gho" 'github-browse-file)))
|
||||
|
||||
(defun github/init-github-clone ()
|
||||
(use-package github-clone
|
||||
|
@ -83,19 +78,6 @@
|
|||
:commands (github-search-clone-repo github-search-user-clone-repo)
|
||||
:init (spacemacs/set-leader-keys "ghs" 'github-search-clone-repo)))
|
||||
|
||||
(defun github/init-git-link ()
|
||||
(use-package git-link
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(spacemacs/set-leader-keys
|
||||
"ghl" 'spacemacs/git-link
|
||||
"ghL" 'spacemacs/git-link-copy-url-only
|
||||
"ghc" 'spacemacs/git-link-commit
|
||||
"ghC" 'spacemacs/git-link-commit-copy-url-only)
|
||||
;; default is to open the generated link
|
||||
(setq git-link-open-in-browser t))))
|
||||
|
||||
;; magit-gh-pulls has to be loaded via a pre-config hook because the source code
|
||||
;; makes assumptions about the status of the magit-mode keymaps that are
|
||||
;; incompatible with the spacemacs' evilification feature.
|
||||
|
|
Loading…
Reference in New Issue