Skip to content

Commit

Permalink
Merge branch 'develop' (v0.36.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
syl20bnr committed Dec 19, 2014
2 parents cd46c96 + 2c399a2 commit 0727f72
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 46 deletions.
57 changes: 33 additions & 24 deletions contrib/git/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,51 @@ which require an initialization must be listed explicitly in the list.")
))

(defun git/init-git-gutter-fringe ()
(use-package git-gutter
:defer t
(use-package git-gutter-fringe
:commands git-gutter-mode
:init
(add-to-hooks 'git-gutter-mode '(markdown-mode-hook
org-mode-hook
prog-mode-hook))
(progn
(defun git/load-git-gutter ()
"Lazy load git gutter and choose between fringe and no fringe
implementation."
(if (display-graphic-p)
(progn
(require 'git-gutter-fringe)
(git-gutter-mode))
(git-gutter-mode)
(if global-linum-mode (git-gutter:linum-setup))))
(add-to-hooks 'git/load-git-gutter '(markdown-mode-hook
org-mode-hook
prog-mode-hook)))
:config
(progn
(require 'git-gutter-fringe)
(setq git-gutter:hide-gutter t)
;; Don't need log/message.
(setq git-gutter:verbosity 0)
(setq git-gutter-fr:side 'right-fringe)
;; (setq git-gutter:update-hooks '(after-save-hook after-revert-hook))
;; custom graphics that works nice with half-width fringes
(fringe-helper-define 'git-gutter-fr:added nil
"..X...."
"..X...."
"XXXXX.."
"..X...."
"..X...."
)
"..X...."
"..X...."
"XXXXX.."
"..X...."
"..X...."
)
(fringe-helper-define 'git-gutter-fr:deleted nil
"......."
"......."
"XXXXX.."
"......."
"......."
)
"......."
"......."
"XXXXX.."
"......."
"......."
)
(fringe-helper-define 'git-gutter-fr:modified nil
"..X...."
".XXX..."
"XXXXX.."
".XXX..."
"..X...."
)
"..X...."
".XXX..."
"XXXXX.."
".XXX..."
"..X...."
)
(spacemacs|hide-lighter git-gutter-mode))))

(defun git/init-git-messenger ()
Expand Down
11 changes: 8 additions & 3 deletions contrib/lang/javascript/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ which require an initialization must be listed explicitly in the list.")
(defun javascript/init-js2-refactor ()
(use-package js2-refactor
:defer t
:init (eval-after-load 'js2-mode '(require 'js2-refactor))
:init
(progn
(defun javascript/load-js2-refactor ()
"Lazy load js2-refactor"
(require 'js2-refactor))
(add-hook 'js2-mode-hook 'javascript/load-js2-refactor))
:config
(progn
;;(spacemacs/declare-prefix-for-mode 'js2-mode "mr" "refactor")
Expand Down Expand Up @@ -116,7 +121,7 @@ which require an initialization must be listed explicitly in the list.")
(defun javascript/init-tern ()
(use-package tern
:defer t
:init (add-hook 'js2-mode-hook (lambda () (tern-mode t)))
:init (add-hook 'js2-mode-hook 'tern-mode)
:config
(progn
(evil-leader/set-key-for-mode 'js2-mode "mc" 'tern-rename-variable)
Expand All @@ -129,4 +134,4 @@ which require an initialization must be listed explicitly in the list.")
(defun javascript/init-tern-auto-complete ()
(use-package tern-auto-complete
:defer t
:config (tern-ac-setup)))
:init (add-hook 'tern-mode-hook 'tern-ac-setup)))
4 changes: 4 additions & 0 deletions core/dotspacemacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Paths must have a trailing slash (ie. `~/.mycontribs/')"
(defvar dotspacemacs-leader-key "SPC"
"The leader key.")

(defvar dotspacemacs-major-mode-leader-key ","
"Major mode leader key is a shortcut key which is the equivalent of
pressing `<leader> m`")

(defvar dotspacemacs-command-key ":"
"The key used for Evil commands (ex-commands) and Emacs commands (M-x).
By default the command key is `:' so ex-commands are executed like in Vim
Expand Down
3 changes: 3 additions & 0 deletions core/templates/.spacemacs.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
dotspacemacs-default-theme 'solarized-light
;; The leader key
dotspacemacs-leader-key "SPC"
;; Major mode leader key is a shortcut key which is the equivalent of
;; pressing `<leader> m`
dotspacemacs-major-mode-leader-key ","
;; The command key used for Evil commands (ex-commands) and
;; Emacs commands (M-x).
;; By default the command key is `:' so ex-commands are executed like in Vim
Expand Down
34 changes: 25 additions & 9 deletions doc/DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
- [Errors handling](#errors-handling)
- [Compiling](#compiling)
- [Modes](#modes)
- [Major Mode leader key](#major-mode-leader-key)
- [Helm](#helm)
- [Experimental Helm feature](#experimental-helm-feature)
- [Ledger](#ledger)
Expand Down Expand Up @@ -1751,8 +1752,8 @@ Errors management commands (star with `f` for `flycheck`):

Custom fringe bitmaps:

Symbol | Description
:----------------------------------------------------------------------------------------------:|------------
Symbol | Description
:----------------------------------:|------------
![dot-error](img/dot-error.png) | Error
![dot-warning](img/dot-warning.png) | warning
![dot-info](img/dot-info.png) | Info
Expand All @@ -1763,17 +1764,25 @@ Custom fringe bitmaps:

Key Binding | Description
---------------------|------------------------------------------------------------
<kbd>SPC c c</kbd> | use `helm-make` via projectile
<kbd>SPC c C</kbd> | compile
<kbd>SPC c r</kbd> | recompile
<kbd>SPC c c</kbd> | use `helm-make` via projectile
<kbd>SPC c C</kbd> | compile
<kbd>SPC c r</kbd> | recompile

## Modes

`Spacemacs` tries to add more natural Vi key bindings to some modes or
simply add new leader key bindings.
### Major Mode leader key

Leader key bindings start with `m` because they are bindings related to
the current `major mode`.
Key bindings specific to the current `major mode` start with <kbd>SPC m</kbd>.
For convenience a shortcut key called the major mode leader key is set by
default on <kbd>,</kbd> which saves one precious keystroke.

It is possible to change the major mode leader key by defining the variable
`dotspacemacs-major-mode-leader-key` in your `~/.spacemacs`. For example to
setup the key on tabulation:

```elisp
(setq-default dotspacemacs-major-mode-leader-key "<tab>")
```

### Helm

Expand Down Expand Up @@ -1997,9 +2006,12 @@ Achievements | Account
[First contribution layer][1st-clayer] | [trishume][]
[First blog article on Spacemacs][1st-article] | [Wolfy87][]
[100th issue (was a PR)][100th-issue] | [danielwuz][]
[200th issue (question)][200th-issue] | [justrajdeep][]
[300th issue (was a PR)][300th-issue] | [danielwuz][]
[100th pull request][100th-PR] | [bru][]
100th star | [Jackneill][]
200th star | [jb55][]
400th star | [dbohdan][]

# Thank you

Expand Down Expand Up @@ -2088,10 +2100,14 @@ developers to elisp hackers!
[1st-clayer]: https://github.com/syl20bnr/spacemacs/commit/e802027d75d0c0aed55539b0da2dfa0df94dfd39
[1st-article]: http://oli.me.uk/2014/11/06/spacemacs-emacs-vim/
[100th-issue]: https://github.com/syl20bnr/spacemacs/pull/100
[200th-issue]: https://github.com/syl20bnr/spacemacs/pull/200
[300th-issue]: https://github.com/syl20bnr/spacemacs/pull/300
[100th-PR]: https://github.com/syl20bnr/spacemacs/pull/228
[trishume]:https://github.com/trishume
[Wolfy87]:https://github.com/Wolfy87
[danielwuz]:https://github.com/danielwuz
[justrajdeep]:https://github.com/justrajdeep
[dbohdan]:https://github.com/dbohdan
[bru]:https://github.com/bru
[Jackneill]:https://github.com/Jackneill
[jb55]:https://github.com/jb55
Expand Down
10 changes: 10 additions & 0 deletions spacemacs/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ a key sequence. NAME is a symbol name used as the prefix command."
"Remove the evil-leader binding from the passed MAP."
(spacemacs/activate-evil-leader-for-maps `(,map)))

(defun spacemacs/activate-major-mode-leader ()
"Bind major mode key map to `dotspacemacs-major-mode-leader-key'."
(setq mode-map (cdr (assoc major-mode evil-leader--mode-maps)))
(when mode-map
(setq major-mode-map (lookup-key mode-map (kbd "m")))
(define-key evil-normal-state-local-map
(kbd dotspacemacs-major-mode-leader-key) major-mode-map)
(define-key evil-motion-state-local-map
(kbd dotspacemacs-major-mode-leader-key) major-mode-map)))

(defmacro spacemacs|evilify (map &rest body)
"Add `hjkl' navigation, search and visual state to MAP and set additional
bindings contained in BODY."
Expand Down
2 changes: 0 additions & 2 deletions spacemacs/keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
(define-key isearch-mode-map (kbd "S-<return>") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "M-S-<return>") 'isearch-repeat-backward)

;; ---------------------------------------------------------------------------
;; Make <escape> quit as much as possible
;; ---------------------------------------------------------------------------
(define-key minibuffer-local-map (kbd "<escape>") 'keyboard-escape-quit)
(define-key evil-visual-state-map (kbd "<escape>") 'keyboard-quit)
(define-key minibuffer-local-ns-map (kbd "<escape>") 'keyboard-escape-quit)
Expand Down
20 changes: 12 additions & 8 deletions spacemacs/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,11 @@ determine the state to enable when escaping from the insert state.")
;; experimental: invoke leader with "jk" in insert mode
(when dotspacemacs-feature-toggle-leader-on-jk
(key-chord-define evil-insert-state-map (kbd "jk")
evil-leader--default-map)))))
evil-leader--default-map))
;; experimental: map SPC m to ,
(when dotspacemacs-major-mode-leader-key
(add-hook 'after-change-major-mode-hook 'spacemacs/activate-major-mode-leader))
)))

(defun spacemacs/init-evil-lisp-state ()
(use-package evil-lisp-state
Expand Down Expand Up @@ -1056,6 +1060,7 @@ determine the state to enable when escaping from the insert state.")
(setq guide-key/guide-key-sequence `("C-x"
"C-c"
,dotspacemacs-leader-key
,dotspacemacs-major-mode-leader-key
"g"
"z"
"C-h")
Expand Down Expand Up @@ -1879,14 +1884,13 @@ determine the state to enable when escaping from the insert state.")

(defun spacemacs/init-undo-tree ()
(use-package undo-tree
:idle (global-undo-tree-mode)
:defer t
:init
(setq undo-tree-auto-save-history t
undo-tree-history-directory-alist
`(("." . ,(concat spacemacs-cache-directory "undo"))))
(unless (file-exists-p (concat spacemacs-cache-directory "undo"))
(make-directory (concat spacemacs-cache-directory "undo")))
(global-undo-tree-mode)
;; (setq undo-tree-auto-save-history t
;; undo-tree-history-directory-alist
;; `(("." . ,(concat spacemacs-cache-directory "undo"))))
;; (unless (file-exists-p (concat spacemacs-cache-directory "undo"))
;; (make-directory (concat spacemacs-cache-directory "undo")))
(setq undo-tree-visualizer-timestamps t)
(setq undo-tree-visualizer-diff t)
:config
Expand Down

0 comments on commit 0727f72

Please sign in to comment.