Reputation: 42613
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
Reputation: 6255
To remove the last path component:
fnamemodify(tempname(), ":h")
Upvotes: 6