paths to folders & files

you're in vim, you're lazy, you don't want to type the name of the file you're in1

:echo @%    def/my.txt  directory/name of file (relative to the current working directory of /abc)
:echo expand('%:t')     my.txt  name of file ('tail')
:echo expand('%:p')     /abc/def/my.txt full path
:echo expand('%:p:h')   /abc/def    directory containing file ('head')
:echo expand('%:p:h:t') def First get the full path with :p (/abc/def/my.txt), then get the head of that with :h (/abc/def), then get the tail of that with :t (def)
:echo expand('%:r')     def/my  name of file less one extension ('root')
:echo expand('%:e')     txt name of file's extension ('extension')


in ranger there's a way to yank path yp but it's broke for me, going to research this later, it's a system clipboard confusing thing I fixed once before...