GVim
GVim - 如何处理多个文件(GVim - How to handle multiple files)对不起,问这样的新手问题,但我正在寻找一种方法来处理多个文件。 我不想输入巨大的文件路径来打开每个文件:tabnew和:e命令
Sorry to ask such a novice question but I am looking for a way to handle multiple files. I dont want to type huge file paths to open every file using :tabnew and :e commands
最满意答案通常, vim 支持这个缓冲区 。 使用:badd添加缓冲区, :bdelete删除它,并且:ls (或:buffers )列出所有打开的缓冲区。 我相信,GVim也支持这些功能。
例如,如果要编辑app/controllers/pages目录中的所有.rb文件(在Rails项目中),请在终端中键入vim app/controllers/pages/*.rb .rb ,然后编辑第一个文件(缓冲区)在vim窗口中。 完成所有更改后,按以下方式保存更改:w ( 注意:不要使用q!选项 - 这将关闭您打开的所有缓冲区),然后使用:bn<tab> (或完全:bnext )或者:bprevious切换到下一个文件(缓冲区)。 当你在最后一个缓冲区运行:bnext时,你将被放到第一个缓冲区。
Usually, vim supports buffers for that. Use :badd to add buffer, :bdelete to remove it and :ls (or :buffers) to list all opened buffers. I believe, GVim supports these features too.
For example, if you wanna edit all .rb files in your app/controllers/pages dir (in the case of Rails project), you type vim app/controllers/pages/*.rb in your terminal and then edit the first file (buffer) in the vim window. When you've done with all changes, save changes as usual with :w (note: do not use q! option - this will close all your buffers you've opened) and then use :bn<tab> (or fully, :bnext) or :bprevious to switch to the next file (buffer). When you run :bnext on the last buffer, you'll be dropped to the first one.