People often use %:p:h to retrieve their current path in vim.

You can use :set acd to automatically perform this task. acd is shorthand for autochdir. With this option set, you will always be placed on the same path as your current file.

Commands such as :tabnew or :tabedit reveal that your path is no longer static, instead it inherits from your current file’s path.

For more information, run :help acd.

Comments