Tip41: Open a File by Its Filepath Using :edit

January 12, 2021 ยท View on GitHub

:edit

open files by an absolute or a relative filepath.

Open a File Relative to the Current Working Directory

:pwd

print working directory.

:edit relative/path/file.ext

tab: autocomplete filepath.

Open a File Relative to the Active File Directory

:edit %<Tab>

%: shorthand for the filepath of the active buffer. Tab: expand the filepath.

:edit %:h<Tab>

:h : remove the filename while preserving the rest of the path.

Note: a mapping: tip41

Tip40 Tip42