当使用许多文件时,如何组织Vim缓冲区,窗口和选项卡 [英] Howto organize Vim buffers, windows and tabs when working with many files

查看:135
本文介绍了当使用许多文件时,如何组织Vim缓冲区,窗口和选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VIM整个我的生活,但最近我有点累了,因为我在缓冲区,窗口和标签中丢失,同时与20个文件等在一个大项目(与500k LOC和数百文件) 。



每当我做:make :grep ,等等,新的缓冲区在当前窗口中跳出。
对于标签也是如此。在某些时候,这开始很混乱,因为我真的需要集中在一个VIM中的东西。



什么是被证明的和容易的方法来控制这种行为? / p>

解决方案


  • 使用:hide


  • 我不知道为什么标签会创建一个新窗口


  • nnoremap + 4< C-W> + nnoremap - 4< C-W> - 标准< C-W> _ < C-W> | 。 >

  • 获取一个22英寸显示器(最小),并使用:vsplit 并排显示文件


  • 使用< C-W> L ,<$ c $不要忘记:tab sp 打开当前文件(或a)


  • :map< LEFT> < C-W> h :map< RIGHT> < C-W> l 等使得在窗口之间移动变得更容易。 :map< C-LEFT> :tabprev< CR> :map< C-RIGHT> :tabnext< CR> 使在标签之间移动更容易。




,如果你需要有20个文件定期打开,这可能是一个迹象,你的代码组织不好。如果可能,功能应包含在单个文件中,那么您只需要一次集中在一个功能的工作。


I used VIM whole my life but recently I am a bit tired of it because I am lost in buffers, windows, and tabs when working simultaneously with 20 files or so in a big project (with 500k LOC, and hundreds files).

Whenever i do :make, :grep, etc, new buffers are jumping out in the current window. The same happens for the tags. At some point this starts to be very confusing because I really have to focus where things are in a VIM.

What are a proven and easy ways to control this behavior?

解决方案

  • Use :hide to get rid of all windows unless you really need them open.

  • I'm not sure why tags are creating a new window for you, CTRL+] should re-use the current window.

  • nnoremap + 4<C-W>+ and nnoremap - 4<C-W>- make it much easier to resize windows, along with the standard <C-W>_ and <C-W>|.

  • Get a 22" monitor (minimum) and use :vsplit to show files side by side. I find this is even more important than having two smaller monitors.

  • Use <C-W>L, <C-W>H etc to move windows around. Don't forget :tab sp to open the current file (or a new one) in a new tab.

  • :map <LEFT> <C-W>h and :map <RIGHT> <C-W>l, etc make it much easier to move between windows. :map <C-LEFT> :tabprev<CR> and :map <C-RIGHT> :tabnext<CR> make it much easier to move between tabs.

And finally, if you need to have 20 files open regularly, this could be a sign that your code is poorly organized. If possible, features should be contained within a single file, then you just need to focus work on one feature at a time.

这篇关于当使用许多文件时,如何组织Vim缓冲区,窗口和选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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