How to effectively work with multiple files in Vim

前端 未结 28 2741
甜味超标
甜味超标 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:35

    :ls
    

    for list of open buffers

    • :bp previous buffer
    • :bn next buffer
    • :bn (n a number) move to n'th buffer
    • :b with tab-key providing auto-completion (awesome !!)

    In some versions of vim, bn and bp are actually bnext and bprevious respectively. Tab auto-complete is helpful in this case.

    Or when you are in normal mode, use ^ to switch to the last file you were working on.

    Plus, you can save sessions of vim

    :mksession! ~/today.ses
    

    The above command saves the current open file buffers and settings to ~/today.ses. You can load that session by using

    vim -S ~/today.ses
    

    No hassle remembering where you left off yesterday. ;)

提交回复
热议问题