summary refs log tree commit diff
path: root/.vim/lua/plugins.lua
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-11-04 16:45:21 +0100
committerRobert Günzler <r@gnzler.io>2022-11-18 18:37:25 +0100
commit50a31f900af0bef00b56fbf490ef97dc394d58af (patch)
tree33f549622308670a46ce3e259180d0405cba424f /.vim/lua/plugins.lua
parented2f15096a654e2c1b8fb7023c255edd244592b0 (diff)
vim: install custom js/html/css-beautify null-ls formatters
Diffstat (limited to '')
-rw-r--r--.vim/lua/plugins.lua39
1 files changed, 38 insertions, 1 deletions
diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua
index 16c4c57..a16dc91 100644
--- a/.vim/lua/plugins.lua
+++ b/.vim/lua/plugins.lua
@@ -416,7 +416,6 @@ require('packer').startup({function()
     requires = {'nvim-lua/plenary.nvim'},
     config = function()
       local nls = require('null-ls')
-      -- local h = require('null-ls.helpers')
       nls.setup {
         -- debug = true,
         sources = {
@@ -431,6 +430,44 @@ require('packer').startup({function()
         },
         on_attach = require('internal.lsp').my_attach,
       }
+
+      local h = require('null-ls.helpers')
+
+      nls.register({
+        h.make_builtin({
+          name = 'html-beautify',
+          filetypes = {'html', 'gotmpl.html'},
+          method = nls.methods.FORMATTING,
+          generator_opts = {
+            command = vim.env.HOME .. '/.yarn/bin/html-beautify',
+            args = {'--file', '-', '--editorconfig'},
+            to_stdin = true,
+          },
+          factory = h.formatter_factory,
+        }),
+        h.make_builtin({
+          name = 'html-beautify',
+          filetypes = {'html', 'gotmpl.html'},
+          method = nls.methods.FORMATTING,
+          generator_opts = {
+            command = vim.env.HOME .. '/.yarn/bin/html-beautify',
+            args = {'--file', '-', '--editorconfig'},
+            to_stdin = true,
+          },
+          factory = h.formatter_factory,
+        }),
+        h.make_builtin({
+          name = 'css-beautify',
+          filetypes = {'css', 'scss'},
+          method = nls.methods.FORMATTING,
+          generator_opts = {
+            command = vim.env.HOME .. '/.yarn/bin/css-beautify',
+            args = {'--file', '-', '--editorconfig'},
+            to_stdin = true,
+          },
+          factory = h.formatter_factory,
+        }),
+      })
     end} -- }}}
 
   use {'mfussenegger/nvim-dap', module = {'dap'}, -- {{{