More emacs configuration tweaks (multiple-cursor on click, minimap, code folding, ensime eval overlays)
At Affectv we use a wide range of editors: Sublime, Atom, Emacs, Pycharm, IntelliJ... Actually only two people use the same editor! As such, from time to time I see things in other people's editors that I would like to have as well. So, yesterday I decided to improve on some configuration settings on Spacemacs.
Click for multiple-cursors
I saw this on Jordi's Sublime, and it is much more comfortable than using more-like-this or similar helper functions, even if I need to use the trackpad to do so. After all, a multi-cursor edit (proper edit, not as a substitute for a macro) is rare enough that I can tolerate leaving the home row. Easy enough to configure thanks to Magnar Sveen.
(global-unset-key (kbd "M-<down-mouse-1>")) (global-set-key (kbd "M-<mouse-1>") 'mc/add-cursor-on-click)
Also from Sublime, I had this on my old emacs setup. As simple as adding minimap to the list of additional packages and configuring its property group. See animation below.
dotspacemacs-additional-packages '(helm-dash key-chord pig-mode mmm-mode minimap origami ansible)
I have always loved how clean vim's folding works, and how Sublime has this nice folding. Then I found origami-mode and my emacs-life was complete. I tweaked a little the folding functions so that minimap was updated on fold (for some reason it is not, I guess minimap is tied to the "modified" hook or similar). I bound
A-zwhich maps to
æin Colemak) to the basic fold operations.
(eval-after-load 'origami '(progn (defun rb-show-only (buffer point) (interactive (list (current-buffer) (point))) (progn (origami-show-only-node buffer point) (minimap-new-minimap))) (defun rb-toggle-rec (buffer point) (interactive (list (current-buffer) (point))) (progn (origami-recursively-toggle-node buffer point) (minimap-new-minimap))) (define-key evil-normal-state-map "æ" 'rb-show-only) (define-key evil-normal-state-map "Z" 'origami-toggle-node) (define-key evil-visual-state-map "Z" 'origami-toggle-node) (define-key evil-insert-state-map "C-Z" 'origami-toggle-node) (define-key evil-normal-state-map "z" 'rb-toggle-rec) (define-key evil-visual-state-map "z" 'rb-toggle-rec) (define-key evil-insert-state-map "C-z" 'rb-toggle-rec) )))
For some reason just advising the functions with after didn't work, this is not great but does work. I left the Z bindings as they are, since I have not used them yet, and will probably delete them if I keep not using them.
Execution overlays in Ensime (Scala)
I saw this for Cider in the emacs church meeting from August, and heard @fommil (I think it was him) mention that it was coming to ensime. And indeed it was. And it's easy enough to use
C-c C-v C-r(thing of it as extended command, eval, region to remember), given an open inferior Scala interpreter. Symbol prettify does not apply to overlays, so you need to customise the arrow used therein.