How to effectively work with multiple files in Vim

前端 未结 28 2659
甜味超标
甜味超标 2020-11-28 00:18

I\'ve started using Vim to develop Perl scripts and am starting to find it very powerful.

One thing I like is to be able to open multiple files at once with:

<
28条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 00:43

    I think you may be using the wrong command for looking at the list of files that you have open.

    Try doing an :ls to see the list of files that you have open and you'll see:

       1 %a   "./checkin.pl"            line 1
      2 #    "./grabakamailogs.pl"     line 1
      3      "./grabwmlogs.pl"         line 0
      etc.
    

    You can then bounce through the files by referring to them by the numbers listed, e.g. :3b

    or you can split your screen by entering the number but using sb instead of just b.

    As an aside % refers to the file currently visible and # refers to the alternate file.

    You can easily toggle between these two files by pressing Ctrl Shift 6

    Edit: like :ls you can use :reg to see the current contents of your registers including the 0-9 registers that contain what you've deleted. This is especially useful if you want to reuse some text that you've previously deleted.

提交回复
热议问题