diff options
Diffstat (limited to 'vim/ftplugin/html.vim')
-rw-r--r-- | vim/ftplugin/html.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim index b4eb9e6b..7400326c 100644 --- a/vim/ftplugin/html.vim +++ b/vim/ftplugin/html.vim @@ -6,9 +6,17 @@ nnoremap <LocalLeader>v :exe :<C-U>call <SID>HTMLTidy()<CR> " Make a bare URL into a link to itself function! s:UrlLink() + + " Yank this whole whitespace-separated word normal! yiW - execute 'normal! i<a href="<C-R>0><Esc>' + " Open a link tag + normal! i<a href=""> + " Paste the URL into the quotes + normal! hP + " Move to the end of the link text URL normal! E - execute 'normal! a</a>\<Esc>' + " Close the link tag + normal! a</a> + endfunction nnoremap <silent> <LocalLeader>r :<C-U>call <SID>UrlLink()<CR> |