您的位置:首页 > 其它

Emacs中的前进后退jump-tree

2017-08-12 20:35 197 查看
.title { text-align: center }
.todo { font-family: monospace; color: red }
.done { color: green }
.tag { background-color: #eee; font-family: monospace; padding: 2px; font-size: 80%; font-weight: normal }
.timestamp { color: #bebebe }
.timestamp-kwd { color: #5f9ea0 }
.right { margin-left: auto; margin-right: 0px; text-align: right }
.left { margin-left: 0px; margin-right: auto; text-align: left }
.center { margin-left: auto; margin-right: auto; text-align: center }
.underline { text-decoration: underline }
#postamble p,#preamble p { font-size: 90%; margin: .2em }
p.verse { margin-left: 3% }
pre { border: 1px solid #ccc; padding: 8pt; font-family: monospace; overflow: auto; margin: 1.2em }
pre.src { position: relative; overflow: visible; padding-top: 1.2em }
pre.src::before { display: none; position: absolute; background-color: white; top: -10px; right: 10px; padding: 3px; border: 1px solid black }
pre.src:hover::before { display: inline }
pre.src-sh::before { content: "sh" }
pre.src-bash::before { content: "sh" }
pre.src-emacs-lisp::before { content: "Emacs Lisp" }
pre.src-R::before { content: "R" }
pre.src-perl::before { content: "Perl" }
pre.src-java::before { content: "Java" }
pre.src-sql::before { content: "SQL" }
table { border-collapse: collapse }
caption.t-above { caption-side: top }
caption.t-bottom { caption-side: bottom }
td,th { vertical-align: top }
th.right { text-align: center }
th.left { text-align: center }
th.center { text-align: center }
td.right { text-align: right }
td.left { text-align: left }
td.center { text-align: center }
dt { font-weight: bold }
.footpara:nth-child(0n+2) { display: inline }
.footpara { display: block }
.footdef { margin-bottom: 1em }
.figure { padding: 1em }
.figure p { text-align: center }
.inlinetask { padding: 10px; border: 2px solid gray; margin: 10px; background: #ffffcc }
#org-div-home-and-up { text-align: right; font-size: 70%; white-space: nowrap }
textarea { }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00 }
.org-info-js_info-navigation { border-style: none }
#org-info-js_console-label { font-size: 10px; font-weight: bold; white-space: nowrap }
.org-info-js_search-highlight { background-color: #ffff00; color: #000000; font-weight: bold }
code { color: #FF0000 }
pre.src { background-color: #002b36; color: #839496 }

Emacs中的前进后退jump-tree

Table of Contents

1. 效果

2. 为什么开发这个插件?

3. 特点

3.1. 包含jump-list的所有功能

3.2. 具有undo-tree的树形结构记录

3.3. 增加命令移动的距离超过给定值时自动记录位置的功能

3.4. 增加切换buffer或者文件时自动记录位置的功能

4. 安装

1 效果

可以自由的跳转到不同的定义和文件中去,然后,再跳转回来。



2 为什么开发这个插件?

本人在使用Emacs的过程中,长期由于缺乏一个类似于Vim的前进和后退的功能而苦恼。搜索了各种jump的实现方式,都总感觉欠缺了点什么。

直到发现jump-list,但是jump-list有时不太清楚到底发生了什么,特别是在阅读别人的代码的时候,经常要跳转到定义的地方去,然后,跳回来,继续往下读,然后再跳到新的定义里面去。但有时候,又想跳到刚刚的定义里面去。这时,由于跳回来之后后面的记录把前面的记录会抹掉,所以,肯定是到不了前面那个定义中去的。

由于,经常使用undo-tree来做一些后退和恢复的操作,发现它的树形记录,可以记录所有的操作历史。任意的状态,总是可以后退回去的。这个在进行反复操作的时候,非常有用。如果发现有什么地方不对,马上打开可视化的界面,进行后退,如果有分支的话,可以进入分支进行查看。于是,想能不能把这两个结合起来。然后,就开发了这个jump-tree插件。

3 特点

3.1 包含jump-list的所有功能

可以根据设定的command列表,只要这些命令执行时,就记录一个位置点,用于后退和前进。

3.2 具有undo-tree的树形结构记录

采用树结构可以用来保存所有的历史位置。我们可以跳转到所有之前记录的位置。

3.3 增加命令移动的距离超过给定值时自动记录位置的功能

当命令移动的距离超过设定值时,记录一个位置点用于后退。比如,翻页,跳转到函数头、函数尾等。这些也可以使用前面的命令列表来实现,默认,命令列表的优先级比这个要高一些。当没有设置命令列表时,只要移动距离比较大,也可以马上退回到之前的位置。

3.4 增加切换buffer或者文件时自动记录位置的功能

当我们的命令,会打开一个新的buffer或者文件时,会记录一个位置,可以跳转回去。

4 安装

可以使用package-list-packages进行安装

可以使用malpa进行安装:

melpa/jump-tree

也可以从github上直接下载安装:

yangwen0228/jump-tree

如果觉得好用也可以给项目点赞。^_^

Date: 2017-08-12 20:03

Author: WEN YANG

Created: 2017-08-12 Sat 20:35

Emacs 25.2.1 (Org mode 8.2.10)

Validate
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: