8

使用Org Link abbreviations简化类似连接的输入

 3 years ago
source link: https://www.lujun9972.win/blog/2019/06/23/%E4%BD%BF%E7%94%A8org-link-abbreviations%E7%AE%80%E5%8C%96%E7%B1%BB%E4%BC%BC%E8%BF%9E%E6%8E%A5%E7%9A%84%E8%BE%93%E5%85%A5/index.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

使用Org Link abbreviations简化类似连接的输入

有的时候我们会想在一篇文章中输入几条很类似的连接,不同的地方可能仅仅只是某个关键字不同而已。这种情况下我们可以用 Org 的 Link abbreviations 功能来简化输入。

比如我们想插入两条连接,一个bing搜索emacs,一个bing搜索org-mode,那么可以这样写

其中 link 模板中的 %s 是占位符,会被替换成连接的tag(即 bing: 后面的 emacs , org-mode ,和 你好). 除了 %s 以外,还有其他的占位符包括:

%h经过url编码过的tag,不过现在主流的浏览器都支持自动编码,所以这个意义不大 %(function)执行 (function tag),并将函数的执行结果作为要访问的连接 不带任何占位符这种情况 org-mode 会直接把tag添加到link模板的后面,因此上面那个例子可以直接简写成 http://www.bing.com/search?q=

若某类常用的链接在多个文章中都会用到,那么可以设置 org-link-abbrev-alist 的值

(setq org-link-abbrev-alist
      '(("bing" . "https://www.bing.com/search?q=%s")))

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK