101 lines
3.3 KiB
Lua
101 lines
3.3 KiB
Lua
-- 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 },
|
|
})
|
|
vim.cmd('colorscheme rose-pine')
|
|
end)
|
|
|
|
-- Treesitter
|
|
Config.now_if_args(function()
|
|
vim.pack.add({ 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
|
vim.treesitter.language.register('bash', 'sh')
|
|
vim.treesitter.language.register('tsx', 'typescriptreact')
|
|
|
|
local filetypes = {
|
|
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
|
'typescript', 'typescriptreact', 'svelte', 'dockerfile', 'yaml', 'markdown', 'dart',
|
|
'json', 'xml', 'toml', 'sh', 'bash', 'zsh', 'just', 'gitcommit', 'diff', 'regex', 'http'
|
|
}
|
|
|
|
Config.autocmd('FileType', filetypes, function(ev)
|
|
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')
|
|
|
|
Config.later(function()
|
|
local missing = {}
|
|
|
|
for _, ft in ipairs(filetypes) do
|
|
local lang = vim.treesitter.language.get_lang(ft) or ft
|
|
if #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.so', false) == 0 then
|
|
table.insert(missing, lang)
|
|
end
|
|
end
|
|
|
|
if #missing > 0 then
|
|
require('nvim-treesitter').install(missing)
|
|
end
|
|
end)
|
|
end)
|
|
|
|
-- LSP
|
|
Config.now_if_args(function()
|
|
vim.pack.add({ 'https://github.com/neovim/nvim-lspconfig' })
|
|
vim.lsp.enable({ 'ansiblels', 'gopls', 'phpantom_lsp', 'svelte', 'tailwindcss', 'tsc', 'biome' })
|
|
end)
|
|
|
|
-- 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 },
|
|
formatters_by_ft = {
|
|
go = { 'gofumpt', 'goimports' },
|
|
php = { 'php_cs_fixer' },
|
|
json = { 'jq' },
|
|
javascript = { 'biome' },
|
|
typescript = { 'biome' },
|
|
javascriptreact = { 'biome' },
|
|
typescriptreact = { 'biome' },
|
|
svelte = { 'biome' },
|
|
},
|
|
})
|
|
end)
|
|
|
|
-- DAP
|
|
Config.later(function()
|
|
vim.pack.add({ 'https://github.com/mfussenegger/nvim-dap' })
|
|
|
|
local dap_signs = {
|
|
DapBreakpoint = { text = '', texthl = 'DapBreakpoint' },
|
|
DapBreakpointCondition = { text = '', texthl = 'DapBreakpointCondition' },
|
|
DapLogPoint = { text = '', texthl = 'DapLogPoint' },
|
|
DapStopped = { text = '', texthl = 'DapStopped', linehl = 'DapStoppedLine' },
|
|
DapBreakpointRejected = { text = '', texthl = 'DapBreakpointRejected' },
|
|
}
|
|
for name, sign in pairs(dap_signs) do
|
|
vim.fn.sign_define(name, sign)
|
|
end
|
|
|
|
require('dap').adapters.go = { type = 'server', host = '127.0.0.1', port = '${port}' }
|
|
end)
|
|
|
|
-- Kulala
|
|
Config.autocmd('FileType', 'http', function()
|
|
vim.pack.add({ 'https://github.com/mistweaverco/kulala.nvim' })
|
|
require('kulala').setup({ default_env = 'dev' })
|
|
end, 'Setup Kulala', true)
|
|
|
|
-- Flutter
|
|
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, 'Setup flutter', true)
|