diff --git a/darwin/configuration.nix b/darwin/configuration.nix index cceedc2d..771b5e94 100644 --- a/darwin/configuration.nix +++ b/darwin/configuration.nix @@ -49,6 +49,7 @@ programs.fish.enable = true; services.nix-daemon.enable = true; + services.tailscale.enable = true; system.stateVersion = 4; system.keyboard.enableKeyMapping = true; diff --git a/flake.lock b/flake.lock index dfd15980..0eb9b47c 100644 --- a/flake.lock +++ b/flake.lock @@ -1816,7 +1816,7 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-jcGDQxNvo9hLGOcoVWLaAD4N0S9hWjzmudCr4n84YOo=", + "narHash": "sha256-Zoq4MEovQdTzsJOX7dBaYsH6VpoDEizvVNC39HcP/7U=", "path": "./neovim", "type": "path" }, diff --git a/neovim/nvim.nix b/neovim/nvim.nix index 8662fa03..489a9939 100644 --- a/neovim/nvim.nix +++ b/neovim/nvim.nix @@ -36,7 +36,18 @@ in rec { conform-nvim = { enable = true; settings = { - format_on_save.lsp_format = "fallback"; + format_on_save = + /* + lua + */ + '' + function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 500, lsp_format = "fallback" } + end + ''; formatters_by_ft = { d2 = ["d2"]; sql = ["sleek"]; @@ -632,6 +643,24 @@ in rec { end, {}) + vim.api.nvim_create_user_command("FormatDisable", function(args) + if args.bang then + -- FormatDisable! will disable formatting just for this buffer + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end, { + desc = "Disable autoformat-on-save", + bang = true, + }) + vim.api.nvim_create_user_command("FormatEnable", function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false + end, { + desc = "Re-enable autoformat-on-save", + }) + vim.api.nvim_create_user_command('Sqlfmt', function() pcall(vim.cmd'%!${pkgs.sleek}/bin/sleek')