branch: elpa/typst-ts-mode
commit a184c386cae6a3da7e156d3f27929813762c6d98
Merge: 7f6bf64232 9e95d143e5
Author: huantn <nguyenthieuh...@gmail.com>
Commit: huantn <nguyenthieuh...@gmail.com>

    Merge pull request 'Fix: #77' (#78) from develop into main
    
    Reviewed-on: https://codeberg.org/meow_king/typst-ts-mode/pulls/78
---
 typst-ts-mode.el | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index a5a0f24311..6a3c6e1514 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -1,7 +1,7 @@
 ;;; typst-ts-mode.el --- Tree Sitter support for Typst  -*- lexical-binding: 
t; -*-
 ;; Copyright (C) 2023-2025 The typst-ts-mode Project Contributors
 
-;; Version: 0.12.1
+;; Version: 0.12.2
 ;; Author: Ziqi Yang <mr.meowk...@anche.no>
 ;; Maintainer: Ziqi Yang <mr.meowk...@anche.no>
 ;;   Huan Nguyen <nguyenthieuh...@gmail.com>
@@ -35,6 +35,7 @@
 (require 'elec-pair)
 (require 'easymenu)
 
+(require 'typst-ts-variables)
 (require 'typst-ts-embedding-lang-settings)
 (require 'typst-ts-core)
 (require 'typst-ts-faces)
@@ -45,8 +46,6 @@
 (require 'typst-ts-lsp)
 (require 'typst-ts-misc-commands)
 (require 'typst-ts-transient)
-(require 'typst-ts-variables)
-
 
 ;; 
==============================================================================
 ;; TODO typst has three modes (namely 'markup', 'code' and 'math')
@@ -479,15 +478,29 @@ This function is meant to be used when user hits a return 
key."
     (if (re-search-backward typst-ts-outline-regexp nil t)
         (- (match-end 1) (match-beginning 1))
       0)))
+
 (defvar-keymap typst-ts-mode-map
-  ;; don't bind <return>
-  ;; Binding a command to "<return>" is generally a bug.
-  ;; Emacs will first look for a binding for `return` and if it finds one
-  ;; it'll use it in preference to a binding for `RET`, regardless of the
-  ;; relative precedence of the keymaps involved.
   "TAB" #'typst-ts-editing-cycle
   "RET" #'typst-ts-editing-return
-  "C-c '" #'typst-ts-edit-indirect)
+  "C-c '" #'typst-ts-edit-indirect
+
+  ;; DWIM
+  "M-<up>" #'typst-ts-editing-meta-up
+  "M-<down>" #'typst-ts-editing-meta-down
+  "M-<left>" #'typst-ts-editing-meta-left
+  "M-<right>" #'typst-ts-editing-meta-right
+
+  ;; List editing
+  "M-<return>" #'typst-ts-editing-meta-return
+
+  ;; Compile commands
+  "C-c C-c" #'typst-ts-compile
+  "C-c C-S-C" #'typst-ts-compile-and-preview
+  "C-c C-p" #'typst-ts-preview
+  "C-c C-w" #'typst-ts-watch-mode
+
+  ;; Other commands
+  "C-c C-o" #'typst-ts-mc-open-at-point)
 
 (easy-menu-define typst-ts-mode-menu typst-ts-mode-map
   "Menu for `typst-ts-mode'."
@@ -648,6 +661,7 @@ typst tree sitter grammar (at least %s)!" 
(current-time-string min-time))
   :group 'typst
   :syntax-table typst-ts-syntax-table
   :after-hook
+
   (typst-ts-after-hook-function)
 
   (unless (treesit-ready-p 'typst)

Reply via email to