如何标记Emacs中括号之间的文字? [英] How to mark the text between the parentheses in Emacs?

查看:149
本文介绍了如何标记Emacs中括号之间的文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何这样的函数或elisp脚本?我想要vim中的vi序列的等效功能。

解决方案

尝试按键序列 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆