Compare commits

...

2 Commits

Author SHA1 Message Date
afdefb7dc3 fix mellow theming 2025-07-14 19:42:40 -04:00
64afe9c9ee revert treesitter back to master branch 2025-07-14 19:42:16 -04:00
2 changed files with 74 additions and 91 deletions

View File

@ -5,12 +5,17 @@ return { "mellow-theme/mellow.nvim",
vim.g.mellow_variant = "dark" vim.g.mellow_variant = "dark"
local c = require("mellow.colors")[vim.g.mellow_variant] local c = require("mellow.colors")[vim.g.mellow_variant]
if vim.g.mellow_variant == "dark" then
vim.g.mellow_highlight_overrides = { vim.g.mellow_highlight_overrides = {
-- stop inactive windows from having a darker bg -- stop inactive windows from having a darker bg
["NormalNC"] = { link = "Normal" }, ["NormalNC"] = { link = "Normal" },
-- revert change with statusline coloring
["StatusLine"] = { fg = c.white, bg = c.gray01 },
["StatusLineNC"] = { fg = c.bg_dark },
-- make splits look cleaner -- make splits look cleaner
["WinSeparator"] = { link = "Normal" }, ["WinSeparator"] = { fg = c.gray01 },
-- make floats darker -- make floats darker
["NormalFloat"] = { fg = c.fg, bg = "#111111" }, ["NormalFloat"] = { fg = c.fg, bg = "#111111" },
@ -21,12 +26,14 @@ return { "mellow-theme/mellow.nvim",
["DiagnosticUnderlineWarn"] = { fg = c.yellow, undercurl = true }, ["DiagnosticUnderlineWarn"] = { fg = c.yellow, undercurl = true },
["DiagnosticUnderlineInfo"] = { fg = c.blue, undercurl = true }, ["DiagnosticUnderlineInfo"] = { fg = c.blue, undercurl = true },
["DiagnosticUnderlineHint"] = { fg = c.cyan, undercurl = true }, ["DiagnosticUnderlineHint"] = { fg = c.cyan, undercurl = true },
["DiagnosticHint"] = { fg = c.cyan }, -- revert
-- make blink actually look nice -- make blink actually look nice
["BlinkCmpMenu"] = { link = "NormalFloat" }, ["BlinkCmpMenu"] = { link = "NormalFloat" },
["BlinkCmpMenuBorder"] = { link = "BlinkCmpMenu" }, ["BlinkCmpMenuBorder"] = { link = "BlinkCmpMenu" },
["BlinkCmpMenuSelection"] = { bg = c.gray01 }, ["BlinkCmpMenuSelection"] = { bg = c.gray01 },
["BlinkCmpLabelDeprecated"] = { link = "CmpItemAbbrDeprecated" }, ["BlinkCmpLabelDeprecated"] = { link = "CmpItemAbbrDeprecated" },
["BlinkCmpLabelMatch"] = { link = "NormalFloat" }, -- reverted
-- telescope styling so I can see when coding outside (real) -- telescope styling so I can see when coding outside (real)
["TelescopeResultsNormal"] = { bg = c.bg_dark }, ["TelescopeResultsNormal"] = { bg = c.bg_dark },
@ -39,4 +46,5 @@ return { "mellow-theme/mellow.nvim",
["TelescopePreviewBorder"] = { link = "TelescopePreviewNormal" } ["TelescopePreviewBorder"] = { link = "TelescopePreviewNormal" }
} }
end end
end
} }

View File

@ -1,79 +1,54 @@
local map, auto = core.misc.map, core.misc.auto local map, auto = core.misc.map, core.misc.auto
--- to highlight a buffer or not
---@param buf number buffer number
---@return boolean to_highlight
local function highlight(buf)
local ft = vim.api.nvim_get_option_value("ft", { buf = buf })
-- disable highlighting on big files
local ok, stats = pcall(vim.uv.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > (1000 * 100 * 10) --[[1MB]] then
return false
end
-- fts to stop highlighting in
if table.contains({
"diff", "tex"
}, ft) then
return false
end
return true
end
--- to indent a buffer or not
---@param buf number buffer number
---@return boolean to_indent
local function indent(buf)
local ft = vim.api.nvim_get_option_value("ft", { buf = buf })
-- disable indentation on filetypes
if not table.contains({
"php"
}, ft) then
return false
end
return true
end
return { return {
{ "nvim-treesitter/nvim-treesitter", { "nvim-treesitter/nvim-treesitter",
branch = "main", disable = not vim.fn.has("nvim-0.10.0"),
disable = not vim.fn.has("nvim-0.11.0"),
config = function() config = function()
vim.cmd("TSUpdate") vim.cmd("TSUpdate")
end, end,
load = function() load = function()
local treesitter = require("nvim-treesitter") require("nvim-treesitter.configs").setup {
-- good default parsers
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
"markdown_inline", "java", "bash", "css", "html", "luadoc",
"make"
},
-- seems to not be very async despite the docs saying it is -- indentation
-- default parsers to install indent = {
-- treesitter.install { "c", "lua", "vim", "vimdoc", "markdown", enable = true,
-- "markdown_inline", "java", "bash", "css", "html", "luadoc", "make"
-- } disable = function(lang, _)
-- disable indenting in php (it's more broken with than without)
return table.contains(({
"php"
}), lang)
end
},
-- enable highlighting -- enable highlighting
auto("FileType", { highlight = {
callback = function(e) enable = true,
-- I like both treesitter and default highlighting enabled -- use vim highlighting in addition to treesitter
if highlight(e.buf) then additional_vim_regex_highlighting = true,
-- stop errors from showing up, I don't care
pcall(vim.treesitter.start) disable = function(lang, buf)
vim.bo.syntax = "on" -- disable in some files where vim's builtin highlighting is better
if table.contains(({
"diff", "tex"
}), lang) then
return true
end end
-- indenting -- disable in big files
if indent(e.buf) then local ok, stats = pcall(vim.uv.fs_stat,
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > (1024 * 100 * 10) --[[1MB]] then
return true
end end
-- set the folding method
vim.opt.foldmethod = "expr"
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
end end
}) }
}
end end
}, },