Skip to content

Commit

Permalink
Merge branch 'develop' (v0.11.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
syl20bnr committed Nov 16, 2014
2 parents cf308a5 + 50c9893 commit b94038c
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .spacemacs.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
dotspacemacs-configuration-layers '()
;; If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only)
dotspacemacs-fullscreen-at-startup nil
;; If non nil pressing 'jk' in insert state, ido or helm will activate the
;; evil leader.
dotspacemacs-feature-toggle-leader-on-jk nil
;; A list of packages and/or extensions that will not be install and loaded.
dotspacemacs-excluded-packages '()
;; The default package repository used if no explicit repository has been
Expand Down
91 changes: 80 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ for contribution guidelines_
- [Executing Vim, Emacs and shell commands](#executing-vim-emacs-and-shell-commands)
- [Navigating](#navigating)
- [Point/Cursor](#pointcursor)
- [Experimental insert state feature](#experimental-insert-state-feature)
- [Vim motions with ace-jump mode](#vim-motions-with-ace-jump-mode)
- [Window manipulation](#window-manipulation)
- [Golden ratio](#golden-ratio)
- [Buffers and Files](#buffers-and-files)
- [Ido](#ido)
- [Experimental Ido feature](#experimental-ido-feature)
- [NeoTree file tree](#neotree-file-tree)
- [Bookmarks](#bookmarks)
- [Searching](#searching)
Expand Down Expand Up @@ -108,6 +110,7 @@ for contribution guidelines_
- [Errors handling](#errors-handling)
- [Modes](#modes)
- [Helm](#helm)
- [Experimental Helm feature](#experimental-helm-feature)
- [Erlang](#erlang)
- [Ledger](#ledger)
- [Org](#org)
Expand All @@ -118,6 +121,8 @@ for contribution guidelines_
- [Tips](#tips)
- [Tips for Emacs users](#tips-for-emacs-users)
- [Tips for Spacemacs advanced users](#tips-for-spacemacs-advanced-users)
- [evil-lisp-state as default state](#evil-lisp-state-as-default-state)
- ["jk" to trigger evil leader](#jk-to-trigger-evil-leader)
- [Contributors Achievements](#contributors-achievements)
- [Thank you](#thank-you)

Expand Down Expand Up @@ -226,7 +231,7 @@ project.*
next level by using Emacs.

It is also a good fit for people wanting to **lower the [risk of RSI][RSI]**
induced by the default Emacs key bindings.
induced by the default Emacs key bindings.

Emacs users wanting to learn **a different way to edit files** or wanting to
learn Vim key bindings (see [Tips for Emacs users](#tips-for-emacs-users)).
Expand Down Expand Up @@ -489,9 +494,9 @@ For instance to disable the `rainbow-delimiters` package:
(setq-default dotspacemacs-excluded-packages '(rainbow-delimiters))
```

Note that for now, excluded packages that have been installed are not
uninstalled. You'll have to delete them manually from your `~/.emacs.d/elpa`
directory.
When you exclude a package, `Spacemacs` will automatically delete it for you
the next time you launch Emacs. All the orphan dependencies are as well
delete automatically.

#### Hooks

Expand Down Expand Up @@ -550,7 +555,7 @@ The typical `base state` in Vim is the `normal state` and it is the only one.

This allows a coder of Lisp to completely replace the `normal state` by the
`lisp state`. Indeed, once you fire up the `lisp state` you can just go back
and forth between the `insert state` and the `lisp state`.
and forth between the `insert state` and the `lisp state`.

Of course there is a rule to break this in order to be able to go back to the
`normal state`. It is pretty simple:
Expand Down Expand Up @@ -680,7 +685,7 @@ the number of errors, warnings and info.

[Anzu][anzu] shows the number of occurrence when performing a search. `Spacemacs`
integrates nicely the Anzu status by displaying it temporarily when `n` or `N` are
being pressed. See the `5/6` segment on the screenshot below.
being pressed. See the `5/6` segment on the screenshot below.

![powerline-anzu](https://raw.githubusercontent.com/syl20bnr/spacemacs/master/doc/powerline-anzu.png)

Expand Down Expand Up @@ -824,7 +829,13 @@ Key Binding | Description
`L` | move quickly down (10 lines at a time)
`<SPC> j h` | go to the beginning of line (and set a mark at the previous location in the line)
`<SPC> j l` | go to the end of line (and set a mark at the previous location in the line)
`<SPC> z z` | lock the cursor at the center of the screen
`<SPC> z z` | lock the cursor at the center of the screen

##### Experimental insert state feature

If `dotspacemacs-feature-toggle-leader-on-jk` is non nil, pressing `jk` while
in `insert state` will trigger the evil leader as if you pressed `<SPC>` in
normal mode.

#### Vim motions with ace-jump mode

Expand Down Expand Up @@ -938,15 +949,34 @@ Basic `ido` operations can be done with `Ctrl` key:

Key Binding | Description
--------------|----------------------------------------------------------------
`C-d` | delete selected file (ask for confirmation)
`C-k` | select previous file or directory
`C-<return>` | open a `dired buffer`
`C-b` | open selected file in a horizontally split window
`C-d` | delete selected file (ask for confirmation)
`C-h` | go to parent directory
`C-j` | select next file or directory
`C-l` | open the selected file
`C-S-j` | go to next directory
`C-k` | select previous file or directory
`C-S-k` | go to previous directory
`C-l` | open the selected file
`C-n` | next history element
`C-p` | previous history element
`C-t` | open selected file in a new frame
`C-v` | open selected file in a vertically split window
`C-x` | open selected file in other window

##### Experimental Ido feature

If `dotspacemacs-feature-toggle-leader-on-jk` is non nil, pressing `jk` while
in `ido` minibuffer will trigger the evil leader.

When evil leader is triggered the following commands are available:

Key Binding | Description
--------------|----------------------------------------------------------------
`b` | open selected file in a horizontally split window
`t` | open selected file in a new frame
`v` | open selected file in a vertically split window
`x` | open selected file in other window

#### NeoTree file tree

Expand Down Expand Up @@ -1526,6 +1556,27 @@ the current `major mode`.
`CTRL+k` | go to next item
`CTRL+l` | go to next page

##### Experimental Helm feature

If `dotspacemacs-feature-toggle-leader-on-jk` is non nil, pressing `jk` while
in `helm` buffer will trigger the evil leader.

When evil leader is triggered the following commands are available:

Key Binding | Description
--------------|----------------------------------------------------------------
`1` | execute action 0
`2` | execute action 1
`3` | execute action 2
`4` | execute action 3
`5` | execute action 4
`6` | execute action 5
`7` | execute action 6
`8` | execute action 7
`9` | execute action 8
`0` | execute action 9
`a` | toggle action selection menu

#### Erlang

`Spacemacs` uses [EDTS][edts] as an Erlang coding environment.
Expand Down Expand Up @@ -1637,14 +1688,32 @@ This function is called at the very end of Spacemacs initialization."

### Tips for Spacemacs advanced users

1) To Make `lisp state` the default state in `Emacs Lisp` buffers, insert in
#### evil-lisp-state as default state

To Make `lisp state` the default state in `Emacs Lisp` buffers, insert in
your `~/.spacemacs` the following snippet:

```elisp
(defun dotspacemacs/config ()
(add-hook 'emacs-lisp-mode-hook 'evil-lisp-state))
```

#### "jk" to trigger evil leader

It is possible to activate an experimental feature which allows to trigger the
evil leader in `insert state`, in `ido` minibuffer and in `helm` buffers.

To activate it, set `dotspacemacs-feature-toggle-leader-on-jk` to `t`.

```elisp
(setq-default dotspacemacs-feature-toggle-leader-on-jk t)
```

More info on this feature:
- [insert state](#experimental-insert-state-feature)
- [helm](#experimental-helm-feature)
- [ido](#experimental-ido-feature)

## Contributors Achievements

Achievements | Contributors
Expand Down
6 changes: 5 additions & 1 deletion core/contribsys.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ Paths must have a trailing slash (ie. `~/.mycontribs/')"
(defvar dotspacemacs-fullscreen-at-startup nil
"If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only).")

(defvar dotspacemacs-feature-toggle-leader-on-jk nil
"If non nil pressing 'jk' in insert state, ido or helm will activate the
evil leader.")

(defvar dotspacemacs-default-package-repository 'melpa-stable
"The default package repository used if no explicit repository has been
specified with an installed package.
Expand Down Expand Up @@ -190,7 +194,7 @@ spacemacs-all-post-extensions "
(dir (plist-get (cdr layer) :dir))
(pkg-file (concat dir "packages.el"))
(ext-file (concat dir "extensions.el")))
(progn
(progn
;; packages
(when (file-exists-p pkg-file)
(load pkg-file)
Expand Down
55 changes: 55 additions & 0 deletions spacemacs/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,61 @@ changed to THEME."
(delete-windows-on buf)
(message "compilation ok.")))))

;; from https://gist.github.com/timcharper/493269
(defun split-window-vertically-and-switch ()
(interactive)
(split-window-vertically)
(other-window 1))

(defun split-window-horizontally-and-switch ()
(interactive)
(split-window-horizontally)
(other-window 1))

(defun ido-invoke-in-other-window ()
"signals ido mode to switch to (or create) another window after exiting"
(interactive)
(setq ido-exit-minibuffer-target-window 'other)
(ido-exit-minibuffer))

(defun ido-invoke-in-horizontal-split ()
"signals ido mode to split horizontally and switch after exiting"
(interactive)
(setq ido-exit-minibuffer-target-window 'horizontal)
(ido-exit-minibuffer))

(defun ido-invoke-in-vertical-split ()
"signals ido mode to split vertically and switch after exiting"
(interactive)
(setq ido-exit-minibuffer-target-window 'vertical)
(ido-exit-minibuffer))

(defun ido-invoke-in-new-frame ()
"signals ido mode to create a new frame after exiting"
(interactive)
(setq ido-exit-minibuffer-target-window 'frame)
(ido-exit-minibuffer))

(defadvice ido-read-internal (around ido-read-internal-with-minibuffer-other-window activate)
(let* (ido-exit-minibuffer-target-window
(this-buffer (current-buffer))
(result ad-do-it))
(cond
((equal ido-exit-minibuffer-target-window 'other)
(if (= 1 (count-windows))
(split-window-horizontally-and-switch)
(other-window 1)))
((equal ido-exit-minibuffer-target-window 'horizontal)
(split-window-horizontally-and-switch))

((equal ido-exit-minibuffer-target-window 'vertical)
(split-window-vertically-and-switch))
((equal ido-exit-minibuffer-target-window 'frame)
(make-frame)))
(switch-to-buffer this-buffer) ;; why? Some ido commands, such as textmate.el's textmate-goto-symbol don't switch the current buffer
result))


;; from https://gist.github.com/cofi/3013327
(defun cofi/helm-flyspell-correct ()
"Use helm for flyspell correction.
Expand Down
46 changes: 42 additions & 4 deletions spacemacs/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ determine the state to enable when escaping from the insert state.")
;; make leader available in visual mode
(define-key evil-visual-state-map (kbd "SPC") evil-leader--default-map)
(define-key evil-motion-state-map (kbd "SPC") evil-leader--default-map)
(define-key evil-emacs-state-map (kbd "SPC") evil-leader--default-map)))
;; 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))))
;; load surround
(use-package evil-surround
:init (global-evil-surround-mode 1))
Expand Down Expand Up @@ -1315,6 +1317,21 @@ determine the state to enable when escaping from the insert state.")
(define-key helm-map (kbd "C-k") 'helm-previous-line)
(define-key helm-map (kbd "C-h") 'helm-next-source)
(define-key helm-map (kbd "C-l") 'helm-previous-source)
;; experimental: toggle evil-leader with "jk" with helm specific commands
(when dotspacemacs-feature-toggle-leader-on-jk
(evil-leader/set-key-for-mode 'helm-mode
"1" (lambda () (interactive) (helm-select-nth-action 0))
"2" (lambda () (interactive) (helm-select-nth-action 1))
"3" (lambda () (interactive) (helm-select-nth-action 2))
"4" (lambda () (interactive) (helm-select-nth-action 3))
"5" (lambda () (interactive) (helm-select-nth-action 4))
"6" (lambda () (interactive) (helm-select-nth-action 5))
"7" (lambda () (interactive) (helm-select-nth-action 6))
"8" (lambda () (interactive) (helm-select-nth-action 7))
"9" (lambda () (interactive) (helm-select-nth-action 8))
"0" (lambda () (interactive) (helm-select-nth-action 9))
"a" 'helm-select-action)
(key-chord-define helm-map (kbd "jk") (cdr (assoc 'helm-mode evil-leader--mode-maps))))
(eval-after-load "helm-mode" ; required
'(spacemacs//hide-lighter helm-mode)))))

Expand Down Expand Up @@ -1403,13 +1420,33 @@ determine the state to enable when escaping from the insert state.")
(define-key ido-completion-map (kbd "C-l") 'ido-exit-minibuffer)
(define-key ido-completion-map (kbd "C-S-j") 'ido-next-match-dir)
(define-key ido-completion-map (kbd "C-S-k") 'ido-prev-match-dir)
;; history navigation
(define-key ido-completion-map (kbd "C-n") 'next-history-element)
(define-key ido-completion-map (kbd "C-p") 'previous-history-element)
;; ido-other window maps
(define-key ido-completion-map (kbd "C-x") 'ido-invoke-in-other-window)
(define-key ido-completion-map (kbd "C-v") 'ido-invoke-in-vertical-split)
(define-key ido-completion-map (kbd "C-b") 'ido-invoke-in-horizontal-split)
(define-key ido-completion-map (kbd "C-t") 'ido-invoke-in-new-frame)
;; more natural navigation keys: up, down to change current item
;; left to go up dir
;; right to open the selected item
(define-key ido-completion-map (kbd "<up>") 'ido-prev-match)
(define-key ido-completion-map (kbd "<down>") 'ido-next-match)
(define-key ido-completion-map (kbd "<left>") 'ido-delete-backward-updir)
(define-key ido-completion-map (kbd "<right>") 'ido-exit-minibuffer)))))
(define-key ido-completion-map (kbd "<right>") 'ido-exit-minibuffer)))
:config
(progn
;; experimental: press "jk" to trigger evil-leader with ido-mode specific
;; commands
(when dotspacemacs-feature-toggle-leader-on-jk
(evil-leader/set-key-for-mode 'ido-mode
"b" 'ido-invoke-in-horizontal-split
"t" 'ido-invoke-in-new-frame
"v" 'ido-invoke-in-vertical-split
"x" 'ido-invoke-in-other-window)
(key-chord-define ido-file-completion-map (kbd "jk")
(cdr (assoc 'ido-mode evil-leader--mode-maps)))))))

(defun spacemacs/init-js2-mode ()
(use-package js2-mode
Expand Down Expand Up @@ -1895,5 +1932,6 @@ determine the state to enable when escaping from the insert state.")
(coffee-insert-spaces (coffee-previous-indent)))
)
;; indent to right position after `evil-open-blow' and `evil-open-above'
(add-hook 'coffee-mode-hook '(lambda () (setq indent-line-function 'spacemacs/coffee-indent)))
)))
(add-hook 'coffee-mode-hook '(lambda ()
(setq indent-line-function 'spacemacs/coffee-indent
evil-shift-width coffee-tab-width))))))

0 comments on commit b94038c

Please sign in to comment.