From 8448e85bb1848daa2e02549df3cddb67c1d86f9f Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 16 Mar 2022 17:12:48 +0100 Subject: [PATCH] Add xmllint via ale to neovim Maintain all dependencies via nix / home-manager. Load xsd schema file. Define nix xmllint for linting. --- home.nix | 7 +++++++ home/programs/neovim.nix | 7 ++++++- .../neovim/configuration/after/ftplugin/xml.vim | 11 +++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/home.nix b/home.nix index 527e518..56d2aba 100644 --- a/home.nix +++ b/home.nix @@ -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"; diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix index 1c39e56..1464c87 100644 --- a/home/programs/neovim.nix +++ b/home/programs/neovim.nix @@ -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' + ''; } { diff --git a/home/programs/neovim/configuration/after/ftplugin/xml.vim b/home/programs/neovim/configuration/after/ftplugin/xml.vim index 753ac61..9ecd8fc 100644 --- a/home/programs/neovim/configuration/after/ftplugin/xml.vim +++ b/home/programs/neovim/configuration/after/ftplugin/xml.vim @@ -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