Add xmllint via ale to neovim

Maintain all dependencies via nix / home-manager.
Load xsd schema file.
Define nix xmllint for linting.
This commit is contained in:
Daniel Siepmann 2022-03-16 17:12:48 +01:00
parent 7d333c703b
commit 8448e85bb1
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
3 changed files with 18 additions and 7 deletions

View file

@ -146,6 +146,13 @@
"borg/exclude".source = ./home/files/borg-exclude;
};
xdg.dataFile = {
"xsd/xliff-core-1.2-strict.xsd".source = pkgs.fetchurl {
url = "https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd";
sha256 = "nzevVk7NJ9X2kVTXz+e6jesfYgyBuUzw6rH0IFx01fg=";
};
};
xdg.desktopEntries = {
networkmanager-dmenu = {
type = "Application";

View file

@ -338,7 +338,12 @@ in {
{
plugin = ale;
config = pkgs.lib.fileContents ./neovim/plugins/ale.vim;
config = pkgs.lib.fileContents(./neovim/plugins/ale.vim)
# Keep line break as fileContents strips last EOL
+ ''
let g:ale_xml_xmllint_executable = '${pkgs.libxml2}/bin/xmllint'
'';
}
{

View file

@ -5,9 +5,8 @@ syn spell toplevel
syn region xmlString contained start=+"+ end=+"+ contains=xmlEntity,@NoSpell display
syn region xmlString contained start=+'+ end=+'+ contains=xmlEntity,@NoSpell display
" TODO: Find a way to distribute the files
" augroup xliff
" autocmd!
" autocmd BufEnter **/*.xlf :let g:syntastic_xml_xmllint_args = '-schema ~/.dotfiles/xsd/xliff-core-1.2-strict.xsd'
" autocmd BufEnter **/*.xlf :let g:ale_xml_xmllint_options = '-schema ~/.dotfiles/xsd/xliff-core-1.2-strict.xsd'
" augroup END
augroup xliff
autocmd!
" xsd is installed via home manager
autocmd BufEnter **/*.xlf :let g:ale_xml_xmllint_options = '-schema ~/.local/share/xsd/xliff-core-1.2-strict.xsd'
augroup END