From fd76a7f3006a1999f77014d28a5366e245b06948 Mon Sep 17 00:00:00 2001 From: Ag Ibragimov Date: Fri, 24 Aug 2018 19:23:13 -0700 Subject: [PATCH] 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 --- CHANGELOG.develop | 8 ++ doc/DOCUMENTATION.org | 124 ++++++++++-------- .../spacemacs-defaults/keybindings.el | 9 +- .../+spacemacs/spacemacs-visual/packages.el | 8 +- 4 files changed, 93 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.develop b/CHANGELOG.develop index 6f4651cea..897ea9da6 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -859,6 +859,14 @@ Other: - New variable =spacemacs-yank-indent-modes= to enable auto indent in modes not derived from =prog-mode= (thanks to bet4it) - 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 ~h~ key binding in compilation and grep buffers (thanks to Sylvain Benner) diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index 5dd2bbaf1..2e3589b93 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -87,8 +87,10 @@ - [[#all-the-icons-theme][All-the-Icons theme]] - [[#custom-spaceline-theme][Custom spaceline theme]] - [[#minor-modes][Minor Modes]] - - [[#frame-title][Frame title]] - - [[#iconified-tabified-title][Iconified (tabified) title]] + - [[#frame][Frame]] + - [[#title][Title]] + - [[#iconified-tabified-title][Iconified (tabified) title]] + - [[#transparency][Transparency]] - [[#layouts-and-workspaces][Layouts and workspaces]] - [[#layouts][Layouts]] - [[#the-default-layout][The default layout]] @@ -167,7 +169,7 @@ - [[#smartparens-strict-mode][Smartparens Strict mode]] - [[#zooming][Zooming]] - [[#text][Text]] - - [[#frame][Frame]] + - [[#frame-1][Frame]] - [[#increasedecrease-numbers][Increase/Decrease numbers]] - [[#spell-checking][Spell checking]] - [[#region-selection][Region selection]] @@ -1570,38 +1572,53 @@ squared symbols like =🅿=. | ~SPC t C-W~ | =Ⓦ= | W | automatic whitespace cleanup globally | | ~SPC t y~ | =ⓨ= | y | [[https://github.com/capitaomorte/yasnippet][yasnippet]] mode | -** Frame title -Default frame title displays name of current process and hostname of system. You -can include more information (like name of current file, name of current project -etc) by setting =dotspacemacs-frame-title-format= variable. +** Frame +*** Title + Default frame title displays name of current process and hostname of system. You + 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 | -|------+------------------------------------------------------------------------------| -| =%a= | the =abbreviated-file-name=, or =buffer-name= | -| =%t= | =projectile-project-name= | -| =%I= | =invocation-name= | -| =%S= | =system-name= | -| =%U= | contents of $USER | -| =%b= | buffer name | -| =%f= | visited file name | -| =%F= | frame name | -| =%s= | process status | -| =%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 | -| =%m= | mode name | -| =%n= | Narrow if appropriate | -| =%z= | mnemonics of buffer, terminal, and keyboard coding systems | -| =%Z= | like %z, but including the end-of-line format“ | + | Code | Description | + |------+------------------------------------------------------------------------------| + | =%a= | the =abbreviated-file-name=, or =buffer-name= | + | =%t= | =projectile-project-name= | + | =%I= | =invocation-name= | + | =%S= | =system-name= | + | =%U= | contents of $USER | + | =%b= | buffer name | + | =%f= | visited file name | + | =%F= | frame name | + | =%s= | process status | + | =%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 | + | =%m= | mode name | + | =%n= | Narrow if appropriate | + | =%z= | mnemonics of buffer, terminal, and keyboard coding systems | + | =%Z= | like %z, but including the end-of-line format“ | -*** Iconified (tabified) title -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= -variable. Short codes are same as for frame title. +**** Iconified (tabified) title + 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= + variable. Short codes are same as for frame title. -If this variable is set to =nil= (default) its value will be same as -=dotspacemacs-frame-title-format=. + If this variable is set to =nil= (default) its value will be same as + =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 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 The font size of the current buffer can be adjusted with the commands: -| Key binding | Description | -|-------------+--------------------------------------------------------------------------------| -| ~SPC z x +~ | 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 -~ | 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 | +| Key binding | Description | +|---------------------------------------+--------------------------------------------------------------------------------| +| ~SPC z x +~, ~SPC z x =~, ~SPC z x k~ | 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 0~ | reset the font size (no scaling) and initiate the font scaling transient state | In the transient state: -| Key binding | Description | -|-------------+------------------------| -| ~+~ | increase the font size | -| ~=~ | increase the font size | -| ~-~ | decrease the font size | -| ~0~ | reset the font size | +| Key binding | Description | +|---------------+------------------------| +| ~+~, ~=~, ~k~ | increase the font size | +| ~-~, ~j~ | decrease the font size | +| ~0~ | reset the font size | 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 @@ -2966,16 +2981,19 @@ a frame use the =zoom frame= bindings (see next section). **** Frame You can zoom in and out the whole content of the frame with the commands: -| Key binding | Description | -|-------------+-----------------------------------------------------------------------------| -| ~SPC z f +~ | 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 -~ | 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 | -| ~+~ | zoom in | -| ~=~ | zoom in | -| ~-~ | zoom out | -| ~0~ | reset zoom | +| Key binding | Description | +|---------------------------------------+-----------------------------------------------------------------------------| +| ~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 -~, ~SPC z f j~ | 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 | + +In the transient state: + +| Key binding | Description | +|---------------+------------------| +| ~+~, ~=~, ~k~ | zoom frame in | +| ~-~, ~j~ | zoom frame out | +| ~0~ | reset frame zoom | *** Increase/Decrease numbers Spacemacs uses [[https://github.com/cofi/evil-numbers][evil-numbers]] to easily increase or decrease numbers. diff --git a/layers/+spacemacs/spacemacs-defaults/keybindings.el b/layers/+spacemacs/spacemacs-defaults/keybindings.el index 86b172712..42d15c0e1 100644 --- a/layers/+spacemacs/spacemacs-defaults/keybindings.el +++ b/layers/+spacemacs/spacemacs-defaults/keybindings.el @@ -770,13 +770,16 @@ otherwise it is scaled down." (spacemacs|define-transient-state scale-font :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 ("+" spacemacs/scale-up-font) + ("k" spacemacs/scale-up-font) ("=" spacemacs/scale-up-font) ("-" spacemacs/scale-down-font) + ("j" spacemacs/scale-down-font) ("0" spacemacs/reset-font-size) ("q" nil :exit t)) + (spacemacs/set-leader-keys "zx" 'spacemacs/scale-font-transient-state/body) ;; 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 :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 ("+" spacemacs/increase-transparency) + ("k" spacemacs/increase-transparency) ("=" spacemacs/increase-transparency) ("-" spacemacs/decrease-transparency) + ("j" spacemacs/decrease-transparency) ("T" spacemacs/toggle-transparency) ("q" nil :exit t)) (spacemacs/set-leader-keys "TT" diff --git a/layers/+spacemacs/spacemacs-visual/packages.el b/layers/+spacemacs/spacemacs-visual/packages.el index a522f32cf..c0819c0b1 100644 --- a/layers/+spacemacs/spacemacs-visual/packages.el +++ b/layers/+spacemacs/spacemacs-visual/packages.el @@ -95,12 +95,18 @@ (spacemacs|define-transient-state zoom-frm :title "Zoom Frame Transient State" :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 ("+" spacemacs/zoom-frm-in) + ("k" spacemacs/zoom-frm-in) ("=" spacemacs/zoom-frm-in) ("-" 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)