Undo-region: more ergonomic keybindings (#15631)
This commit is contained in:
parent
872c714d54
commit
aee4fa85d5
|
@ -127,6 +127,8 @@ the [[file:CHANGELOG.org][CHANGELOG.org]] file.
|
|||
(thanks to Seong Yong-ju)
|
||||
- Changed ~SPC t t m~ from ~timeclock-modeline-display~ which was deprecated
|
||||
in Emacs 24.3 to ~timeclock-mode-line-display~ (thanks to Zach Pearson)
|
||||
- Added =vim-style-enable-undo-region= style variables to enable undo-region
|
||||
in Vim editing style; disabled by default. (thanks to Benedict HW)
|
||||
- Other:
|
||||
- Support for multiple cursors using =evil-mc= is now encapsulated in the
|
||||
=multiple-cursors= layer (thanks to Codruț Constantin Gușoi)
|
||||
|
|
|
@ -74,6 +74,10 @@ if used there.")
|
|||
dotspacemacs-visual-line-move-text nil)
|
||||
"If non-nil, J and K move lines up and down when in visual mode.")
|
||||
|
||||
(defvar vim-style-enable-undo-region nil
|
||||
"If non-nil, `u' is remapped to `undo' in visual state.
|
||||
Otherwise, in visual state `u' downcases visually selected text.")
|
||||
|
||||
(defvar vim-style-ex-substitute-global
|
||||
(spacemacs|dotspacemacs-backward-compatibility
|
||||
dotspacemacs-ex-substitute-global nil)
|
||||
|
|
|
@ -145,6 +145,9 @@
|
|||
(define-key evil-visual-state-map "J" 'drag-stuff-down)
|
||||
(define-key evil-visual-state-map "K" 'drag-stuff-up))
|
||||
|
||||
(when vim-style-enable-undo-region
|
||||
(define-key evil-visual-state-map (kbd "u") 'undo))
|
||||
|
||||
(evil-ex-define-cmd "enew" 'spacemacs/new-empty-buffer)
|
||||
|
||||
(define-key evil-normal-state-map (kbd "K") 'spacemacs/evil-smart-doc-lookup)
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* Table of Contents :TOC_5_gh:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#features][Features:]]
|
||||
- [[#customization][Customization]]
|
||||
- [[#undo-region][Undo Region]]
|
||||
|
||||
* Description
|
||||
This layer adds packages to improve editing with Spacemacs.
|
||||
|
@ -33,3 +35,20 @@ This layer adds packages to improve editing with Spacemacs.
|
|||
- Support for [[https://github.com/PythonNut/evil-easymotion][=evil-easymotion=]] if the editing style is =vim= or =hybrid=.
|
||||
- Support for cycling between multi line block styles via [[https://github.com/IvanMalison/multi-line/][=multi-line=]].
|
||||
- Support for editing strings inplace via [[https://github.com/magnars/string-edit.el][=string-edit=]]
|
||||
- Presents undo history as a tree via [[https://gitlab.com/tsc25/undo-tree/-/blob/master/undo-tree.el][=undo-tree=]]
|
||||
|
||||
* Customization
|
||||
** Undo Region
|
||||
In normal state, ~u~ is bound to =evil-undo= which undo changes in the buffer.
|
||||
Emacs's builtin =undo= command in addition has the ability to undo changes in a
|
||||
selected region. But by default in visual state, ~u~ is bound to =evil-downcase=
|
||||
which downcases the selected text.
|
||||
|
||||
You can bound =undo= to ~u~ in visual state, by setting the variable
|
||||
=vim-style-enable-undo-region= to =t= in your =~/.spacemacs=.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq-default dotspacemacs-configuration-layers
|
||||
'((spacemacs-editing :variables
|
||||
vim-style-enable-undo-region t)))
|
||||
#+END_SRC
|
||||
|
|
|
@ -536,6 +536,8 @@
|
|||
(progn
|
||||
(setq undo-tree-visualizer-timestamps t
|
||||
undo-tree-visualizer-diff t
|
||||
;; See `vim-style-enable-undo-region'.
|
||||
undo-tree-enable-undo-in-region t
|
||||
;; 10X bump of the undo limits to avoid issues with premature
|
||||
;; Emacs GC which truncages the undo history very aggresively
|
||||
undo-limit 800000
|
||||
|
|
Loading…
Reference in New Issue