branch: elpa/typst-ts-mode
commit d799bdffb0c18c541f98d3f0847ae2722bde12fe
Author: Huan Nguyen <[email protected]>
Commit: Huan Nguyen <[email protected]>
doc: Rename variable and add it to documentation.
---
README.md | 5 ++++-
typst-ts-mode.el | 18 ++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 043df9e45a..a71663bb53 100644
--- a/README.md
+++ b/README.md
@@ -83,6 +83,8 @@ For reference, this is my configuration.
`M-<up>` : `typst-ts-mode-heading-up`
`M-<down>` : `typst-ts-mode-heading-down`
`TAB` : `typst-ts-mode-cycle`
+`M-<return>`: `typst-ts-mode-meta-return`
+`<return>` : `typst-ts-mode-return`
*NOTE*: `outline-minor-mode` is enabled by `typst-ts-mode`, so you can use
comamnd
defined by `outline-minor-mode` such as `outline-cycle`.
@@ -92,7 +94,7 @@ defined by `outline-minor-mode` such as `outline-cycle`.
For customizable options: `customize` -> `typst-ts`.
Here are some options you may find useful:
-1. `typst-ts-mode-indent-offset` (default 4)
+1. `typst-ts-mode-indent-offset` (default 2)
2. `typst-ts-mode-executable-location`
3. `typst-ts-mode-watch-options`.
Set this to `--open` so typst will open the compiled file for you.
@@ -108,6 +110,7 @@ Here are some options you may find useful:
[auto-save](https://github.com/manateelazycat/auto-save) or
[super-save](https://github.com/bbatsov/super-save) useful (or annoying).
6. `typst-ts-mode-before-compile-hook` and `typst-ts-mode-after-compile-hook`
+7. `typst-ts-mode-return-autoincrement` autoincrement lists when pressing
RETURN (default `t`).
### Fontification
1. `typst-ts-mode-fontification-precise-level` (default `'middle`)
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index e0f1695e64..450cdcfe5f 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -154,11 +154,13 @@ level. See
`typst-ts-mode-fontification-precision-level'."
:type 'boolean
:group 'typst-ts-faces)
-(defcustom typst-ts-mode-return-smart t
- "Whether return key should behave smart.
-Smart as in, automatically insert a new list item when point before
-pressing return was on an item.
-Pressing return again without inserting a value will remove the list item.
+(defcustom typst-ts-mode-return-autoincrement t
+ "Whether return key should autoincrement.
+Smart as in, when point is on an item with text,
+pressing return will insert a newline and then an item.
+
+When point is on an item without text pressing return it will remove the item.
+
Example:
+ item RETURN
+ |< point is now here
@@ -1027,13 +1029,13 @@ Using ARG argument will ignore the context and it will
insert a heading instead.
(typst-ts-mode-insert--heading node)))))
(defun typst-ts-mode-return (&optional arg interactive)
- "Do something smart when `typst-ts-mode-return-smart' is non nil.
+ "Do something smart when `typst-ts-mode-return-autoincrement' is non nil.
Pressing enter will do something depending on context.
ARG and INTERACTIVE will be passed to `newline'.
INTERACTIVE will be non nil when called interactively.
-`typst-ts-mode-return-smart' for more documentation."
+`typst-ts-mode-return-autoincrement' for more documentation."
(interactive "*P\np")
- (if (or arg (not typst-ts-mode-return-smart))
+ (if (or arg (not typst-ts-mode-return-autoincrement))
(newline (if arg arg 1) interactive)
(let ((node (typst-ts-mode--item-on-line-p)))
(cond