From 3a3c1d4d6d86311263f94121f5087fd328383bb9 Mon Sep 17 00:00:00 2001 From: workflow <4farlion@gmail.com> Date: Mon, 17 Jun 2024 20:53:39 +0100 Subject: [PATCH] feat(nvim): add formatting of yaml, html, markdown, json via prettierd --- home/neovim/default.nix | 24 +++++++++++++----------- home/neovim/none-ls/none-ls.lua | 5 ++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/home/neovim/default.nix b/home/neovim/default.nix index 43a22b0..7ef800b 100644 --- a/home/neovim/default.nix +++ b/home/neovim/default.nix @@ -1,5 +1,8 @@ -{ pkgs, inputs, ... }: -let +{ + pkgs, + inputs, + ... +}: let nixpkgs-unstable = pkgs.unstable; bookmarks-nvim = pkgs.vimUtils.buildVimPlugin { @@ -21,8 +24,7 @@ let sha256 = "ys3kgXtgaE5OGyNYZ2PuqM9FDGjxfIjRgXBUDBVIjUM="; }; }; -in -{ +in { imports = [ ./carbon ./cmp @@ -201,11 +203,11 @@ in vim.keymap.set('t', '', '', { silent = true }) ''; - extraPackages = [ - pkgs.shellcheck - pkgs.shfmt - pkgs.nixd # Nix Language Server - pkgs.nixpkgs-fmt + extraPackages = with pkgs.unstable; [ + nixd # Nix Language Server + prettierd # For yaml, html, json, markdown + shellcheck + shfmt ]; plugins = with pkgs.vimPlugins; [ @@ -220,7 +222,7 @@ in e = { require("b64").encode, "Base64 [E]ncode" }, d = { require("b64").decode, "Base64 [D]ecode" }, }, - }, { + }, { prefix = "", mode = "v", }) @@ -321,7 +323,7 @@ in { plugin = dressing-nvim; # Better UI for codeactions, code input etc... config = '' - + ''; type = "lua"; } diff --git a/home/neovim/none-ls/none-ls.lua b/home/neovim/none-ls/none-ls.lua index 58b3330..52f91bc 100644 --- a/home/neovim/none-ls/none-ls.lua +++ b/home/neovim/none-ls/none-ls.lua @@ -1,6 +1,9 @@ local null_ls = require("null-ls") null_ls.setup({ sources = { - null_ls.builtins.formatting.shfmt + null_ls.builtins.formatting.shfmt, + null_ls.builtins.formatting.prettierd.with({ + filetypes = { "html", "json", "yaml", "markdown" }, + }), } })