feat: move formatting plugins to formatting.lua
This commit is contained in:
parent
bd031587a5
commit
bca2c8ec94
7 changed files with 214 additions and 204 deletions
|
@ -1,6 +1,6 @@
|
||||||
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")
|
||||||
|
@ -39,5 +39,5 @@ return {
|
||||||
}
|
}
|
||||||
|
|
||||||
alpha.setup(dashboard.opts)
|
alpha.setup(dashboard.opts)
|
||||||
end
|
end,
|
||||||
};
|
}
|
||||||
|
|
20
lua/plugins/formatting.lua
Normal file
20
lua/plugins/formatting.lua
Normal 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -6,5 +6,5 @@ return {
|
||||||
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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,15 @@ 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",
|
||||||
|
@ -20,19 +20,19 @@ return {
|
||||||
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",
|
||||||
|
@ -45,32 +45,8 @@ return {
|
||||||
"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,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,22 +5,36 @@ return {
|
||||||
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 = {
|
||||||
|
"lua",
|
||||||
|
"javascript",
|
||||||
|
"typescript",
|
||||||
|
"tsx",
|
||||||
|
"htmldjango",
|
||||||
|
"html",
|
||||||
|
"jsonc",
|
||||||
|
"json",
|
||||||
|
"jsdoc",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
},
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true }
|
indent = { enable = true },
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
opts = {
|
opts = {
|
||||||
max_lines = 2,
|
max_lines = 2,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'windwp/nvim-autopairs',
|
"windwp/nvim-autopairs",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
opts = {}
|
opts = {},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue