grigoryvp
grigoryvp

Reputation: 42613

Vim: how to convert file name to path?

In Vim script, if I have a file name, how to get it's path? For example, I want to get a path of the temp directory Vim uses. I can get a name of temp file by calling tempname(). But how to extract path from name returned?

Upvotes: 4

Views: 371

Answers (1)

Rüdiger Hanke
Rüdiger Hanke

Reputation: 6255

To remove the last path component:

fnamemodify(tempname(), ":h")

Upvotes: 6

Related Questions