[vim] Fix broken color scheme
I learned once again that true color schemes don't work in macOS's Terminal.app. I also learned that the default color scheme in neovim is very plain and doesn't provide a lot of variation for treesitter syntax elements. So, choose a different built-in color scheme as the default. I also learned about the ColorScheme autocmd event, which is fired after a color scheme is applied. Convert the (janky) reloadColorscheme function to a set of autocommands that trigger based on the color scheme name. Along the way, add some explicit configuration for treesitter: enable highlighting, indentation, and make sure some of my common languages have plugins installed. Also link the "objcpp" filetype to both "objc" and "cpp" treesitter plugins. Lastly, make some updates to the git gutter color configuration. Create some autocommands that are applied after the plugin is loaded. For the gutter, use color 233 from the 256 color palette, which is a very dark gray.
This commit is contained in:
parent
7d26910371
commit
383fd5ceb9
4 changed files with 81 additions and 56 deletions
|
@ -3,8 +3,25 @@
|
|||
-- Ensure there's always a gutter column so there's no stutter when changes cause it to appear.
|
||||
vim.wo.signcolumn = "yes"
|
||||
|
||||
vim.cmd [[
|
||||
highlight GitGutterAdd ctermfg=Green ctermbg=0
|
||||
highlight GitGutterChange ctermfg=DarkBlue ctermbg=0
|
||||
highlight GitGutterDelete ctermfg=Red ctermbg=0
|
||||
]]
|
||||
local gitgutter_colorscheme_group = vim.api.nvim_create_augroup("GitGutterColorSchemeOverrides", { clear = true })
|
||||
|
||||
local function update_gitgutter_colors()
|
||||
vim.cmd [[
|
||||
hi! SignColumn ctermbg=233
|
||||
hi! GitGutterAdd ctermbg=233
|
||||
hi! GitGutterRemove ctermbg=233
|
||||
hi! GitGutterChange ctermbg=233
|
||||
hi! GitGutterChangeDelete ctermbg=233
|
||||
]]
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "GitGutter",
|
||||
callback = update_gitgutter_colors,
|
||||
group = gitgutter_colorscheme_group,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
callback = update_gitgutter_colors,
|
||||
group = gitgutter_colorscheme_group,
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue