如何标记Emacs中括号之间的文字? [英] How to mark the text between the parentheses in Emacs?
问题描述
尝试按键序列 CMu CM-SPC < kbd>(即,在保持控件和元键的同时,按 u 和空格顺序),其中执行命令 backward-up-sexp
和 mark-sexp
。
编辑:
我犯了一个错误: backward-up-sexp
不存在于标准Emacs,我写的完全是因为lkahtz的评论中提到的问题,现在的函数 backward-up-list
将不会工作,当点在双引号之间。 p $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
语法-ppss)))
(cond((elt ppss 3)
(goto-char(elt ppss 8))
(backward-up-sexp(1- arg)))
((back-up-list arg)))))
(global-set-key [remap backward-up-list] 'back-up-sexp)
Any such function or elisp script? I want the equivalent function as vi" sequence in vim.
Try the key sequence C-M-u C-M-SPC (i.e., while holding the Control and Meta keys, press u and Space in sequence), which executes the commands backward-up-sexp
and mark-sexp
.
Edit:
I made a mistake: backward-up-sexp
doesn't exist in standard Emacs. I wrote it exactly because of the problem mentioned in lkahtz's comment, that the existing function backward-up-list
won't work when point is between double quotes.
(defun backward-up-sexp (arg) (interactive "p") (let ((ppss (syntax-ppss))) (cond ((elt ppss 3) (goto-char (elt ppss 8)) (backward-up-sexp (1- arg))) ((backward-up-list arg))))) (global-set-key [remap backward-up-list] 'backward-up-sexp)
这篇关于如何标记Emacs中括号之间的文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!