How vim switches among multiple files

Source: Internet
Author: User
Tags switches

If we open more than one file at a time

Look at the files in the current directory:

[Email protected]/data/webroot/testroot/application/modules/admin/Views $ lltotal -drwxr-xr-x2Wangkongming wangkongming4096July -  -: the. DRWXR-xr-x4Wangkongming wangkongming4096JuneTen  -: - ..-rw-r--r--1Wangkongming wangkongming515July -  -: Aadd.html-rw-r--r--1Wangkongming wangkongming646July6  -: theedit.html-rw-r--r--1Wangkongming wangkongming $JuneTen  the: $footer.html-rw-r--r--1Wangkongming wangkongming211July2  -: Aboutheader.html-rw-r--r--1Wangkongming wangkongming909July2  +: -Index.html

To open multiple files:

VI *.html

The commands you can manipulate are as follows:

: N edits the next document.
: 2n edit the next two documents.
: N edits the previous document. Note that this method can only be used to open multiple documents at the same time.
: E document name This is the case when you enter vim and open other documents without leaving Vim. Put the file in the buffer.
: e# or ctrl+ˆ edits the previous document for use when two documents are exchanged for editing.? # is for editing the previous edit of the document "This more commonly used"
: Files or: buffers or: LS to list all documents in the current buffer. The Plus + indicates that the buffer has been modified. # represents the last edited document,% is currently being edited in the document
: b The document name or number is moved to the document.

For example,: B 2, jump to the second file

If you want to open a cache file as a list, you need to use a plugin.

The recommended plugins are: Bufexplorer

The GitHub address is: https://github.com/jlanzarotta/bufexplorer

There are several files in the file:

Doc  LICENSE  plugin  readme.md

Put the Bufexplorer.vim file in the plugin directory in the. vim/plugin/directory under your home directory

Place the Bufexplorer.txt file under the Doc directory in the. vim/doc/directory in your home directory

Add the following code to the. vimrc file under Home

"""""""""""""""""""""""""""""" F6 Bufexplorer """""""""""""""""""""""""""""""

When configured, open a file, or multiple files

By pressing F6, you can see this interface.

"Press <F1> for help"Sorted by MRU | Locate Buffer | One Tab/buffer | Absolute Split Path"=   3%a Index.php/data/webroot/testroot/application/controllers First -Line5# product.php/data/webroot/testroot/application/controllers1Line1Article.php/data/webroot/testroot/application/controllers First theLine6Test.php/data/webroot/testroot/application/controllers First1Line4H Leaveword.php/data/webroot/testroot/application/controllers First3Line2H Error.php/data/webroot/testroot/application/controllers First1Yes

Where%a represents the currently edited file

#表示上一个编辑的文件

H means you've opened this file.

This is convenient to switch in the file.

How vim switches among multiple files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.