Add j and k to transient states

It is nicer when user can stay in the "home row" for basic operations like
zooming in and out

Font Scaling Transient State
`k` scale up
`j` scale down

Frame Transparency Transient State
`k` increase transparency
`j` decrease transparency

Zoom Frame Transient State
`k` zoom frame in
`j` zoom frame out

Added two additional Zoom Frame TS keys:
`m` max frame
`f` fullscreen
This commit is contained in:
Ag Ibragimov 2018-08-24 19:23:13 -07:00 committed by duianto
parent 367f5ff28c
commit fd76a7f300
4 changed files with 93 additions and 56 deletions

View file

@ -859,6 +859,14 @@ Other:
- New variable =spacemacs-yank-indent-modes= to enable auto indent in modes - New variable =spacemacs-yank-indent-modes= to enable auto indent in modes
not derived from =prog-mode= (thanks to bet4it) not derived from =prog-mode= (thanks to bet4it)
- Remap ~M-SPC~ and ~SPC-x-d-SPC~ to =cycle-spacing= (thanks to bb2020) - Remap ~M-SPC~ and ~SPC-x-d-SPC~ to =cycle-spacing= (thanks to bb2020)
- Added ~j~ and ~k~ to transient states (thanks to Ag Ibragimov):
- Font Scaling
- Frame Transparency
- Zoom Frame
- Added key bindings to the zoom frame transient state:
- ~m~ for toggle maximize
- ~f~ for toggle fullscreen
(thanks to Ag Ibragimov)
- Fixed: - Fixed:
- Fixed ~h~ key binding in compilation and grep buffers - Fixed ~h~ key binding in compilation and grep buffers
(thanks to Sylvain Benner) (thanks to Sylvain Benner)

View file

@ -87,8 +87,10 @@
- [[#all-the-icons-theme][All-the-Icons theme]] - [[#all-the-icons-theme][All-the-Icons theme]]
- [[#custom-spaceline-theme][Custom spaceline theme]] - [[#custom-spaceline-theme][Custom spaceline theme]]
- [[#minor-modes][Minor Modes]] - [[#minor-modes][Minor Modes]]
- [[#frame-title][Frame title]] - [[#frame][Frame]]
- [[#iconified-tabified-title][Iconified (tabified) title]] - [[#title][Title]]
- [[#iconified-tabified-title][Iconified (tabified) title]]
- [[#transparency][Transparency]]
- [[#layouts-and-workspaces][Layouts and workspaces]] - [[#layouts-and-workspaces][Layouts and workspaces]]
- [[#layouts][Layouts]] - [[#layouts][Layouts]]
- [[#the-default-layout][The default layout]] - [[#the-default-layout][The default layout]]
@ -167,7 +169,7 @@
- [[#smartparens-strict-mode][Smartparens Strict mode]] - [[#smartparens-strict-mode][Smartparens Strict mode]]
- [[#zooming][Zooming]] - [[#zooming][Zooming]]
- [[#text][Text]] - [[#text][Text]]
- [[#frame][Frame]] - [[#frame-1][Frame]]
- [[#increasedecrease-numbers][Increase/Decrease numbers]] - [[#increasedecrease-numbers][Increase/Decrease numbers]]
- [[#spell-checking][Spell checking]] - [[#spell-checking][Spell checking]]
- [[#region-selection][Region selection]] - [[#region-selection][Region selection]]
@ -1570,38 +1572,53 @@ squared symbols like =🅿=.
| ~SPC t C-W~ | =Ⓦ= | W | automatic whitespace cleanup globally | | ~SPC t C-W~ | =Ⓦ= | W | automatic whitespace cleanup globally |
| ~SPC t y~ | =ⓨ= | y | [[https://github.com/capitaomorte/yasnippet][yasnippet]] mode | | ~SPC t y~ | =ⓨ= | y | [[https://github.com/capitaomorte/yasnippet][yasnippet]] mode |
** Frame title ** Frame
Default frame title displays name of current process and hostname of system. You *** Title
can include more information (like name of current file, name of current project Default frame title displays name of current process and hostname of system. You
etc) by setting =dotspacemacs-frame-title-format= variable. can include more information (like name of current file, name of current project
etc) by setting =dotspacemacs-frame-title-format= variable.
Following format short codes are available: Following format short codes are available:
| Code | Description | | Code | Description |
|------+------------------------------------------------------------------------------| |------+------------------------------------------------------------------------------|
| =%a= | the =abbreviated-file-name=, or =buffer-name= | | =%a= | the =abbreviated-file-name=, or =buffer-name= |
| =%t= | =projectile-project-name= | | =%t= | =projectile-project-name= |
| =%I= | =invocation-name= | | =%I= | =invocation-name= |
| =%S= | =system-name= | | =%S= | =system-name= |
| =%U= | contents of $USER | | =%U= | contents of $USER |
| =%b= | buffer name | | =%b= | buffer name |
| =%f= | visited file name | | =%f= | visited file name |
| =%F= | frame name | | =%F= | frame name |
| =%s= | process status | | =%s= | process status |
| =%p= | percent of buffer above top of window, or Top, Bot or All | | =%p= | percent of buffer above top of window, or Top, Bot or All |
| =%P= | percent of buffer above bottom of window, perhaps plus Top, or Bottom or All | | =%P= | percent of buffer above bottom of window, perhaps plus Top, or Bottom or All |
| =%m= | mode name | | =%m= | mode name |
| =%n= | Narrow if appropriate | | =%n= | Narrow if appropriate |
| =%z= | mnemonics of buffer, terminal, and keyboard coding systems | | =%z= | mnemonics of buffer, terminal, and keyboard coding systems |
| =%Z= | like %z, but including the end-of-line format“ | | =%Z= | like %z, but including the end-of-line format“ |
*** Iconified (tabified) title **** Iconified (tabified) title
If you are using tiling window manager with tab support you may want to display If you are using tiling window manager with tab support you may want to display
different title for inactive tabs with =dotspacemacs-icon-title-format= different title for inactive tabs with =dotspacemacs-icon-title-format=
variable. Short codes are same as for frame title. variable. Short codes are same as for frame title.
If this variable is set to =nil= (default) its value will be same as If this variable is set to =nil= (default) its value will be same as
=dotspacemacs-frame-title-format=. =dotspacemacs-frame-title-format=.
*** Transparency
The Frame transparency can be toggled with: ~SPC T T~
This also opens the Frame Transparency Transient State.
In the transient state:
| Key binding | Description |
|---------------+--------------------------------|
| ~+~, ~=~, ~k~ | increase transparency |
| ~-~, ~j~ | decrease transparency |
| ~T~ | toggle transparency on and off |
| ~q~ | quit transient state |
* Layouts and workspaces * Layouts and workspaces
Layouts are window configurations with buffer isolation. Each layout can define Layouts are window configurations with buffer isolation. Each layout can define
@ -2943,21 +2960,19 @@ It is possible to enable it easily for /all programming modes/ with the variable
**** Text **** Text
The font size of the current buffer can be adjusted with the commands: The font size of the current buffer can be adjusted with the commands:
| Key binding | Description | | Key binding | Description |
|-------------+--------------------------------------------------------------------------------| |---------------------------------------+--------------------------------------------------------------------------------|
| ~SPC z x +~ | scale up the font and initiate the font scaling transient state | | ~SPC z x +~, ~SPC z x =~, ~SPC z x k~ | scale up the font and initiate the font scaling transient state |
| ~SPC z x =~ | scale up the font and initiate the font scaling transient state | | ~SPC z x -~, ~SPC z x j~ | scale down the font and initiate the font scaling transient state |
| ~SPC z x -~ | scale down the font and initiate the font scaling transient state | | ~SPC z x 0~ | reset the font size (no scaling) and initiate the font scaling transient state |
| ~SPC z x 0~ | reset the font size (no scaling) and initiate the font scaling transient state |
In the transient state: In the transient state:
| Key binding | Description | | Key binding | Description |
|-------------+------------------------| |---------------+------------------------|
| ~+~ | increase the font size | | ~+~, ~=~, ~k~ | increase the font size |
| ~=~ | increase the font size | | ~-~, ~j~ | decrease the font size |
| ~-~ | decrease the font size | | ~0~ | reset the font size |
| ~0~ | reset the font size |
Note that /only/ the text of the current buffer is scaled, the other buffers, Note that /only/ the text of the current buffer is scaled, the other buffers,
the mode-line and the minibuffer are not affected. To zoom the whole content of the mode-line and the minibuffer are not affected. To zoom the whole content of
@ -2966,16 +2981,19 @@ a frame use the =zoom frame= bindings (see next section).
**** Frame **** Frame
You can zoom in and out the whole content of the frame with the commands: You can zoom in and out the whole content of the frame with the commands:
| Key binding | Description | | Key binding | Description |
|-------------+-----------------------------------------------------------------------------| |---------------------------------------+-----------------------------------------------------------------------------|
| ~SPC z f +~ | zoom in the frame content and initiate the frame scaling transient state | | ~SPC z f +~, ~SPC z f =~, ~SPC z f k~ | zoom in the frame content and initiate the frame scaling transient state |
| ~SPC z f =~ | zoom in the frame content and initiate the frame scaling transient state | | ~SPC z f -~, ~SPC z f j~ | zoom out the frame content and initiate the frame scaling transient state |
| ~SPC z f -~ | zoom out the frame content and initiate the frame scaling transient state | | ~SPC z f 0~ | reset the frame content size and initiate the frame scaling transient state |
| ~SPC z f 0~ | reset the frame content size and initiate the frame scaling transient state |
| ~+~ | zoom in | In the transient state:
| ~=~ | zoom in |
| ~-~ | zoom out | | Key binding | Description |
| ~0~ | reset zoom | |---------------+------------------|
| ~+~, ~=~, ~k~ | zoom frame in |
| ~-~, ~j~ | zoom frame out |
| ~0~ | reset frame zoom |
*** Increase/Decrease numbers *** Increase/Decrease numbers
Spacemacs uses [[https://github.com/cofi/evil-numbers][evil-numbers]] to easily increase or decrease numbers. Spacemacs uses [[https://github.com/cofi/evil-numbers][evil-numbers]] to easily increase or decrease numbers.

View file

@ -770,13 +770,16 @@ otherwise it is scaled down."
(spacemacs|define-transient-state scale-font (spacemacs|define-transient-state scale-font
:title "Font Scaling Transient State" :title "Font Scaling Transient State"
:doc "\n[_+_/_=_] scale up [_-_] scale down [_0_] reset font [_q_] quit" :doc "\n[_+_/_=_/_k_] scale up [_-_/_j_] scale down [_0_] reset font [_q_] quit"
:bindings :bindings
("+" spacemacs/scale-up-font) ("+" spacemacs/scale-up-font)
("k" spacemacs/scale-up-font)
("=" spacemacs/scale-up-font) ("=" spacemacs/scale-up-font)
("-" spacemacs/scale-down-font) ("-" spacemacs/scale-down-font)
("j" spacemacs/scale-down-font)
("0" spacemacs/reset-font-size) ("0" spacemacs/reset-font-size)
("q" nil :exit t)) ("q" nil :exit t))
(spacemacs/set-leader-keys "zx" 'spacemacs/scale-font-transient-state/body) (spacemacs/set-leader-keys "zx" 'spacemacs/scale-font-transient-state/body)
;; end of Text Manipulation Transient State ;; end of Text Manipulation Transient State
@ -835,11 +838,13 @@ If FRAME is nil, it defaults to the selected frame."
(spacemacs|define-transient-state scale-transparency (spacemacs|define-transient-state scale-transparency
:title "Frame Transparency Transient State" :title "Frame Transparency Transient State"
:doc "\n[_+_/_=_] increase transparency [_-_] decrease [_T_] toggle [_q_] quit" :doc "\n[_+_/_=_/_k_] increase transparency [_-_/_j_] decrease [_T_] toggle [_q_] quit"
:bindings :bindings
("+" spacemacs/increase-transparency) ("+" spacemacs/increase-transparency)
("k" spacemacs/increase-transparency)
("=" spacemacs/increase-transparency) ("=" spacemacs/increase-transparency)
("-" spacemacs/decrease-transparency) ("-" spacemacs/decrease-transparency)
("j" spacemacs/decrease-transparency)
("T" spacemacs/toggle-transparency) ("T" spacemacs/toggle-transparency)
("q" nil :exit t)) ("q" nil :exit t))
(spacemacs/set-leader-keys "TT" (spacemacs/set-leader-keys "TT"

View file

@ -95,12 +95,18 @@
(spacemacs|define-transient-state zoom-frm (spacemacs|define-transient-state zoom-frm
:title "Zoom Frame Transient State" :title "Zoom Frame Transient State"
:doc " :doc "
[_+_/_=_] zoom frame in [_-_] zoom frame out [_0_] reset zoom [_q_] quit" [_+_/_=_/_k_] zoom frame in [_m_] max frame
[_-_/_j_]^^ zoom frame out [_f_] fullscreen
[_0_]^^^^ reset zoom [_q_] quit"
:bindings :bindings
("+" spacemacs/zoom-frm-in) ("+" spacemacs/zoom-frm-in)
("k" spacemacs/zoom-frm-in)
("=" spacemacs/zoom-frm-in) ("=" spacemacs/zoom-frm-in)
("-" spacemacs/zoom-frm-out) ("-" spacemacs/zoom-frm-out)
("j" spacemacs/zoom-frm-out)
("0" spacemacs/zoom-frm-unzoom) ("0" spacemacs/zoom-frm-unzoom)
("f" spacemacs/toggle-frame-fullscreen-non-native)
("m" spacemacs/toggle-maximize-frame)
("q" nil :exit t)) ("q" nil :exit t))
(spacemacs/set-leader-keys "zf" 'spacemacs/zoom-frm-transient-state/body) (spacemacs/set-leader-keys "zf" 'spacemacs/zoom-frm-transient-state/body)