18.01.2020 Views

Working with Linux

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

When Vim splits the screen, it opens the same file in the other pane; to open another file just hit :e.

The good thing here is that we have autocomplete, so we can just hit Tab and Vim will start writing

filenames for us. If we don't know what files we want to choose, we can just run any arbitrary shell

command directly from Vim and come back once we've finished. For example, when we type :!ls,

the shell opens, shows us the output of the command, and waits until we hit Enter to come back to the

file.

When in split mode, press Ctrl + W to switch between windows. To close a window, press :q. If you

want to save a file under a different name (think of the save as command from other editors), just hit

:w followed by the new file name, say mycopy.txt.

Vim also has the option of opening multiple files at once; just specify a list of files after the vim

command:

vim file1 file2 file3

After the files are open, use :bn to move to the next file. To close all the files, hit :qa.

Vim also has an built in explorer. Just open Vim and hit :Explore. After this, we can navigate through

the directory layout and we can open new files:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!