您如何在Vim中的缓冲区之间切换? [英] How do you prefer to switch between buffers in Vim?
问题描述
我已经尝试过 MiniBufExplorer ,但是我通常以显示或完全关闭几个窗口。我想要的是带有增量式搜索的 LustyJuggler 我在Emacs中的缓冲区之间切换。当然有这样的脚本吗?
I've tried MiniBufExplorer, but I usually end up with several windows showing it or close it altogether. What I'd like is something like LustyJuggler with incremental search, the way I switch between buffers in Emacs. Surely there is a script like this?
推荐答案
我一直在使用Wincent Colaiuta的 Command-T vim插件已有几个月了。 Wincent编写了需要在C中快速运行的部分,我必须说是!而且,我认为它的文件模式匹配逻辑甚至比Textmate的Command-T更好。查看截屏。
I have been using Wincent Colaiuta's Command-T vim plugin for a couple months now. Wincent wrote the parts of it that need to be fast in C, and I must say that it is! And, I think its file pattern matching logic is even better than Textmate's Command-T. Check out the screencast.
用于VIM的Command-T插件为
提供了一种非常快速,直观的机制
用于打开击键次数最少
的文件。之所以将其命名为
Command-T,是因为它受到
的启发,该文本是绑定到TextMate中
Command-T的转到文件窗口。
The Command-T plug-in for VIM provides an extremely fast, intuitive mechanism for opening files with a minimal number of keystrokes. It's named "Command-T" because it is inspired by the "Go to File" window bound to Command-T in TextMate.
通过键入出现在其路径中的
字符
来选择文件,并通过一种算法排序,该算法使
知道出现在
某些位置的字符(例如,在路径分隔符之后紧接
)
应该有更大的权重。
Files are selected by typing characters that appear in their paths, and are ordered by an algorithm which knows that characters that appear in certain locations (for example, immediately after a path separator) should be given more weight.
更轻松的缓冲区切换包含许多有用的技巧。我已经对.vimrc进行了以下修改,该文件执行缓冲区名称自动补全功能,将最有用的缓冲区切换命令映射到我的< Leader>中。和左侧的主行键,并在状态行中显示当前的缓冲区编号:
Easier buffer switching contains many useful tips. I have adapted the following to my .vimrc, which does buffer-name auto-completion, maps the most useful buffer-switching commands to my <Leader> and left-side home row keys, and shows the current buffer number in the status line:
"" Tab triggers buffer-name auto-completion
set wildchar=<Tab> wildmenu wildmode=full
let mapleader = ","
map <Leader>t :CommandT<Return>
map <Leader>a :bprev<Return>
map <Leader>s :bnext<Return>
map <Leader>d :bd<Return>
map <Leader>f :b
"" Show the buffer number in the status line.
set laststatus=2 statusline=%02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
我还使用 MiniBufExplorer ,它在其自己的水平拆分顶部中提供了每个列出的缓冲区的紧凑列表。
I also use MiniBufExplorer, which provides a compact listing of each listed buffer in its own horizontal split up top.
这篇关于您如何在Vim中的缓冲区之间切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!