2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: Version-Control layer
|
2015-11-08 18:04:44 +00:00
|
|
|
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" />
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2015-10-30 11:20:58 +00:00
|
|
|
* Table of Contents :TOC_4_org:noexport:
|
|
|
|
- [[Description][Description]]
|
2015-12-07 18:46:48 +00:00
|
|
|
- [[Features][Features]]
|
2015-10-30 11:20:58 +00:00
|
|
|
- [[Install][Install]]
|
|
|
|
- [[Layer][Layer]]
|
2015-11-15 19:01:58 +00:00
|
|
|
- [[Configuration][Configuration]]
|
2015-12-07 18:46:48 +00:00
|
|
|
- [[Differences between margin programs][Differences between margin programs]]
|
2015-10-30 11:20:58 +00:00
|
|
|
- [[Key Bindings][Key Bindings]]
|
2016-01-30 11:32:53 +00:00
|
|
|
- [[Version Control Transient-state][Version Control Transient-state]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This layers adds general configuration for [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Version-Control.html][Emacs VC]].
|
|
|
|
It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc...
|
|
|
|
|
2015-12-07 18:46:48 +00:00
|
|
|
** Features
|
2015-11-15 19:01:58 +00:00
|
|
|
- highlights uncommitted changes in the fringe or margin with [[https://github.com/dgutov/diff-hl][diff-hl]],
|
|
|
|
git-gutter, or git-gutter+
|
2016-01-30 11:32:53 +00:00
|
|
|
- adds vcs transient-state ~SPC g.~ to allow quick navigation and modification of
|
2015-11-15 19:01:58 +00:00
|
|
|
buffer hunks.
|
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Install
|
|
|
|
** Layer
|
2016-01-06 05:21:55 +00:00
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =version-control= to the existing =dotspacemacs-configuration-layers= list in this
|
|
|
|
file.
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2015-11-15 19:01:58 +00:00
|
|
|
* Configuration
|
2016-01-30 11:32:53 +00:00
|
|
|
You can choose the package to facilitate the diff transient-state and show margins
|
2015-11-15 19:01:58 +00:00
|
|
|
by setting =version-control-diff-tool=
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
'(version-control :variables
|
|
|
|
version-control-diff-tool 'diff-hl)
|
|
|
|
#+END_SRC
|
|
|
|
|
2015-11-30 04:00:57 +00:00
|
|
|
To automatically enable diff margins in all buffers, set
|
|
|
|
=version-control-global-margin=
|
2015-11-15 19:01:58 +00:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
'(version-control :variables
|
2015-12-03 12:49:09 +00:00
|
|
|
version-control-global-margin t)
|
2015-11-15 19:01:58 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
2015-12-07 18:46:48 +00:00
|
|
|
** Differences between margin programs
|
2015-11-30 04:00:57 +00:00
|
|
|
This layer contains generalized mappings for three diff margin packages:
|
|
|
|
diff-hl, git-gutter, and git-gutter+.
|
2015-11-15 19:01:58 +00:00
|
|
|
|
2015-11-30 04:00:57 +00:00
|
|
|
There are some differences between packages that might have some people prefer
|
|
|
|
one over the other:
|
2015-11-15 19:01:58 +00:00
|
|
|
|
|
|
|
| Feature | diff-hl | git-gutter | git-gutter+ |
|
|
|
|
|-------------------------------------+---------+------------+-------------|
|
|
|
|
| Show in fringe | X | X | X |
|
|
|
|
| Extended VCS support (e.g. hg, svn) | X | X | |
|
|
|
|
| Stage hunks from buffer | | X | X |
|
|
|
|
| Dired support | X | | |
|
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Key Bindings
|
|
|
|
|
2015-11-15 19:01:58 +00:00
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+------------------------------|
|
2016-01-30 11:32:53 +00:00
|
|
|
| ~SPC g .~ | version control transient-state |
|
2015-11-15 19:01:58 +00:00
|
|
|
| ~SPC T d~ | toggle diff margins |
|
2015-11-30 04:08:38 +00:00
|
|
|
| ~SPC T C-d~ | toggle diff margins globally |
|
2015-11-15 19:01:58 +00:00
|
|
|
|
2016-01-30 11:32:53 +00:00
|
|
|
** Version Control Transient-state
|
2015-11-15 19:01:58 +00:00
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+------------------------------|
|
|
|
|
| ~SPC g . h~ | Show diff of hunk |
|
|
|
|
| ~SPC g . n~ | Next hunk |
|
|
|
|
| ~SPC g . N~ | Previous hunk |
|
2015-12-07 18:46:48 +00:00
|
|
|
| ~SPC g . p~ | Previous hunk |
|
2015-11-15 19:01:58 +00:00
|
|
|
| ~SPC g . r~ | Revert hunk |
|
|
|
|
| ~SPC g . s~ | Stage hunk |
|
|
|
|
| ~SPC g . t~ | Toggle margin indicators |
|
|
|
|
| ~SPC g . w~ | Stage file |
|
|
|
|
| ~SPC g . u~ | Unstage file |
|
|
|
|
| ~SPC g . d~ | Repo diff popup |
|
|
|
|
| ~SPC g . D~ | Show diffs of unstaged hunks |
|
|
|
|
| ~SPC g . c~ | Commit with popup |
|
|
|
|
| ~SPC g . C~ | Commit |
|
|
|
|
| ~SPC g . P~ | Push repo with popup |
|
|
|
|
| ~SPC g . f~ | Fetch for repo with popup |
|
|
|
|
| ~SPC g . F~ | Pull repo with popup |
|
|
|
|
| ~SPC g . l~ | Show repo log |
|