If you define a mapping based on filetype, you should use noremap <buffer> ...
; otherwise, it will be defined globally, and also be available in non-HTML buffers afterwards.
The mapping itself looks correct; verify that the filetype is indeed properly detected; :setl ft?
should yield html
.
Instead of the autocmd, I'd rather use Vim's abstractions and put the file in ~/.vim/after/ftplugin/html.vim
. This will then also define the mapping for HTML-derived filetypes (like e.g. htmldjango
, which source the filetype settings). But that's a matter of preference.
Note that there are plugins that can do this (in a more robust and more general way), e.g. shell for the current buffer and openbrowser for arbitrary URLs.