Vim:导航到编辑历史记录中的上一个和下一个缓冲区 [英] Vim: Navigating to Previous and Next Buffers in Edit History

查看:18
本文介绍了Vim:导航到编辑历史记录中的上一个和下一个缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我编辑多个文件时,我经常想在最后编辑的文件之间来回切换.我知道 :bn(ext):bp(revious) 在缓冲区之间切换,但它们不保留上次使用文件的历史记录.相反,它们使用文件打开的顺序.例如,如果我按此顺序打开文件

When I edit multiple files I oftentimes want to go back and forth between the last edited files. I know about :bn(ext) and :bp(revious) to switch between buffers but they don't keep the history of the last used files. Instead they use the order in which the files were opened. E.g., if I opened the files in this order

A, B, C

我的导航历史是

A, B, C, B

然后 :bprevious 在最后一个缓冲区 (B) 中会将我发送到 A.是否有命令或插件可以将我发送到 C?我知道 Ctrl-6,但这仅在最后两个缓冲区之间切换.我想来回多个缓冲区.

then :bprevious in the last buffer (B) would send me to A. Is there a command or plugin that would send me to C? I know of Ctrl-6, but this only switches between the last two buffers. I would like to go back and forth multiple buffers.

推荐答案

我也一直想要相同的功能已经有一段时间了.你的问题激励我最终为此做点什么.看看 bufsurf,这是一个提供所需功能的小插件.它为用户提供了两个命令:

I have been wanting the same functionality for quite some time now as well. Your question inspired me to finally do something about it. Have a look at bufsurf, a small plugin that provides the required functionality. It provides the user with two commands:

:BufSurfBack 

在历史中向后导航,类似地:

to navigate backwards in history, and similarly:

:BufSurfForward

在历史中向前导航.对于每个窗口或选项卡,单独的导航历史记录保存在内存中.如果您遇到任何问题,请告诉我,我还没有机会对此进行广泛的测试.

to navigate forwards in history. For each window or tab a separate navigation history is kept in memory. Please let me know if you experience any problems, I did not have the chance to test this extensively yet.

这篇关于Vim:导航到编辑历史记录中的上一个和下一个缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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