Using
fnamemodify(getcwd(), ':t')
or
fnamemodify('.', ':p:h:t')
. :h in the second case is necessary because :p emits a trailing path separator (thus, the last component of the path selected by :t is now an empty string).
To move this to your mapping use
:noremap \rr :!<Cr>=shellescape(fnamemodify('.', ':p:h:t'), 1)<CR><CR>
. For a description of why you should never use :map , see here .
Zyx
source share