vim-NERDTree:订购书签?
有没有办法对我使用 NERDTree vim 插件看到的书签进行排序?
我觉得这应该很简单,但我不知道该怎么做。我用 vim 编辑了 ~/.NERDTreeBookmarks
并看到在该文件中,书签的顺序是正确的,但它似乎根据我使用书签的顺序不断地重新组织书签 - 这不是我想要什么。我还执行了 :ReadBookmarks
命令,但这似乎没有改变顺序。
Is there a way to order the bookmarks I see with the NERDTree vim plugin?
I feel like this should be simple, but I don't know how to do this. I vim'ed ~/.NERDTreeBookmarks
and saw that in that file, the bookmarks are in the right order, but it seems to continuously reorganize the bookmarks according to the order I use them -- which is not what I want. I also did :ReadBookmarks
command and that didn't seem to change order.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,并设法关闭 NERDTree 的古怪书签排序。打开
NERD_tree.vim
插件文件(通常是~/.vim/plugin/NERD_tree.vim
)。搜索这一行:该行应该有两个实例(在 NERDTree 版本 4.2.0 中,它们位于第 209 行和第 286 行)。通过在这两行前面添加
"
来注释掉这两行,如下所示:现在您可以编辑
~/.NERDTreeBookmarks
并且您的书签将以与中相同的顺序显示在 NERDTree 中编辑文件后,您可以使用:ReadBookmarks
刷新书签列表。I had the same problem, and managed to turn off NERDTree's wacky bookmark sorting. Open the
NERD_tree.vim
plugin file (usually~/.vim/plugin/NERD_tree.vim
). Search for this line:There should be two instances of the line (in NERDTree version 4.2.0 they're on lines 209 and 286). Comment out both lines by adding
"
in front of them like this:Now you can edit
~/.NERDTreeBookmarks
and your bookmarks will show up in NERDTree in the same order as in the file. You can use:ReadBookmarks
to refresh your bookmarks list after editing the file.作为对上面 alxm 优秀答案的更新,这些行已移至新文件中。在我的硬盘上,它位于
~/.vim/bundle/nerdtree/lib/nerdtree/bookmark.vim
(我使用 vundle)。在普通的 vim 安装中,它很可能位于~/.vim/plugin/nerdtree/lib/nerdtree/bookmark.vim
中。1. 编辑你的 bookmark.vim 文件
我注释掉了以
call sort...
开头的行(第 246 行),如下所示:2. 退出 vim
退出 vim 因为你想重新加载你的插件,特别是 NERDTree。
3. 编辑 ~/.NERDTreeBookmarks 文件。
按照您想要的顺序放置它们。NERDTree 现在尊重您的意愿。您庄严、衷心的书签整理愿望。
4. 再次启动 vim
当然每个人都已经知道这一点,但我认为这个答案需要第四步。
As an update to alxm's excellent answer above, the line(s) have been moved into a new file. On my hard drive it's in
~/.vim/bundle/nerdtree/lib/nerdtree/bookmark.vim
(I use vundle). In a vanilla vim installation it would most likely be in~/.vim/plugin/nerdtree/lib/nerdtree/bookmark.vim
.1. Edit your bookmark.vim file
I commented out the line that starts with
call sort...
(line 246), like this:2. Quit vim
Exit out of vim because you want to reload your plugins, specifically NERDTree.
3. Edit your ~/.NERDTreeBookmarks file.
Put them in the order you want them in. NERDTree now respects your wishes. Your solemn, heartfelt bookmark sorting wishes.
4. Fire up vim again
Of course everyone already knows this, but I thought this answer needed a fourth step.
不确定从什么时候开始,您现在可以设置 NERDTreeBookmarksSort 来代替。
然后根据需要编辑
~/.NERDTreeBookmarks
。检查
:help NERDTreeBookmarksSort
了解更多详细信息。Not sure since when though, you can now set
NERDTreeBookmarksSort
instead.Then edit
~/.NERDTreeBookmarks
as you want to order.Check
:help NERDTreeBookmarksSort
for more detail.