2016-01-12 01:49:09 +00:00
|
|
|
|
#+TITLE: Rebox layer
|
2016-04-17 04:28:02 +00:00
|
|
|
|
|
2019-05-02 21:49:30 +00:00
|
|
|
|
#+TAGS: layer|tool
|
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
|
* Table of Contents :TOC_4_gh:noexport:
|
2017-08-16 15:50:02 +00:00
|
|
|
|
- [[#description][Description]]
|
2017-08-28 21:58:10 +00:00
|
|
|
|
- [[#features][Features:]]
|
2017-08-16 15:50:02 +00:00
|
|
|
|
- [[#install][Install]]
|
|
|
|
|
- [[#layer][Layer]]
|
|
|
|
|
- [[#configuration][Configuration]]
|
|
|
|
|
- [[#styles-cycling][Styles cycling]]
|
|
|
|
|
- [[#text-mode][Text mode]]
|
|
|
|
|
- [[#style-templates][Style Templates]]
|
|
|
|
|
- [[#standard-packaged-templates][Standard packaged templates]]
|
|
|
|
|
- [[#comments][Comments]]
|
|
|
|
|
- [[#additional-templates][Additional Templates]]
|
|
|
|
|
- [[#key-bindings][Key bindings]]
|
2016-04-17 04:28:02 +00:00
|
|
|
|
|
|
|
|
|
* Description
|
|
|
|
|
This layer adds support for [[https://github.com/lewang/rebox2][rebox2]] package which is a minor-mode allowing
|
|
|
|
|
to easily add ASCII text boxes to a buffer.
|
|
|
|
|
|
|
|
|
|
A nice video demonstration by the package author can be found [[https://www.youtube.com/watch?v=53YeTdVtDkU][here]].
|
|
|
|
|
|
2017-08-28 21:58:10 +00:00
|
|
|
|
** Features:
|
2016-04-17 04:28:02 +00:00
|
|
|
|
- Auto-wrap correctly in comments,
|
|
|
|
|
- Auto-fill correctly in comments,
|
|
|
|
|
- Boxes auto-adapt as text is inserted or deleted,
|
2016-11-24 20:38:44 +00:00
|
|
|
|
- ~S-RET~ to continue a comment on the next line,
|
2016-04-17 04:28:02 +00:00
|
|
|
|
- Kill/yank within the box,
|
2016-11-22 20:53:50 +00:00
|
|
|
|
- Apparently works well with ancient =filladpt-mode= (see authors video).
|
2016-04-17 04:28:02 +00:00
|
|
|
|
|
|
|
|
|
* Install
|
|
|
|
|
** Layer
|
|
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
|
add =rebox= to the existing =dotspacemacs-configuration-layers= list in this
|
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
|
** Configuration
|
|
|
|
|
*** Styles cycling
|
|
|
|
|
Box styles are identified by numbers, it is possible to cycle through a list
|
2016-05-03 00:33:00 +00:00
|
|
|
|
of styles using ~SPC x b n~. This list can be customized by setting the variable
|
2016-04-17 04:28:02 +00:00
|
|
|
|
=rebox-style-loop=.
|
2016-01-12 01:49:09 +00:00
|
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-09-19 03:54:47 +00:00
|
|
|
|
(setq rebox-style-loop '(71 72 73))
|
2016-01-12 01:49:09 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-04-17 04:28:02 +00:00
|
|
|
|
*** Text mode
|
|
|
|
|
As text mode usage could surprise some users (e.g., when they enter M-q to fill
|
|
|
|
|
a paragraph) =rebox= is not enabled by default in =text-mode=. To enable it you
|
|
|
|
|
need to set the layer variable =rebox-enable-in-text-mode= to =t=.
|
2016-01-12 01:49:09 +00:00
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
(setq-default dotspacemacs-configuration-layers '(
|
|
|
|
|
(rebox :variables rebox-enable-in-text-mode t)))
|
|
|
|
|
#+END_SRC
|
2016-01-12 01:49:09 +00:00
|
|
|
|
|
2016-04-17 04:28:02 +00:00
|
|
|
|
* Style Templates
|
|
|
|
|
** Standard packaged templates
|
2017-08-16 15:50:02 +00:00
|
|
|
|
You can find the full list of templates in
|
2018-09-19 03:54:47 +00:00
|
|
|
|
[[https://github.com/lewang/rebox2/blob/master/rebox2.el][“Box templates” section of =rebox2.el=]]
|
2017-08-16 15:50:02 +00:00
|
|
|
|
|
2016-04-17 04:28:02 +00:00
|
|
|
|
*** Comments
|
|
|
|
|
These templates are single line comments styles. A =#= is used here for
|
|
|
|
|
illustration; however, it will work equally well if the comment character is
|
2018-09-19 03:54:47 +00:00
|
|
|
|
different (e.g., lisp’s =;= comment character).
|
2016-01-12 01:49:09 +00:00
|
|
|
|
|
2016-04-17 04:28:02 +00:00
|
|
|
|
** Additional Templates
|
|
|
|
|
These templates are added by the Spacemacs layer.
|
2016-01-12 01:49:09 +00:00
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
|
#+BEGIN_SRC sh
|
2016-01-12 01:49:09 +00:00
|
|
|
|
#
|
|
|
|
|
# box style 71
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# ------------
|
|
|
|
|
# box style 72
|
|
|
|
|
# ------------
|
|
|
|
|
|
|
|
|
|
# ============
|
|
|
|
|
# box style 73
|
|
|
|
|
# ============
|
|
|
|
|
|
|
|
|
|
#--------------
|
|
|
|
|
# box style 74
|
|
|
|
|
#--------------
|
|
|
|
|
|
|
|
|
|
#--------------+
|
|
|
|
|
# box style 75
|
|
|
|
|
#--------------+
|
|
|
|
|
|
|
|
|
|
#==============
|
|
|
|
|
# box style 76
|
|
|
|
|
#==============
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
|
## box style 81
|
|
|
|
|
##
|
|
|
|
|
|
|
|
|
|
## ------------
|
|
|
|
|
## box style 82
|
|
|
|
|
## ------------
|
|
|
|
|
|
|
|
|
|
## ============
|
|
|
|
|
## box style 83
|
|
|
|
|
## ============
|
|
|
|
|
|
|
|
|
|
##--------------
|
|
|
|
|
## box style 84
|
|
|
|
|
##--------------
|
|
|
|
|
|
|
|
|
|
##--------------+
|
|
|
|
|
## box style 85
|
|
|
|
|
##--------------+
|
|
|
|
|
|
|
|
|
|
##==============
|
|
|
|
|
## box style 86
|
|
|
|
|
##==============
|
2018-09-19 03:54:47 +00:00
|
|
|
|
#+END_SRC
|
2016-01-12 01:49:09 +00:00
|
|
|
|
|
2016-04-17 04:28:02 +00:00
|
|
|
|
* Key bindings
|
|
|
|
|
*Note:* Use a numerical prefix argument to choose a specific style for instance
|
2016-05-03 00:33:00 +00:00
|
|
|
|
~86 SPC x b b~ to use the style 86 above.
|
2016-04-17 04:28:02 +00:00
|
|
|
|
|
2018-10-23 14:18:21 +00:00
|
|
|
|
| Key binding | Command |
|
2016-04-22 02:25:51 +00:00
|
|
|
|
|-------------+-------------------------------------------------------------------|
|
2016-05-03 00:33:00 +00:00
|
|
|
|
| ~SPC x b >~ | Move box to the right (point must be around left side of the box) |
|
|
|
|
|
| ~SPC x b <~ | Move box to the left (point must be around left side of the box) |
|
|
|
|
|
| ~SPC x b b~ | Draw next box defined in =rebox-style-loop= |
|
|
|
|
|
| ~SPC x b B~ | Draw previous box defined in =rebox-style-loop= |
|
|
|
|
|
| ~SPC x b c~ | Center box (point must be around left side of the box) |
|
2016-11-24 20:38:44 +00:00
|
|
|
|
| ~S-RET~ | rebox-indent-new-line |
|