aboutsummaryrefslogtreecommitdiff
path: root/vim/ftplugin/html.vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-04 01:09:12 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-04 01:09:12 +1300
commiteb011c52aeaff29876750caaf6fd7d07dbae7876 (patch)
tree9574da5b88afe31d44c512fc3917048b9b9eee80 /vim/ftplugin/html.vim
parentMerge branch 'hotfix/v0.4.2' (diff)
parentBump version number to 0.5.0 (diff)
downloaddotfiles-eb011c52aeaff29876750caaf6fd7d07dbae7876.tar.gz
dotfiles-eb011c52aeaff29876750caaf6fd7d07dbae7876.zip
Merge branch 'release/v0.5.0'v0.5.0
* release/v0.5.0: (25 commits) Bump version number to 0.5.0 Update documentation to reflect ftplugin changes Add lint mapping for Vimscript Specify scope of mapleader variables Use underscore as local map leader Add check and lint mappings for shell script Add tidy mapping for HTML Break long lines in check/lint/tidy mappings Make all lint/check/tidy maps local and silent Improve comments on check/lint/tidy maps Use long form options for tidy(1) Vim call Use direct :write !cmd instead of shellescape() Use full ':execute' not just ':exe' in VimL Check for availability of Vim shellescape() Revert "Adjust UrlLink() to yank word without t... Adjust UrlLink() to yank word without text objects Refactor UrlLink() function normal! commands Use single quotes for HTML link mapping :execute Refactor HTML tidy(1) mapping Use <Leader>/<LocalLeader> correctly in Vim config ...
Diffstat (limited to 'vim/ftplugin/html.vim')
-rw-r--r--vim/ftplugin/html.vim24
1 files changed, 19 insertions, 5 deletions
diff --git a/vim/ftplugin/html.vim b/vim/ftplugin/html.vim
index 3f28e9ea..c756eb80 100644
--- a/vim/ftplugin/html.vim
+++ b/vim/ftplugin/html.vim
@@ -1,11 +1,25 @@
-" Run tidy -eq -utf8 on file for the current buffer
-nnoremap <leader>v :exe "!tidy -eq -utf8 " . shellescape(expand("%"))<CR>
+" Run `tidy -errors -quiet` over buffer
+nnoremap <buffer> <silent> <LocalLeader>c
+ \ :write !tidy -errors -quiet<CR>
+
+" Filter buffer through `tidy`
+nnoremap <buffer> <silent> <LocalLeader>t
+ \ :%!tidy -quiet<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> <leader>r :<C-U>call <SID>UrlLink()<CR>
+nnoremap <buffer> <silent> <LocalLeader>r
+ \ :<C-U>call <SID>UrlLink()<CR>