Skip to content

Vim expand

:h expand

Say the full path of the current file is:

/Users/dht93/Projects/vim-expand.md
  • expand('%:t') = vim-expand.md
  • expand('%:r') = /Users/dht93/Projects/vim-expand
  • expand('%:p') = /Users/dht93/Projects/vim-expand.md
  • expand('%:t:r') = vim-expand
  • expand('%:e') = md

Use these from neovim's APIs as: vim.fn.expand('%:t')