diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-01 01:33:01 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-01 01:35:20 +0200 |
commit | 3201478b5ed74340820c66a05eb34ae39d0c9fa0 (patch) | |
tree | b7d386160dbb148754d1fff66cb76b6412ab95c4 | |
parent | 2af06d6e050b1653bd4e085e27262738ec7da136 (diff) |
make NERDTree have own background color
-rw-r--r-- | lua/autocommands/NERDTree.lua | 2 | ||||
-rw-r--r-- | lua/functions.lua | 10 | ||||
-rw-r--r-- | lua/maps/NERDtree.lua | 2 | ||||
-rw-r--r-- | lua/style.lua | 3 |
4 files changed, 14 insertions, 3 deletions
diff --git a/lua/autocommands/NERDTree.lua b/lua/autocommands/NERDTree.lua index 38213e2..9e0acab 100644 --- a/lua/autocommands/NERDTree.lua +++ b/lua/autocommands/NERDTree.lua @@ -1 +1 @@ -autocmd("VimEnter", "*", "NERDTree") +autocmd("VimEnter", "*", "lua toggle_nerdtree()") diff --git a/lua/functions.lua b/lua/functions.lua index 7d95ac3..0030b6c 100644 --- a/lua/functions.lua +++ b/lua/functions.lua @@ -81,6 +81,16 @@ function _G.toggle_terminal() end end +function _G.toggle_nerdtree() + vim.cmd("NERDTreeToggle") + + vim.api.nvim_win_set_option( + vim.fn.win_getid(), + "winhighlight", + "Normal:NERDTreeWindow" + ) +end + function _G.get_current_file() return vim.fn.expand("%") end diff --git a/lua/maps/NERDtree.lua b/lua/maps/NERDtree.lua index 15c933d..c89623c 100644 --- a/lua/maps/NERDtree.lua +++ b/lua/maps/NERDtree.lua @@ -1,2 +1,2 @@ -vim.api.nvim_set_keymap("n", "<C-e>", ":NERDTreeToggle<CR>", +vim.api.nvim_set_keymap("n", "<C-e>", ":lua toggle_nerdtree()<CR>", {silent = true, noremap = true}) diff --git a/lua/style.lua b/lua/style.lua index 7e329b5..d13ecaa 100644 --- a/lua/style.lua +++ b/lua/style.lua @@ -4,7 +4,8 @@ ayu_colors.generate() -- Pass `true` to enable mirage require('ayu').setup({ overrides = { - WinSeparator = { fg = ayu_colors.bg, bg = ayu_colors.bg } + WinSeparator = { fg = ayu_colors.bg, bg = ayu_colors.bg }, + NERDTreeWindow = { fg = ayu_colors.fg, bg = ayu_colors.panel_bg } } }) |