This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+spacemacs/spacemacs-visual/packages.el
duianto b9e61e6437 Add transient state keys _, j, k
Thanks sdwolfz for the suggestion to add underscore to the transient states,
then the shift key doesn't have to be released if it was held down to press `+`.

Added key bindings:
Evil numbers:
`SPC n _` decrease number under point
in the transient state:
`j` decrease number under point
`k` increase number under point

`SPC T T _` decrease transparency
`SPC z x _` scale down font
`SPC z f _` zoom out frame

Update documentation:
Zoom frame:
`q` quit transient state

Evil numbers:
`SPC n =` increase number under point
`SPC n _` decrease number under point
`0..9` add a number prefix argument
`q` quit transient state

Fixed a typo and made a small rewrite of the tip about using a prefix argument.

Added keys to transient states:
Font scaling:
Added `_` scale down
Reordered `k` assignment to match the order in the transient state

Frame transparency:
Added `_` decrease
Reordered `k` assignment to match the order in the transient state

Evil numbers:
Added `k` increase
Added `_` and `j` decrease

Zoom frame:
Added `_` zoom frame out
Reordered `k` assignment to match the order in the transient state

Which-key entries for Evil numbers `SPC n`:
Group together keys that call the same command:
From: + and =
To:   +,=

From: - and _
To:   -,_
2019-07-14 22:56:57 +02:00

116 lines
4.7 KiB
EmacsLisp

;;; packages.el --- Spacemacs UI Visual Layer packages File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq spacemacs-visual-packages
'(
(ansi-colors :location built-in)
desktop
fill-column-indicator
hl-todo
popup
popwin
(zoom-frm :location local)
))
(defun spacemacs-visual/init-ansi-colors ()
(add-hook 'compilation-filter-hook
'spacemacs-visual//compilation-buffer-apply-ansi-colors))
(defun spacemacs-visual/init-desktop ()
(use-package desktop
:defer t
:init
(setq desktop-dirname spacemacs-cache-directory)
:config
(add-to-list 'desktop-path spacemacs-cache-directory)))
(defun spacemacs-visual/init-fill-column-indicator ()
(use-package fill-column-indicator
:defer t
:init
(progn
(setq fci-rule-width 1)
;; manually register the minor mode since it does not define any
;; lighter
(add-to-list 'minor-mode-alist '(fci-mode ""))
(spacemacs|add-toggle fill-column-indicator
:status fci-mode
:on (turn-on-fci-mode)
:off (turn-off-fci-mode)
:documentation "Display the fill column indicator."
:evil-leader "tf"))
:config
(spacemacs|diminish fci-mode "" " f")))
(defun spacemacs-visual/init-hl-todo ()
(use-package hl-todo
:defer t
:init
;; global hook activates hl-todo-mode for prog-mode, text-mode
;; mode can be explicitly defined using hl-todo-activate-in-modes variable
(global-hl-todo-mode 1)))
(defun spacemacs-visual/init-popup ())
(defun spacemacs-visual/init-popwin ()
(use-package popwin
:config
(progn
(popwin-mode 1)
(spacemacs/set-leader-keys "wpm" 'popwin:messages)
(spacemacs/set-leader-keys "wpp" 'popwin:close-popup-window)
;; don't use default value but manage it ourselves
(setq popwin:special-display-config nil)
;; buffers that we manage
(push '("*Help*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config)
(push '("*Process List*" :dedicated t :position bottom :stick t :noselect nil :height 0.4) popwin:special-display-config)
(push '("*compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config)
(push '("*Shell Command Output*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("*Async Shell Command*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("*undo-tree*" :dedicated t :position right :stick t :noselect nil :width 60) popwin:special-display-config)
(push '("*undo-tree Diff*" :dedicated t :position bottom :stick t :noselect nil :height 0.3) popwin:special-display-config)
(push '("*ert*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("*grep*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("*nosetests*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config)
(push '("*Google Translate*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config))))
(defun spacemacs-visual/init-zoom-frm ()
(use-package zoom-frm
:commands (zoom-frm-unzoom
zoom-frm-out
zoom-frm-in)
:init
(progn
(spacemacs|define-transient-state zoom-frm
:title "Zoom Frame Transient State"
:doc "
[_+_/_=_/_k_] zoom frame in [_m_] max frame
[_-_/___/_j_] zoom frame out [_f_] fullscreen
[_0_]^^^^ reset zoom [_q_] quit"
:bindings
("+" spacemacs/zoom-frm-in)
("=" spacemacs/zoom-frm-in)
("k" spacemacs/zoom-frm-in)
("-" spacemacs/zoom-frm-out)
("_" spacemacs/zoom-frm-out)
("j" spacemacs/zoom-frm-out)
("0" spacemacs/zoom-frm-unzoom)
("f" spacemacs/toggle-frame-fullscreen-non-native)
("m" spacemacs/toggle-maximize-frame)
("q" nil :exit t))
(spacemacs/set-leader-keys "zf" 'spacemacs/zoom-frm-transient-state/body)
;; Font size, either with ctrl + mouse wheel
(global-set-key (kbd "<C-wheel-up>") 'spacemacs/zoom-frm-in)
(global-set-key (kbd "<C-wheel-down>") 'spacemacs/zoom-frm-out))))