feat(nvim): autoload color theme after plugin init
This commit is contained in:
parent
ef3514ea0b
commit
05ec3dc4b5
18
config/nvim/fnl/autocolors.fnl
Normal file
18
config/nvim/fnl/autocolors.fnl
Normal 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)
|
@ -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")
|
||||
|
@ -49,3 +49,6 @@ require("lazy").setup({
|
||||
{ import = "plugins" },
|
||||
},
|
||||
})
|
||||
|
||||
-- set color theme depending on the current folder
|
||||
require("autocolors")
|
||||
|
Loading…
Reference in New Issue
Block a user