How to open another file in the vim-buffer

Source: Internet
Author: User

Now there is a situation:
I am now under the Ubuntu user root directory-~
I have a folder under the root directory blogs, this folder has two files: text1,text2.
I now do the following from the ~ directory
Vim ~/blogs/text1
Then, I want to open the Text1, using the command line opened the same directory of Text2, then the question is, how do you want to open it?
My previous practice was to use the command line and then use the e command. After use: /.. /blogs/text2 this to open. If the directory hierarchy is relatively small (as in this example), then
If we are at a more directory level, what do we do, or do we open it with a relative path?
VIM provides us with a way to feel useful.
Other methods are not changed, we can use the following method when we need to find the path of the file
: E%:h<tab>
%-represents the path of the currently open file relative to the cache working path + file name
The path to the cache work path, which is the path where you use VIM to open a file
: h This operation, is to remove the file name, only the path of the current file is left

How to open another file in the vim-buffer

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.