feat: move formatting plugins to formatting.lua

This commit is contained in:
Devin Haska 2024-04-26 22:49:30 -06:00
parent bd031587a5
commit bca2c8ec94
7 changed files with 214 additions and 204 deletions

View file

@ -1,43 +1,43 @@
return { return {
'goolord/alpha-nvim', "goolord/alpha-nvim",
dependencies = { 'nvim-tree/nvim-web-devicons' }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
local alpha = require("alpha") local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard") local dashboard = require("alpha.themes.dashboard")
-- https://github.com/MaximilianLloyd/ascii.nvim -- https://github.com/MaximilianLloyd/ascii.nvim
dashboard.section.header.val = { dashboard.section.header.val = {
" ", " ",
" ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ", " ░░░ ▄▄▄▄▄▄███▄▄▄▄▄ ",
" ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ", " ▄███████▀▀▀▀▀▀█▓▓▓▓▓▓██▄▄▄▄ ",
" ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ", " ▐████▄▄ ■▓▓▓▓▀▀▀▀▀▀▀▀▀█████■ ██▄ ",
" ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ", " ▀█████████▄▄▄▄▄███████████▀▀ ▄▄ ████░▄▄▄ ",
" ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ", " ▐██▄ ▄▄▄▄▄▄▀▀▀▀▀▀▀▀▓▓▓▀░░░▄▄▄ ▄▄ ▐███▏▐██▓▄████ ",
" ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ", " ▄█▓░███▓ ▄▓▓▓▄▄████████████▄█████▄ ▄█████████▐███ ████▏██▀████▀ ",
" ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ", " ▐███▄███░▀████████▀▀ ▀▓█████▓▀██▓████▀▀ ███████ ▄█████ ■ ██▀ ",
" ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ", " ▀████▓██ ▐██████ ▐████ ▐████▀ ▒████████▄ ▄███████ ",
" ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ", " ▀███ ▀▀█████▄ ▄████ ▄████▏ ▄█████▀█████████▀ ███ ",
" ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ", " ▀████▄ ▄████▐██▄███████▄▄▄███▓██▏ ▀██████▀ ▐██ ",
" ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ", " ▀████████▀ ▀████▀▀████████▀▐██▏ ▀██▀▀ ▐██▏ ",
" ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ", " ▓▓█ ▀████ ▀ ■███▄▄ ███ ██▏ ",
" ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ", " ▀▀▀ ▀▀ ▀█████▄▓▀ ██▏ ",
" ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ", " ░░ ▄████████████▄▄▄▄▄▄▄ ▀▀▀████▄▄ ▒▒▒ ██▏ ▄▄ ",
" ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ", " ▀▀████▀▀▀▀▀▀████████████▄▄▓▓▓███▄ ░░░░ ▐█▏ ■▀▀ ",
" ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ", " ▀▀▀▀▀▀█████▓▓▓▓█▄▄ ▐█ ",
" ▄█████████▄▄ ", " ▄█████████▄▄ ",
" ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ", " ▄▄▄▄████████▀▀▀▀▀▀▀███▏ ",
" ▄▄█████▀▀▀▀ ▀■ ", " ▄▄█████▀▀▀▀ ▀■ ",
" ▄███▀▀▀▀ ", " ▄███▀▀▀▀ ",
" ■▀▀ ", " ■▀▀ ",
" ", " ",
} }
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
dashboard.button("e", " > New File", "<cmd>ene<CR>"), dashboard.button("e", " > New File", "<cmd>ene<CR>"),
dashboard.button("SPC ee", " > File explorer", "<cmd>Neotree<CR>"), dashboard.button("SPC ee", " > File explorer", "<cmd>Neotree<CR>"),
dashboard.button("q", " > Quit", "<cmd>qa<CR>"), dashboard.button("q", " > Quit", "<cmd>qa<CR>"),
} }
alpha.setup(dashboard.opts) alpha.setup(dashboard.opts)
end end,
}; }

View file

@ -0,0 +1,20 @@
return {
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
css = { "prettierd" },
scss = { "prettierd" },
html = { "djlint" },
lua = { "stylelua" },
javascript = { "prettierd" },
javascriptreact = { "prettierd" },
json = { "prettierd" },
jsonc = { "prettierd" },
typescript = { "prettierd" },
typescriptreact = { "prettierd" },
},
format_on_save = {
lsp_fallback = true,
},
},
}

View file

@ -1,10 +1,10 @@
return { return {
"tpope/vim-fugitive", "tpope/vim-fugitive",
config = function() config = function()
vim.keymap.set("n", "<Leader>gs", vim.cmd.Git, { desc = "View `git status`" }) vim.keymap.set("n", "<Leader>gs", vim.cmd.Git, { desc = "View `git status`" })
vim.keymap.set("n", "gh", "<cmd>diffget //2<CR>", { desc = "Pick gitdiff on left" }) vim.keymap.set("n", "gh", "<cmd>diffget //2<CR>", { desc = "Pick gitdiff on left" })
vim.keymap.set("n", "gl", "<cmd>diffget //3<CR>", { desc = "Pick gitdiff on right" }) vim.keymap.set("n", "gl", "<cmd>diffget //3<CR>", { desc = "Pick gitdiff on right" })
vim.keymap.set("n", "<Leader>gp", ":Git push<CR>", { desc = "Run `git push`" }) vim.keymap.set("n", "<Leader>gp", ":Git push<CR>", { desc = "Run `git push`" })
vim.keymap.set("n", "<Leader>gc", ":Git checkout ", { desc = "Git checkout" }) vim.keymap.set("n", "<Leader>gc", ":Git checkout ", { desc = "Git checkout" })
end end,
} }

View file

@ -1,76 +1,52 @@
return { return {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
config = function() config = function()
require("mason").setup() require("mason").setup()
end end,
}, },
{ {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
config = function() config = function()
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "tsserver", "html" } ensure_installed = { "lua_ls", "tsserver", "html" },
}) })
end end,
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
config = function() config = function()
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
lspconfig.lua_ls.setup({ lspconfig.lua_ls.setup({
capabilities = capabilities capabilities = capabilities,
}) })
lspconfig.tsserver.setup({ lspconfig.tsserver.setup({
capabilities = capabilities, capabilities = capabilities,
}) })
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = "Go to definition" }) vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = "Go to implementation" }) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = "Show signature" }) vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show signature" })
vim.keymap.set('n', '<Leader>f', vim.lsp.buf.format, { desc = "Format buffer" }) vim.keymap.set("n", "<Leader>f", vim.lsp.buf.format, { desc = "Format buffer" })
vim.keymap.set('n', '<Leader>ca', vim.lsp.buf.code_action, { desc = "View code actions" }) vim.keymap.set("n", "<Leader>ca", vim.lsp.buf.code_action, { desc = "View code actions" })
end end,
}, },
{ {
"WhoIsSethDaniel/mason-tool-installer.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim",
config = function() config = function()
local mason_tool_installer = require("mason-tool-installer") local mason_tool_installer = require("mason-tool-installer")
mason_tool_installer.setup({ mason_tool_installer.setup({
ensure_installed = { ensure_installed = {
"djlint", "djlint",
"prettierd", "prettierd",
"eslint_d", "eslint_d",
}, },
automatic_installation = true automatic_installation = true,
}) })
end end,
}, },
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
lua = { "stylua" },
javascript = { "eslint_d" },
javascriptreact = { "eslint_d" },
json = { "prettierd" },
jsonc = { "prettierd" },
yaml = { "prettierd" },
typescript = { "eslint_d" },
typescriptreact = { "eslint_d" },
html = { "djlint" },
ejs = { "prettierd" },
css = { "prettierd" },
scss = { "prettierd" },
graphql = { "prettierd" },
["_"] = { "trim_whitespace" },
},
format_on_save = {
lsp_fallback = true,
},
},
}
} }

View file

@ -1,12 +1,12 @@
return { return {
'nvim-lualine/lualine.nvim', "nvim-lualine/lualine.nvim",
dependencies = { 'nvim-tree/nvim-web-devicons' }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require('lualine').setup({ require("lualine").setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = 'tokyonight' theme = "tokyonight",
} },
}) })
end end,
} }

View file

@ -1,26 +1,40 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
build = ":TSUpdate", build = ":TSUpdate",
config = function() config = function()
local config = require("nvim-treesitter.configs") local config = require("nvim-treesitter.configs")
config.setup({ config.setup({
ensure_installed = { "lua", "javascript", "typescript", "tsx", "htmldjango", "html", "jsonc", "json", "jsdoc", "markdown", "markdown_inline", "vim", "vimdoc" }, ensure_installed = {
sync_install = false, "lua",
highlight = { enable = true }, "javascript",
indent = { enable = true } "typescript",
}) "tsx",
end "htmldjango",
}, "html",
{ "jsonc",
"nvim-treesitter/nvim-treesitter-context", "json",
opts = { "jsdoc",
max_lines = 2, "markdown",
} "markdown_inline",
}, "vim",
{ "vimdoc",
'windwp/nvim-autopairs', },
event = "InsertEnter", sync_install = false,
opts = {} highlight = { enable = true },
} indent = { enable = true },
})
end,
},
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
max_lines = 2,
},
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {},
},
} }

View file

@ -1,55 +1,55 @@
return { return {
{ {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
opts = { opts = {
indent = { indent = {
char = "", char = "",
tab_char = "", tab_char = "",
}, },
scope = { enabled = false }, scope = { enabled = false },
exclude = { exclude = {
filetypes = { filetypes = {
"help", "help",
"alpha", "alpha",
"dashboard", "dashboard",
"neo-tree", "neo-tree",
"Trouble", "Trouble",
"trouble", "trouble",
"lazy", "lazy",
"mason", "mason",
"notify", "notify",
"toggleterm", "toggleterm",
"lazyterm", "lazyterm",
}, },
}, },
}, },
main = "ibl", main = "ibl",
}, },
{ {
"echasnovski/mini.indentscope", "echasnovski/mini.indentscope",
opts = { opts = {
symbol = "", symbol = "",
options = { try_as_border = true }, options = { try_as_border = true },
}, },
init = function() init = function()
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { pattern = {
"help", "help",
"alpha", "alpha",
"dashboard", "dashboard",
"neo-tree", "neo-tree",
"Trouble", "Trouble",
"trouble", "trouble",
"lazy", "lazy",
"mason", "mason",
"notify", "notify",
"toggleterm", "toggleterm",
"lazyterm", "lazyterm",
}, },
callback = function() callback = function()
vim.b.miniindentscope_disable = true vim.b.miniindentscope_disable = true
end, end,
}) })
end, end,
}, },
} }