diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-01-03 03:38:46 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-01-03 03:38:46 +1300 |
commit | f7a8430cefe8e9865d6a99052158eef436103905 (patch) | |
tree | 444d5190dd11c3d20e84157410545d7b03c9b4e3 | |
parent | Rename HTML tidy function (diff) | |
download | dotfiles-f7a8430cefe8e9865d6a99052158eef436103905.tar.gz dotfiles-f7a8430cefe8e9865d6a99052158eef436103905.zip |
Rename and move HTML URL anchoring
-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 |