feat(nvim): autoload color theme after plugin init

This commit is contained in:
Fernando Araoz 2025-01-24 05:51:25 -05:00
parent ef3514ea0b
commit 05ec3dc4b5
3 changed files with 21 additions and 15 deletions

View File

@ -0,0 +1,18 @@
;
; This file is to be called AFTER the color plugins have been loaded
;
(fn set-theme-for-directory []
(let [cwd (vim.fn.getcwd)
directory-themes {:acide/trazo-backend :github_light
:acide/trazo-frontend :onelight
:csharp :caret
:zig :ayu-dark}]
(var theme "randomhue")
(each [dir dir-theme (pairs directory-themes)]
(when (string.find cwd dir 1 true) (set theme dir-theme) (lua :break)))
(vim.cmd (.. "colorscheme " theme))))
(vim.api.nvim_create_autocmd [:DirChanged]
{:callback (fn [] (set-theme-for-directory))})
(set-theme-for-directory)

View File

@ -76,20 +76,5 @@
:group (vim.api.nvim_create_augroup :kickstart-highlight-yank
{:clear true})})
(fn set-theme-for-directory []
(let [cwd (vim.fn.getcwd)
directory-themes {:acide/trazo-backend :github_light
:acide/trazo-frontend :onelight
:csharp :caret
:zig :ayu-dark}]
(var theme "vim")
(each [dir dir-theme (pairs directory-themes)]
(when (string.find cwd dir 1 true) (set theme dir-theme) (lua :break)))
(vim.cmd (.. "colorscheme " theme))))
(vim.api.nvim_create_autocmd [:DirChanged]
{:callback (fn [] (set-theme-for-directory))})
(set-theme-for-directory)
(print "I have been setup with Fennel :D")

View File

@ -49,3 +49,6 @@ require("lazy").setup({
{ import = "plugins" },
},
})
-- set color theme depending on the current folder
require("autocolors")