zig.lua 655 B

123456789101112131415
  1. -- Because lspinstall don't support zig yet,
  2. -- So we need zls preset in global lib
  3. -- Further custom install zls in
  4. -- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
  5. require("lspconfig").zls.setup {
  6. root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
  7. on_attach = require("lsp").common_on_attach,
  8. }
  9. require("lv-utils").define_augroups {
  10. _zig_autoformat = {
  11. { "BufWritePre", "*.zig", "lua vim.lsp.buf.formatting_sync(nil, 1000)" },
  12. { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' },
  13. },
  14. }
  15. vim.cmd "setl expandtab tabstop=8 softtabstop=4 shiftwidth=4"