是否有组合键可以使用 AUCTeX 通过参数来前后移动插入点?例如,其中“|”是我的插入点:
\frac{|}{}
然后我想要一个命令来移动它:
\frac{}{|}
也许还有另一个命令可以将其移回:
\frac{|}{}
另一个方法是将其移出:
\frac{}{}|
答案1
要在空组之间移动,我使用这些功能(当然可以改进):
(defun mg-TeX-forward-group ()
"Move to the next empty group."
(interactive)
(let ((group (save-excursion (search-forward-regexp "{[^}]*}" nil t))))
(when group
(set-mark (point))
(deactivate-mark)
(goto-char group)
(backward-char 1))))
(eval-after-load "tex"
'(define-key TeX-mode-map [M-right] 'mg-TeX-forward-group))
(defun mg-TeX-backward-group ()
"Move to the previous empty group."
(interactive)
(let ((group (save-excursion (search-backward-regexp "{[^}]*}" nil t))))
(when group
(set-mark (point))
(deactivate-mark)
(goto-char group)
(forward-char 1))))
(eval-after-load "tex"
'(define-key TeX-mode-map [M-left] 'mg-TeX-backward-group))