Optimize SPC j prefix

`SPC j j` is now for avy-goto-char (SPC SPC in 0.105)
`SPC j J` is for avy-goto-char-2
`SPC j s` is for splitting strings or sexps
`SPC j S` is for splitting strings of sexps, insert new line and indent
`SPC j n` is to split line at point, insert new line and indent
This commit is contained in:
syl20bnr 2016-01-12 01:17:41 -05:00
parent 80c7f1f667
commit a5857b3d7c
4 changed files with 41 additions and 32 deletions

View File

@ -8,11 +8,19 @@ This file containes the change log for the next major version of Spacemacs.
- Key binding ~SPC :~ acting as M-x as been replaced by ~SPC SPC~.
If you want to revert to the old ~SPC :~ key binding set the new
variable =dotspacemacs-emacs-command-key= to ":".
- Key bindings ~SPC j h~ and ~SPC j l~ have been moved to ~SPC j 0~ and
~SPC j $~ respectively.
- ~SPC j~ prefix has been modified to include =jump= commands:
- =avy= commands are now behind the prefix ~SPC j~ for =jump=:
- ~SPC j j~ to jump to a character in the buffer (works as an evil motion)
- ~SPC j l~ to jump to a line with avy (works as an evil motion)
- ~SPC j w~ to jump to a word in the current buffer (works as an evil motion)
- the following key bindings have been moved:
- ~SPC j j~ to split a line has been moved to ~SPC j n~
- ~SPC j h~ and ~SPC j l~ have been moved to ~SPC j 0~ and ~SPC j $~
respectively.
- ~SPC J~ to split a string or sexp has been moved to ~SPC j s~
*** Hot new features
- Support for Ivy, add the =spacemacs-ivy= layer to your dotfile and
restart. Helm will be replaced by Ivy.
restart to replace =Helm= by =Ivy=.
*** New Layers
- asm in =+lang= (thanks to thudo)
- spacemacs-ivy in =completion= (thanks to justbur)
@ -32,14 +40,18 @@ This file containes the change log for the next major version of Spacemacs.
- ~SPC j $~ to go to the end of line (and set a mark at the previous location
in the line)
- ~SPC j b~ to jump to a bookmark
- ~SPC j c~ to jump to a character in the buffer (works as an evil motion)
- ~SPC j d~ to jump to a listing of the current directory
- ~SPC j D~ to jump to a listing of the current directory (other window)
- ~SPC j f~ to jump to the definition of the function under the point
- ~SPC j i~ to jump to a definition in buffer (imenu)
- ~SPC j j~ to jump to a character in the buffer (works as an evil motion)
- ~SPC j J~ to jump to a suite of two characters in the buffer (works as an evil motion)
- ~SPC j I~ to jump to a definition in any buffer (imenu)
- ~SPC j k~ to jump to next line and indent it using auto-indent rules
- ~SPC j l~ to jump to a line with avy (works as an evil motion)
- ~SPC j n~ to split the current line at point, insert a new line and auto-indent
- ~SPC j s~ to split a quoted string or s-expression in place
- ~SPC j S~ to split a quoted string or s-expression, insert a new line and auto-indent
- ~SPC j u~ to undo a jump (go back to previous location)
- ~SPC j U~ to jump to a URL in the current buffer
- ~SPC j v~ to jump to the definition/declaration of the variable under the

View File

@ -99,7 +99,9 @@
- [[Smooth scrolling][Smooth scrolling]]
- [[Vim motions with avy][Vim motions with avy]]
- [[ace-link mode][ace-link mode]]
- [[Jumping][Jumping]]
- [[Jumping, Joining and Splitting][Jumping, Joining and Splitting]]
- [[Jumping][Jumping]]
- [[Joining and splitting][Joining and splitting]]
- [[Window manipulation][Window manipulation]]
- [[Window manipulation key bindings][Window manipulation key bindings]]
- [[Window manipulation micro-state][Window manipulation micro-state]]
@ -155,7 +157,6 @@
- [[Expand-region][Expand-region]]
- [[Indent text object][Indent text object]]
- [[Region narrowing][Region narrowing]]
- [[Line formatting][Line formatting]]
- [[Replacing text with iedit][Replacing text with iedit]]
- [[iedit states key bindings][iedit states key bindings]]
- [[Examples][Examples]]
@ -1421,22 +1422,23 @@ Similar to =avy=, [[https://github.com/abo-abo/ace-link][ace-link]] allows one t
|-------------+-------------------------------------------------------|
| ~o~ | initiate ace link mode in =help-mode= and =info-mode= |
*** Jumping
The ~SPC j~ prefix includes several commands related to "jumping" or quickly
moving to a relevant location based on context. You'll recognize some of the
bindings from the previous sections, which are duplicated here.
*** Jumping, Joining and Splitting
The ~SPC j~ prefix is for jumping, joining and splitting.
**** Jumping
| Key Binding | Description |
|-------------+-----------------------------------------------------------------------------------|
| ~SPC j 0~ | go to the beginning of line (and set a mark at the previous location in the line) |
| ~SPC j $~ | go to the end of line (and set a mark at the previous location in the line) |
| ~SPC j b~ | jump to a bookmark |
| ~SPC j c~ | jump to a character in the buffer (works as an evil motion) |
| ~SPC j d~ | jump to a listing of the current directory |
| ~SPC j D~ | jump to a listing of the current directory (other window) |
| ~SPC j f~ | jump to the definition of the function under the point |
| ~SPC j i~ | jump to a definition in buffer (imenu) |
| ~SPC j I~ | jump to a definition in any buffer (imenu) |
| ~SPC j j~ | jump to a character in the buffer (works as an evil motion) |
| ~SPC j J~ | jump to a suite of two characters in the buffer (works as an evil motion) |
| ~SPC j k~ | jump to next line and indent it using auto-indent rules |
| ~SPC j l~ | jump to a line with avy (works as an evil motion) |
| ~SPC j u~ | undo a jump (go back to previous location) |
@ -1444,6 +1446,17 @@ bindings from the previous sections, which are duplicated here.
| ~SPC j v~ | jump to the definition/declaration of the variable under the point |
| ~SPC j w~ | jump to a word in the current buffer (works as an evil motion) |
**** Joining and splitting
| Key Binding | Description |
|-------------+--------------------------------------------------------------------------|
| ~J~ | join the current line with the next line |
| ~SPC j k~ | go to next line and indent it using auto-indent rules |
| ~SPC j n~ | split the current line at point, insert a new line and auto-indent |
| ~SPC j s~ | split a quoted string or s-expression in place |
| ~SPC j S~ | split a quoted string or s-expression, insert a new line and auto-indent |
*** Window manipulation
**** Window manipulation key bindings
Every window has a number displayed at the start of the mode-line and
@ -2283,23 +2296,6 @@ The displayed text of a buffer can be narrowed with the commands (start with
| ~SPC n r~ | narrow the buffer to the selected text |
| ~SPC n w~ | widen, i.e show the whole buffer again |
*** Line formatting
Spacemacs performs =go to the line below point and indent it= with ~SPC j k~.
You may repeat this operation with =evil-repeat= if you need to indent many
lines.
Line formatting commands start with ~j~:
| Key Binding | Description |
|-------------+----------------------------------------------------------|
| ~J~ | join the current line with the next line |
| ~SPC j j~ | same as SPC j k but will split the current line at point |
| ~SPC J~ | split a quoted string or s-expression in place |
| ~SPC j J~ | split a quoted string or s-expression and auto-indent |
| ~SPC j k~ | go to next line and indent it using auto-indent rules |
Used together these key bindings are very powerful to quickly reformat code.
*** Replacing text with iedit
Spacemacs uses the powerful [[https://github.com/tsdh/iedit][iedit]] mode through [[https://github.com/syl20bnr/evil-iedit-state][evil-iedit-state]] to quickly
edit multiple occurrences of a symbol or selection.

View File

@ -125,7 +125,7 @@
(spacemacs/set-leader-keys
"jo" 'open-line
"j=" 'spacemacs/indent-region-or-buffer
"jJ" 'spacemacs/split-and-new-line
"jS" 'spacemacs/split-and-new-line
"jk" 'spacemacs/evil-goto-next-line-and-indent)
;; navigation/jumping ---------------------------------------------------------

View File

@ -383,7 +383,8 @@
(setq avy-all-windows 'all-frames)
(setq avy-background t)
(spacemacs/set-leader-keys
"jc" 'evil-avy-goto-char-2
"jj" 'evil-avy-goto-char
"jJ" 'evil-avy-goto-char-2
"jl" 'evil-avy-goto-line
"ju" 'avy-pop-mark
"jU" 'spacemacs/avy-goto-url
@ -1324,8 +1325,8 @@ on whether the spacemacs-ivy layer is used or not, with
sp-cancel-autoskip-on-backward-movement nil)
(spacemacs/set-leader-keys
"J" 'sp-split-sexp
"jj" 'sp-newline))
"js" 'sp-split-sexp
"jn" 'sp-newline))
:config
(progn
(require 'smartparens-config)