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 {
|
||||
'goolord/alpha-nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
@ -39,5 +39,5 @@ return {
|
|||
}
|
||||
|
||||
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", "<Leader>gp", ":Git push<CR>", { desc = "Run `git push`" })
|
||||
vim.keymap.set("n", "<Leader>gc", ":Git checkout ", { desc = "Git checkout" })
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -3,15 +3,15 @@ return {
|
|||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "lua_ls", "tsserver", "html" }
|
||||
ensure_installed = { "lua_ls", "tsserver", "html" },
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
|
@ -20,19 +20,19 @@ return {
|
|||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.tsserver.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
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', '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>ca', vim.lsp.buf.code_action, { desc = "View code actions" })
|
||||
end
|
||||
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", "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>ca", vim.lsp.buf.code_action, { desc = "View code actions" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
@ -45,32 +45,8 @@ return {
|
|||
"prettierd",
|
||||
"eslint_d",
|
||||
},
|
||||
automatic_installation = true
|
||||
automatic_installation = true,
|
||||
})
|
||||
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,
|
||||
},
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require('lualine').setup({
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'tokyonight'
|
||||
}
|
||||
theme = "tokyonight",
|
||||
},
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -5,22 +5,36 @@ return {
|
|||
config = function()
|
||||
local config = require("nvim-treesitter.configs")
|
||||
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,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true }
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
opts = {
|
||||
max_lines = 2,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {}
|
||||
}
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue