formatting top
This commit is contained in:
parent
479b600626
commit
5ad5c9aea4
|
@ -24,6 +24,15 @@ return {
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
local filetypes = {
|
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 = {
|
rust = {
|
||||||
rustfmt = function()
|
rustfmt = function()
|
||||||
return {
|
return {
|
||||||
|
@ -33,19 +42,14 @@ return {
|
||||||
}
|
}
|
||||||
end,
|
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 },
|
cpp = { require("formatter.filetypes.cpp").clangformat },
|
||||||
css = { require("formatter.filetypes.css").prettierd },
|
css = { require("formatter.filetypes.css").prettierd },
|
||||||
-- NOTE: If you don't care about django templates,
|
html = { require("formatter.filetypes.html").prettierd },
|
||||||
-- you can use one of the formatters provided by default.
|
htmldjango = {
|
||||||
-- html = { require("formatter.filetypes.html").prettierd },
|
|
||||||
html = {
|
|
||||||
function()
|
function()
|
||||||
return {
|
return {
|
||||||
exe = "djlint",
|
exe = "djlint",
|
||||||
args = { "-" },
|
args = { "-", "--reformat" },
|
||||||
stdin = 1,
|
stdin = 1,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
@ -72,14 +76,27 @@ return {
|
||||||
go = { require("formatter.filetypes.go").gofmt() },
|
go = { require("formatter.filetypes.go").gofmt() },
|
||||||
yaml = { require("formatter.filetypes.yaml").prettierd },
|
yaml = { require("formatter.filetypes.yaml").prettierd },
|
||||||
c = { require("formatter.filetypes.c").clangformat },
|
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)
|
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,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,7 @@ return {
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
'uga-rosa/ccc.nvim',
|
'uga-rosa/ccc.nvim',
|
||||||
|
lazy = false,
|
||||||
event = 'FileType',
|
event = 'FileType',
|
||||||
keys = {
|
keys = {
|
||||||
{ '<Leader>cp', '<cmd>CccPick<CR>', desc = 'Color-picker' },
|
{ '<Leader>cp', '<cmd>CccPick<CR>', desc = 'Color-picker' },
|
||||||
|
|
Loading…
Reference in New Issue