How to effectively work with multiple files in Vim

前端 未结 28 2740
甜味超标
甜味超标 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条回答
  •  萌比男神i
    2020-11-28 00:42

    I made a very simple video showing the workflow that I use. Basically I use the Ctrl-P Vim plugin, and I mapped the buffer navigation to the Enter key.

    In this way I can press Enter in normal mode, look at the list of open files (that shows up in a small new window at the bottom of the screen), select the file I want to edit and press Enter again. To quickly search through multiple open files, just type part of the file name, select the file and press Enter.

    I don't have many files open in the video, but it becomes incredibly helpful when you start having a lot of them.

    Since the plugin sorts the buffers using a MRU ordering, you can just press Enter twice and jump to the most recent file you were editing.

    After the plugin is installed, the only configuration you need is:

    nmap  :CtrlPBuffer
    

    Of course you can map it to a different key, but I find the mapping to enter to be very handy.

提交回复
热议问题