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.mdexpand('%:r')=docs/indexexpand('%:p')=/Users/dhruvthakur/projects/6006/docs/index.mdexpand('%:p:h')=/Users/dhruvthakur/projects/6006/docsexpand('%:h')=docsexpand('%:t:r')=indexexpand('%:e')=md
Use these from neovim's APIs as: vim.fn.expand('%:t')