Vim expand¶
:h expand
Say the current directory is /Users/dhruvthakur/projects/6006
and path of the
file open is docs/index.md
expand('%:t')
=index.md
expand('%:r')
=docs/index
expand('%:p')
=/Users/dhruvthakur/projects/6006/docs/index.md
expand('%:p:h')
=/Users/dhruvthakur/projects/6006/docs
expand('%:h')
=docs
expand('%:t:r')
=index
expand('%:e')
=md
Use these from neovim's APIs as: vim.fn.expand('%:t')