diff options
-rw-r--r-- | vim/after/ftplugin/html.vim | 2 | ||||
-rw-r--r-- | vim/autoload/html.vim | 16 | ||||
-rw-r--r-- | vim/autoload/html/url.vim | 15 |
3 files changed, 16 insertions, 17 deletions
diff --git a/vim/after/ftplugin/html.vim b/vim/after/ftplugin/html.vim index 7ffb63ac..7e2ba439 100644 --- a/vim/after/ftplugin/html.vim +++ b/vim/after/ftplugin/html.vim @@ -39,5 +39,5 @@ endif " Transform URLs to HTML anchors nnoremap <buffer> <LocalLeader>r - \ :<C-U>call html#UrlLink()<CR> + \ :<C-U>call html#url#Anchor()<CR> let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>r' diff --git a/vim/autoload/html.vim b/vim/autoload/html.vim index 83755fe6..c93c0b8e 100644 --- a/vim/autoload/html.vim +++ b/vim/autoload/html.vim @@ -1,19 +1,3 @@ -" Make a bare URL into a link to itself -function! html#UrlLink() abort - - " Yank this whole whitespace-separated word - normal! yiW - " 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 - " Close the link tag - normal! a</a> - -endfunction - " Tidy the whole buffer function! html#Tidy() abort let view = winsaveview() diff --git a/vim/autoload/html/url.vim b/vim/autoload/html/url.vim new file mode 100644 index 00000000..99b4409e --- /dev/null +++ b/vim/autoload/html/url.vim @@ -0,0 +1,15 @@ +" Make a bare URL into a link to itself +function! html#url#Anchor() abort + + " Yank this whole whitespace-separated word + normal! yiW + " 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 + " Close the link tag + normal! a</a> + +endfunction |