From 5ad5c9aea433cb8bf4b115b62a6c402d1295bdfb Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 1 Oct 2023 22:41:11 +0200 Subject: [PATCH] formatting top --- .../plugins/extras/formatting/prettier.lua | 45 +++++++++++++------ lua/plex/plugins/ui.lua | 1 + 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/lua/plex/plugins/extras/formatting/prettier.lua b/lua/plex/plugins/extras/formatting/prettier.lua index e5b22d9..44be155 100644 --- a/lua/plex/plugins/extras/formatting/prettier.lua +++ b/lua/plex/plugins/extras/formatting/prettier.lua @@ -24,6 +24,15 @@ return { opts = function(_, opts) opts = opts or {} local filetypes = { + -- NOTE: If using this config, you need to install prettierd. + -- At the time of writing that is done with: + -- `sudo npm install -g @fsouza/prettierd` + ["*"] = { + -- NOTE: This is not a fallback! It seems to overwrite any other + -- configs. + require("formatter.filetypes.any").remove_trailing_whitespace, + }, + text = { require("formatter.defaults.prettierd") }, rust = { rustfmt = function() return { @@ -33,19 +42,14 @@ return { } end, }, - -- NOTE: If using this config, you need to install prettierd. - -- At the time of writing that is done with: - -- `sudo npm install -g @fsouza/prettierd` cpp = { require("formatter.filetypes.cpp").clangformat }, css = { require("formatter.filetypes.css").prettierd }, - -- NOTE: If you don't care about django templates, - -- you can use one of the formatters provided by default. - -- html = { require("formatter.filetypes.html").prettierd }, - html = { + html = { require("formatter.filetypes.html").prettierd }, + htmldjango = { function() return { exe = "djlint", - args = { "-" }, + args = { "-", "--reformat" }, stdin = 1, } end, @@ -72,14 +76,27 @@ return { go = { require("formatter.filetypes.go").gofmt() }, yaml = { require("formatter.filetypes.yaml").prettierd }, c = { require("formatter.filetypes.c").clangformat }, - ["*"] = { - -- "formatter.filetypes.any" defines default configurations for any - -- filetype - require("formatter.filetypes.any").remove_trailing_whitespace, - require("formatter.defaults.prettierd"), - }, } opts.filetype = vim.tbl_extend("keep", opts.filetype or {}, filetypes) + + local highlight = { + "L0", + "L1", + "L2", + "L3", + } + + local hooks = require("ibl.hooks") + -- create the highlight groups in the highlight setup hook, so they are reset + -- every time the colorscheme changes + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "L0", { fg = "#cc0000" }) + vim.api.nvim_set_hl(0, "L1", { fg = "#b30080" }) + vim.api.nvim_set_hl(0, "L2", { fg = "#cc0000" }) + vim.api.nvim_set_hl(0, "L3", { fg = "#b30080" }) + end) + + require("ibl").setup({ indent = { highlight = highlight } }) end, }, diff --git a/lua/plex/plugins/ui.lua b/lua/plex/plugins/ui.lua index b1b5281..babed7a 100644 --- a/lua/plex/plugins/ui.lua +++ b/lua/plex/plugins/ui.lua @@ -337,6 +337,7 @@ return { ----------------------------------------------------------------------------- { 'uga-rosa/ccc.nvim', + lazy = false, event = 'FileType', keys = { { 'cp', 'CccPick', desc = 'Color-picker' },