在 emacs 中重构一个大文件
我正在 Emacs 的一个文件中重构一大段代码。
在大型 emacs 缓冲区中简化跳转到多个位置的最佳方法是什么? 目前我正在使用搜索(CS)和自定义注释 - “标记”。 这很快就会变得不可靠。
理想情况下,我希望在多个缓冲区中打开同一个文件,这样我就可以使用 CX B 在它们之间进行切换。
你们的解决方案是什么?
I'm refactoring a big piece of code in one file in Emacs.
What is the best way to simplify jumping to several places in a big emacs buffer?
Currently I'm using search (C-S) and custom comments - "markers".
This becoming quiclkly unreliable.
Ideally I would like to have the same file open in several buffers, so I can switch between them using C-X B.
What are your solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
看来您正在寻找的是间接-缓冲区。
就我个人而言,我发现拆分窗口 (
Cx 2
) 很有帮助。此外书签浮现在脑海中。
It seems that what you are looking for is Indirect-Buffers.
Personally, I find that splitting my window (
C-x 2
) is a great help.Also bookmarks come to mind.
请参阅 Emacs 书签。
转到特定书签会自动切换到正确的缓冲区(书签与缓冲区关联)。
See Emacs Bookmarks.
Going to a particular bookmark switches to the correct buffer automatically (a bookmark is associated to a buffer).
寄存器对于标记和跳转到位置很有用。如果您在任何时候只有少量的点需要标记和记住,那么使用单字符寄存器可能比命名书签更快。
点到寄存器
jump-to-register
当提示注册时,您可以键入任何字符。
Registers are useful for marking and jumping to positions. If you only have a small number of spots to mark and remember at any time, it may be faster to use single-character registers than named bookmarks.
point-to-register
jump-to-register
When prompted for the register, you can type any character.
使用自动命名书签。每次创建书签时无需指定名称——只需按一个键即可。与使用 C-SPC 设置标记类似,但书签(默认情况下)是持久的;标记不是。
使用 Bookmark+ 您还可以组织书签(包括自动命名书签)到集合等中。例如,以各种方式标记它们。
Use autonamed bookmarks. No need to specify a name each time you create a bookmark -- just hit a key. Like using C-SPC to set a mark, but bookmarks are (by default) persistent; marks are not.
With Bookmark+ you can also organize bookmarks (including autonamed bookmarks) into sets etc. Tag them in various ways, for instance.
视觉书签对于这种情况非常有用。您可以从这里获取它,或者使用安装它
并将其添加到您的配置中。
现在,在文件中的任何位置按
f5
即可在此处创建一个标记。如果您想删除它,只需再次按f5
即可。您可以创建任意数量的标记,现在使用
f6
&f7
您可以快速转到您想要的任何点。Visual bookmarks is extremely useful for this case. You can get it from here or install it using
and add this to your config.
Now, any where in your file press
f5
and it creates a mark there. If you want to remove it, just pressf5
again.You can create any number of markers and now using
f6
&f7
you can quickly go to any point you want.