October 2015
Intermediate to advanced
356 pages
7h 54m
English
| Tip 42 | Open a File by Its Filepath Using ‘:edit’ |
The :edit command allows us to open files from within Vim, either by specifying an absolute or a relative filepath. We’ll also learn how to specify a path relative to the active buffer.
As a demonstration, we’ll use the files/mvc directory, which you can find in the source files that come distributed with this book. It contains the following directory tree:
| | app.js |
| | index.html |
| | app/ |
| | controllers/ |
| | Mailer.js |
| | Main.js |
| | Navigation.js |
| | models/ |
| | User.js |
| | views/ |
| | Home.js |
| | Main.js |
| | Settings.js |
| | lib/ |
| | framework.js |
| | theme.css |
In the shell, we’ll start by changing to the files/mvc directory and then launching Vim:
| => | $ cd code/files/mvc |
| => | $ vim index.html |