function! WhereAmI(fmt) let fullpath = substitute(expand("%:p"), "/usr/home/", "/home/", "") if a:fmt == "gnu" let where = fullpath . ":" . line(".") elseif a:fmt == "lldb" let where = "breakpoint set --file " . fullpath . " --line " . line(".") else let where = "unknown fmt" endif let @* = where echomsg where endfunction nmap w :call WhereAmI("gnu") nmap W :call WhereAmI("lldb")