重新分配vim缓冲区号
我有这样的 vim 缓冲区:
1 "file1.txt"
2 "file2.txt"
3 "file3.txt"
我想重新分配这样的缓冲区编号:
1 "file2.txt"
2 "file1.txt"
3 "file3.txt"
我该怎么做?
I have vim buffers like this:
1 "file1.txt"
2 "file2.txt"
3 "file3.txt"
and I want re-assign buffer numbers like this:
1 "file2.txt"
2 "file1.txt"
3 "file3.txt"
How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自
:help :ls
:为什么需要重新分配这些号码?也许还有其他事情可以帮助您完成任务?
From
:help :ls
:Why do you need to reassign those numbers? Maybe there is another thing to do to help you in your task?
虽然您确实无法从技术上重新分配缓冲区编号,但有一个插件可以让您像您一样操作:
https://github.com/gelus/vim-buffer-enhancement
它允许您通过点击将缓冲区映射到数字;
然后以与切换到常规缓冲区相同的方式返回到映射缓冲区
因此,对于您的示例:
1
2
file3 已位于缓冲区 3 ,(如果需要,您可以映射它,但它会工作相同)
现在点击 < code>1将带您前往 file2.txt,
2
将带您前往 file1.txt,3将带您前往 file1.txt。
仍会将您带到 file3.txt,
While it is true that you can't technically re-assign buffer numbers there is this plugin that allows you to act like you can:
https://github.com/gelus/vim-buffer-enhancement
it allows you to map buffers to numbers by hitting
<count><leader><C-6>
Then returning to the mapped buffers in the same way you switch to a regular buffer
<count><C-6>
so for your example:
1<leader><C-6>
2<leader><C-6>
file3 is already at buffer 3, ( you can map it if you want, but it would work the same )
now hitting
1<C-6>
will take you to file2.txt,2<C-6>
will take you to file1.txt and3<C-6>
will still take you to file3.txt