你更喜欢如何在 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屋!