Monday, January 13, 2025
HomeProgrammingHow do I get the full path of the current file's directory?

How do I get the full path of the current file’s directory?

In Vim, to get the full path of the current file’s directory, you can use the following command:

Command:

:echo expand(‘%:p:h’)

Explanation:

expand(‘%:p:h’):

% refers to the current file.

:p gives the full path of the file.

See also  Deadlock in Java

:h gets the directory part of that full path (removes the filename).

This command will display the full directory path of the file currently open in Vim.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x