├── README.md └── compiler └── html.vim /README.md: -------------------------------------------------------------------------------- 1 | This is a Vim compiler plugin for validating HTML via [validator.nu](http://validator.nu "Validator.nu"). 2 | 3 | Preview 4 | ------- 5 | 6 | Screenshot: 7 | 8 | ![vim-htmlvalidator](http://i.imgur.com/J0YCC.png "vim-htmlvalidator") 9 | 10 | Requirements 11 | ------------ 12 | 13 | * Vim 14 | * curl 15 | * sed 16 | 17 | Installation 18 | ---------------------- 19 | 20 | Place **html.vim** into **~/.vim/compiler** or clone this repository into the [Pathogen](https://github.com/tpope/vim-pathogen "Pathogen") **~/.vim/bundles** directory. 21 | 22 | If you wish to always associate HTML with this compiler, add the following line to the **~/.vimrc** file. 23 | 24 | `au FileType html compiler html` 25 | 26 | If you wish to automatically open the **QuickFix** window, add the following line to the **~/.vimrc** file. 27 | 28 | `au QuickFixCmdPost make cwindow` 29 | 30 | Usage 31 | ---------------------- 32 | 33 | Type **:make**. If there are errors, then type **:cwindow** or **:clist** if you have not set up the **QuickFix** window to open automatically. 34 | 35 | License 36 | ------- 37 | 38 | GPLv2+ 39 | 40 | -------------------------------------------------------------------------------- /compiler/html.vim: -------------------------------------------------------------------------------- 1 | " Vim compiler file for HTML. 2 | " Compiler: HTML Validator 3 | " Maintainer: Sorin Ionescu 4 | " Maintainer: Mark Grealish 5 | " Last Change: 2015-11-27 6 | " Version: 2.0.0 7 | " 8 | " Installation: 9 | " Drop html.vim in ~/.vim/compiler directory. 10 | " 11 | " Add the following line to the autocmd section of .vimrc 12 | " 13 | " autocmd FileType html compiler html 14 | 15 | if exists('current_compiler') 16 | finish 17 | endif 18 | let current_compiler = 'html' 19 | 20 | if exists(":CompilerSet") != 2 " older Vim always used :setlocal 21 | command -nargs=* CompilerSet setlocal 22 | endif 23 | 24 | let s:cpo_save = &cpo 25 | set cpo-=C 26 | 27 | CompilerSet makeprg=(echo\ '[%]';\ curl\ -s\ --connect-timeout\ 5\ -F\ laxtype=yes\ -F\ level=error\ -F\ out=gnu\ -F\ doc=@%\ https://validator.nu\ \\\|\ sed\ -e\ \'s/^\"[^\"]*\"://g\'\ -e\ \'s/^\\([0-9]*\\.[0-9]*\\)-[0-9]*\\.[0-9]*/\\1/g\') 28 | CompilerSet errorformat=%+P[%f],%l.%c:\ %t%*[^:]:\ %m,%-Q 29 | 30 | let &cpo = s:cpo_save 31 | unlet s:cpo_save 32 | --------------------------------------------------------------------------------