Open an Existing File from Vim

Open an Existing File from Vim

I would like to open a file that already exists while already in Vim.

What is the command to do this?

1

2 Answers

vim [your file]

If this isn't working for you, make sure you have it installed with:

sudo apt-get install vim

If you're already IN vim do

:edit [your file]

Additionally, to move back to the previous file after you finish editing the new file you can use

:e#

This will return you to the previous file

9

You can also use tabs and split views:

:tabe /path/to/file

Effect:

:vs /path/to/file

(or :sp for a horizontal split)
Effect:

Use :tabn, :tabp to navigate between tabs, and CtrlW with the arrow keys to navigate between splits.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.