Add `spacemacs/iwb-region-or-buffer'.
This commit is contained in:
parent
d63ff5c0f2
commit
8ed7e5e7a1
|
@ -599,6 +599,7 @@ Other:
|
|||
- Added Dogemacs inverted banner for dark themes: "997-banner.txt"
|
||||
(thanks to Vitor Finotti and Robby O'Connor)
|
||||
- Added reference handler as per jump handler (thanks to Fangrui Song)
|
||||
- Added =spacemacs/iwb-region-or-buffer= (thanks to bb2020)
|
||||
*** Distribution changes
|
||||
- Refactored =spacemacs-bootstrap=, =spacemacs-ui=, and =spacemacs-ui-visual=
|
||||
layers:
|
||||
|
|
|
@ -2165,6 +2165,7 @@ The ~SPC j~ prefix is for jumping, joining and splitting.
|
|||
| ~SPC j l~ | jump to a line with avy (works as an evil motion) |
|
||||
| ~SPC j q~ | show the dumb-jump quick look tooltip |
|
||||
| ~SPC j u~ | jump to a URL in the current buffer |
|
||||
| ~SPC j U~ | select a URL in the current buffer and follow it |
|
||||
| ~SPC j v~ | jump to the definition/declaration of an Emacs Lisp variable |
|
||||
| ~SPC j w~ | jump to a word in the current buffer (works as an evil motion) |
|
||||
|
||||
|
@ -2178,6 +2179,8 @@ The ~SPC j~ prefix is for jumping, joining and splitting.
|
|||
| ~SPC j o~ | split the current line at point but let point on current line |
|
||||
| ~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 |
|
||||
| ~SPC j =~ | format the marked region or entire buffer |
|
||||
| ~SPC j +~ | format the marked region or entire buffer also cleanup whitespace |
|
||||
|
||||
*** Window manipulation
|
||||
**** Window manipulation key bindings
|
||||
|
|
|
@ -123,6 +123,22 @@ automatically applied to."
|
|||
(message "Indented buffer.")))
|
||||
(whitespace-cleanup)))
|
||||
|
||||
;; http://emacsblog.org/2007/01/17/indent-whole-buffer/
|
||||
(defun spacemacs/iwb-region-or-buffer ()
|
||||
"IWBs a region if selected, otherwise the whole buffer."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(if (region-active-p)
|
||||
(progn
|
||||
(untabify (region-beginning) (region-end))
|
||||
(indent-region (region-beginning) (region-end)))
|
||||
(progn
|
||||
(set-buffer-file-coding-system default-file-name-coding-system)
|
||||
;; (set-buffer-file-coding-system 'utf-8-unix)
|
||||
(untabify (point-min) (point-max))
|
||||
(indent-region (point-min) (point-max))
|
||||
(whitespace-cleanup)))))
|
||||
|
||||
;; from https://gist.github.com/3402786
|
||||
(defun spacemacs/toggle-maximize-buffer ()
|
||||
"Maximize buffer"
|
||||
|
|
|
@ -295,6 +295,7 @@
|
|||
(spacemacs/set-leader-keys
|
||||
"j(" 'check-parens
|
||||
"j=" 'spacemacs/indent-region-or-buffer
|
||||
"j+" 'spacemacs/iwb-region-or-buffer
|
||||
"jo" 'open-line
|
||||
"jS" 'spacemacs/split-and-new-line
|
||||
"jk" 'spacemacs/evil-goto-next-line-and-indent)
|
||||
|
|
Loading…
Reference in New Issue