refactor: simplify

This commit is contained in:
2026-09-03 20:55:37 +02:00
parent 71434f947b
commit 5eb228750d
8 changed files with 176 additions and 235 deletions
+18 -48
View File
@@ -1,20 +1,15 @@
-- Colortheme ==================================================================
-- Colortheme
Config.now(function()
vim.pack.add({ { src = "https://github.com/rose-pine/neovim", name = "rose-pine" } })
require("rose-pine").setup({
enable = {
terminal = false,
legacy_highlights = false,
migrations = false,
},
enable = { terminal = false, legacy_highlights = false, migrations = false },
})
vim.cmd("colorscheme rose-pine")
end)
-- Treesitter ==================================================================
-- Treesitter
Config.now_if_args(function()
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
vim.treesitter.language.register('tsx', { 'typescriptreact' })
local filetypes = {
@@ -24,11 +19,8 @@ Config.now_if_args(function()
}
Config.autocmd('FileType', filetypes, function(ev)
if pcall(vim.treesitter.start, ev.buf) then
if vim.bo[ev.buf].filetype == 'php' then
-- Fixes broken indentation on `o` in php buffers
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
if pcall(vim.treesitter.start, ev.buf) and vim.bo[ev.buf].filetype == 'php' then
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end
end, 'Start tree-sitter')
@@ -39,32 +31,18 @@ Config.now_if_args(function()
end)
end)
-- LSP =========================================================================
-- LSP
Config.later(function()
vim.pack.add({ "https://github.com/neovim/nvim-lspconfig" })
vim.lsp.enable({
"ansiblels",
"gopls",
"intelephense",
"lua_ls",
"svelte",
"tailwindcss",
"tsc",
"dartls"
})
vim.lsp.enable({ "ansiblels", "gopls", "intelephense", "lua_ls", "svelte", "tailwindcss", "tsc", "dartls" })
end)
-- Formatting ==================================================================
-- Formatting
Config.later(function()
vim.pack.add({ "https://github.com/stevearc/conform.nvim" })
require("conform").setup({
default_format_opts = { lsp_format = "fallback" },
format_on_save = {
lsp_format = "fallback",
timeout_ms = 1000,
},
format_on_save = { lsp_format = "fallback", timeout_ms = 1000 },
formatters_by_ft = {
go = { "gofumpt", "goimports" },
php = { "php_cs_fixer" },
@@ -78,9 +56,8 @@ Config.later(function()
})
end)
-- DAP =========================================================================
function Config.setup_dap()
Config.setup_dap = nil
-- DAP
Config.later(function()
vim.pack.add({ "https://github.com/mfussenegger/nvim-dap" })
local dap_signs = {
@@ -94,26 +71,19 @@ function Config.setup_dap()
vim.fn.sign_define(name, sign)
end
local dap = require("dap")
dap.adapters.go = { type = "server", host = "127.0.0.1", port = "${port}" }
end
require("dap").adapters.go = { type = "server", host = "127.0.0.1", port = "${port}" }
end)
-- Kulala ======================================================================
function Config.setup_kulala()
Config.setup_kulala = nil
-- Kulala & Flutter
Config.autocmd('FileType', { 'http' }, function()
vim.pack.add({ "https://github.com/mistweaverco/kulala.nvim" })
require("kulala").setup({ default_env = "dev" })
end
end, "Setup Kulala", true)
-- Flutter =====================================================================
function Config.setup_flutter()
Config.setup_flutter = nil
Config.autocmd('FileType', 'dart', function()
vim.pack.add({
"https://github.com/nvim-lua/plenary.nvim",
"https://github.com/nvim-flutter/flutter-tools.nvim",
})
require("flutter-tools").setup({ lsp = { color_capabilities = true } })
end
Config.autocmd('FileType', 'dart', Config.setup_flutter, "Setup flutter", true)
end, "Setup Flutter", true)