refactor: small fixes
This commit is contained in:
+58
-42
@@ -1,14 +1,13 @@
|
||||
-- Colortheme ==================================================================
|
||||
Config.now(function()
|
||||
vim.pack.add({ "https://github.com/rebelot/kanagawa.nvim" })
|
||||
require("kanagawa").setup({ compile = true })
|
||||
vim.cmd("colo kanagawa")
|
||||
end)
|
||||
|
||||
-- Mason ====================================================================
|
||||
Config.now_if_args(function()
|
||||
vim.pack.add({ "https://github.com/mason-org/mason.nvim" })
|
||||
require("mason").setup()
|
||||
vim.pack.add({ "https://github.com/rose-pine/neovim" })
|
||||
require("rose-pine").setup({
|
||||
enable = {
|
||||
legacy_highlights = false,
|
||||
migrations = false,
|
||||
},
|
||||
})
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end)
|
||||
|
||||
-- Treesitter ==================================================================
|
||||
@@ -18,25 +17,34 @@ Config.now_if_args(function()
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects',
|
||||
})
|
||||
|
||||
local languages = {
|
||||
'lua',
|
||||
'go',
|
||||
'php',
|
||||
'sql',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'tsx',
|
||||
'dockerfile',
|
||||
'yaml',
|
||||
'markdown',
|
||||
}
|
||||
local isnt_installed = function(lang)
|
||||
return #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) == 0
|
||||
end
|
||||
local to_install = vim.tbl_filter(isnt_installed, languages)
|
||||
if #to_install > 0 then require('nvim-treesitter').install(to_install) end
|
||||
vim.treesitter.language.register('tsx', { 'typescriptreact' })
|
||||
|
||||
Config.autocmd('FileType', languages, function(ev) vim.treesitter.start(ev.buf) end, 'Start tree-sitter')
|
||||
local filetypes = {
|
||||
'html', 'css', 'lua', 'go', 'php', 'blade', 'sql', 'javascript',
|
||||
'typescript', 'typescriptreact', 'dockerfile', 'yaml', 'markdown', 'dart',
|
||||
'json', 'xml', 'toml', 'bash', 'gitcommit', 'diff', 'regex', 'zsh'
|
||||
}
|
||||
|
||||
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
|
||||
end
|
||||
end, 'Start tree-sitter')
|
||||
|
||||
Config.later(function()
|
||||
require('nvim-treesitter').install(vim.tbl_map(function(ft)
|
||||
return vim.treesitter.language.get_lang(ft) or ft
|
||||
end, filetypes))
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Mason =======================================================================
|
||||
Config.now_if_args(function()
|
||||
vim.pack.add({ "https://github.com/mason-org/mason.nvim" })
|
||||
require("mason").setup()
|
||||
end)
|
||||
|
||||
-- LSP =========================================================================
|
||||
@@ -49,11 +57,12 @@ Config.now_if_args(function()
|
||||
"intelephense",
|
||||
"lua_ls",
|
||||
"tailwindcss",
|
||||
"vtsls",
|
||||
"tsc",
|
||||
"dartls"
|
||||
})
|
||||
end)
|
||||
|
||||
-- Conform =====================================================================
|
||||
-- Formatting ==================================================================
|
||||
Config.now_if_args(function()
|
||||
vim.pack.add({ "https://github.com/stevearc/conform.nvim" })
|
||||
|
||||
@@ -61,7 +70,7 @@ Config.now_if_args(function()
|
||||
default_format_opts = { lsp_format = "fallback" },
|
||||
format_on_save = {
|
||||
lsp_format = "fallback",
|
||||
timeout_ms = 500,
|
||||
timeout_ms = 1000,
|
||||
},
|
||||
formatters_by_ft = {
|
||||
go = { "gofumpt", "goimports" },
|
||||
@@ -72,20 +81,15 @@ end)
|
||||
|
||||
-- DAP =========================================================================
|
||||
function Config.setup_dap()
|
||||
if package.loaded["dap"] then
|
||||
return
|
||||
end
|
||||
|
||||
Config.setup_dap = nil
|
||||
vim.pack.add({ "https://github.com/mfussenegger/nvim-dap" })
|
||||
|
||||
local dap = require("dap")
|
||||
|
||||
dap.adapters.php = {
|
||||
type = "executable",
|
||||
command = "node",
|
||||
args = { vim.fn.stdpath("data") .. "/mason/packages/php-debug-adapter/extension/out/phpDebug.js" },
|
||||
}
|
||||
|
||||
dap.adapters.go = {
|
||||
type = "server",
|
||||
host = "127.0.0.1",
|
||||
@@ -95,16 +99,14 @@ end
|
||||
|
||||
-- Kulala ======================================================================
|
||||
function Config.setup_kulala()
|
||||
if package.loaded["kulala"] then
|
||||
return
|
||||
end
|
||||
|
||||
Config.setup_kulala = nil
|
||||
vim.pack.add({ "https://github.com/mistweaverco/kulala.nvim" })
|
||||
require("kulala").setup({ default_env = "dev" })
|
||||
end
|
||||
|
||||
-- Laravel =====================================================================
|
||||
Config.now_if_args(function()
|
||||
function Config.setup_laravel()
|
||||
Config.setup_laravel = nil
|
||||
vim.pack.add({
|
||||
"https://github.com/MunifTanjim/nui.nvim",
|
||||
"https://github.com/nvim-lua/plenary.nvim",
|
||||
@@ -113,4 +115,18 @@ Config.now_if_args(function()
|
||||
})
|
||||
|
||||
require("laravel").setup({})
|
||||
end)
|
||||
end
|
||||
|
||||
-- Flutter =====================================================================
|
||||
function Config.setup_flutter()
|
||||
Config.setup_flutter = nil
|
||||
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', 'php', Config.setup_laravel, "Setup laravel", true)
|
||||
Config.autocmd('FileType', 'dart', Config.setup_flutter, "Setup flutter", true)
|
||||
|
||||
Reference in New Issue
Block a user