技术控

    今日:115| 主题:49390
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Electric Pair Mode In Emacs

[复制链接]
清陌影 发表于 2016-10-3 10:38:17
63 0

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
So far I’ve used    TextExpanderfor text snippets and, well, text expansion. One of my main uses-cases is character pairings. For example, when I type    "I almost always enclose it with another    ".  
  But TextExpander is lacking in several ways:
  
       
  • Performance – it takes a friction of a second for the expansion to happen, but it’s notable, and feels like a little hang.   
  • If I delete one part of the pair, it won’t remove the other.   
  • It won’t work to wrap text. If I typed something, and then want to wrap it with brackets, for example, I can’t select the text and type the bracket character.  
  In addition to the above technical shortcomings, I don’t plan to keep using TextExpander in the long run. The recent    move into subscription basedpricing, isn’t something I’m interested in. I mean, paying subscription to text snippets…?  
  Anyway, Emacs comes with an electric-pair-mode, which enables smart pairing. I turned it on, but out of the box it’s configured to work mainly with programming major modes. I need it also in other text based modes, such as org, markdown and simple text. For example, in org I use    ~for inline code snippets, and    ~isn’t paired by default. Same goes with    ".  
  Luckily, defining more pairs is easy, through modifying the electric-pair-pairs variable.
  Here’s my configuration for this mode:
  1. (electric-pair-mode 1)
  2. (setq electric-pair-pairs '(
  3.                             (?" . ?")
  4.                             (?\` . ?\`)
  5.                             (?\( . ?\))
  6.                             (?\{ . ?\})
  7.                             ) )
复制代码
I’ll add more pairs as I encounter them. Also, I’ll need to learn how to add pairs for specific major modes.
友荐云推荐




上一篇:利用Emmet快速编写HTML标签
下一篇:数学中的极限思想求时间复杂度
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表