Use :execute
, where you can use the Javascript API:
:map ,m :execute '!echo ' + buffer.URL + ' | mail -s "Subject" mail@example.com'
Or use a javascript mapping, like:
javascript <<EOF function MyFoo() { alert(buffer.URL.host); } EOF map <Leader>f -js MyFoo();
See https://github.com/blueyed/dotfiles/blob/master/pentadactylrc#L212 for a more sophisticated function to setup the editor based on host names.