From f7a8430cefe8e9865d6a99052158eef436103905 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 3 Jan 2020 03:38:46 +1300 Subject: Rename and move HTML URL anchoring --- vim/after/ftplugin/html.vim | 2 +- vim/autoload/html.vim | 16 ---------------- vim/autoload/html/url.vim | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 vim/autoload/html/url.vim 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 r - \ :call html#UrlLink() + \ :call html#url#Anchor() let b:undo_ftplugin .= '|nunmap 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 - " 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 - -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 + " 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 + +endfunction -- cgit v1.2.3