color init in lua
This commit is contained in:
parent
3e1ce735b9
commit
6d9831b2a5
@ -18,8 +18,6 @@
|
|||||||
- [x] Mouse support
|
- [x] Mouse support
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- [ ] handle colorscheme better (right now its based on random global variables that might not be loaded at vim start)
|
|
||||||
|
|
||||||
- [ ] handle permissions properly (TODO: display error on Read access denied)
|
- [ ] handle permissions properly (TODO: display error on Read access denied)
|
||||||
- [ ] buffer / window should not disappear when only the tree is opened
|
- [ ] buffer / window should not disappear when only the tree is opened
|
||||||
- [ ] buffer / window should always stay on the left and never change size (open a file with only the tree open to reproduce this bug)
|
- [ ] buffer / window should always stay on the left and never change size (open a file with only the tree open to reproduce this bug)
|
||||||
@ -27,3 +25,4 @@
|
|||||||
- [ ] handle symbolic links
|
- [ ] handle symbolic links
|
||||||
- [ ] quickly find file in the directory structure
|
- [ ] quickly find file in the directory structure
|
||||||
- [ ] update tree automatically on window change
|
- [ ] update tree automatically on window change
|
||||||
|
|
||||||
|
|||||||
59
lua/lib/colors.lua
Normal file
59
lua/lib/colors.lua
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
local cmd = vim.api.nvim_command
|
||||||
|
local get = vim.api.nvim_get_var
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
red = get('terminal_color_1') or 'red',
|
||||||
|
green = get('terminal_color_2') or 'green',
|
||||||
|
yellow = get('terminal_color_3') or 'yellow',
|
||||||
|
blue = get('terminal_color_4') or 'blue',
|
||||||
|
purple = get('terminal_color_5') or 'purple',
|
||||||
|
cyan = get('terminal_color_6') or 'cyan',
|
||||||
|
orange = get('terminal_color_11') or 'orange',
|
||||||
|
dark_red = get('terminal_color_9') or 'dark red',
|
||||||
|
lua = '#2947b1'
|
||||||
|
}
|
||||||
|
|
||||||
|
local HIGHLIGHTS = {
|
||||||
|
FolderName = { gui = 'bold', fg = colors.blue },
|
||||||
|
FolderIcon = { fg = colors.orange },
|
||||||
|
|
||||||
|
ExecFile = { gui = 'bold', fg = colors.green },
|
||||||
|
SpecialFile = { gui = 'bold,underline', fg = colors.yellow },
|
||||||
|
ImageFile = { gui = 'bold', fg = colors.blue },
|
||||||
|
MarkdownFile = { fg = colors.purple },
|
||||||
|
LicenseFile = { fg = colors.yellow },
|
||||||
|
YamlFile = { fg = colors.yellow },
|
||||||
|
TomlFile = { fg = colors.yellow },
|
||||||
|
GitignoreFile = { fg = colors.yellow },
|
||||||
|
JsonFile = { fg = colors.yellow },
|
||||||
|
|
||||||
|
LuaFile = { fg = colors.lua },
|
||||||
|
PythonFile = { fg = colors.green },
|
||||||
|
ShellFile = { fg = colors.green },
|
||||||
|
JavascriptFile = { fg = colors.yellow },
|
||||||
|
CFile = { fg = colors.blue },
|
||||||
|
ReactFile = { fg = colors.cyan },
|
||||||
|
HtmlFile = { fg = colors.orange },
|
||||||
|
RustFile = { fg = colors.orange },
|
||||||
|
VimFile = { fg = colors.green },
|
||||||
|
TypescriptFile = { fg = colors.blue },
|
||||||
|
|
||||||
|
GitDirty = { fg = colors.dark_red },
|
||||||
|
GitStaged = { fg = colors.green },
|
||||||
|
GitMerge = { fg = colors.orange },
|
||||||
|
GitRenamed = { fg = colors.purple },
|
||||||
|
GitNew = { fg = colors.yellow },
|
||||||
|
|
||||||
|
EndOfBuffer = { fg = 'bg' }
|
||||||
|
}
|
||||||
|
|
||||||
|
local function init_colors()
|
||||||
|
for k, d in pairs(HIGHLIGHTS) do
|
||||||
|
local gui = d.gui or 'NONE'
|
||||||
|
vim.api.nvim_command('hi def LuaTree'..k..' gui='..gui..' guifg='..d.fg)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
init_colors = init_colors
|
||||||
|
}
|
||||||
@ -27,6 +27,8 @@ local git = require 'lib/git'
|
|||||||
local refresh_git = git.refresh_git
|
local refresh_git = git.refresh_git
|
||||||
local force_refresh_git = git.force_refresh_git
|
local force_refresh_git = git.force_refresh_git
|
||||||
|
|
||||||
|
require 'lib/colors'.init_colors()
|
||||||
|
|
||||||
init_tree()
|
init_tree()
|
||||||
|
|
||||||
local function toggle()
|
local function toggle()
|
||||||
|
|||||||
@ -7,56 +7,6 @@ let g:loaded_netrw = 1
|
|||||||
let g:loaded_netrwPlugin = 1 " Disable netrw
|
let g:loaded_netrwPlugin = 1 " Disable netrw
|
||||||
|
|
||||||
hi def link LuaTreePopup Normal
|
hi def link LuaTreePopup Normal
|
||||||
hi def LuaTreeEndOfBuffer guifg=bg
|
|
||||||
|
|
||||||
if exists('g:terminal_color_0')
|
|
||||||
let s:bg = g:terminal_color_0
|
|
||||||
let s:fg = g:terminal_color_7
|
|
||||||
|
|
||||||
let s:red = g:terminal_color_1
|
|
||||||
let s:green = g:terminal_color_2
|
|
||||||
let s:yellow = g:terminal_color_3
|
|
||||||
let s:blue = g:terminal_color_4
|
|
||||||
let s:purple = g:terminal_color_5
|
|
||||||
let s:cyan = g:terminal_color_6
|
|
||||||
let s:orange = g:terminal_color_11
|
|
||||||
|
|
||||||
let s:dark_red = g:terminal_color_9
|
|
||||||
let s:visual_grey = g:terminal_color_8
|
|
||||||
let s:comment_grey = g:terminal_color_15
|
|
||||||
let s:luacolor = '#2947b1'
|
|
||||||
|
|
||||||
execute 'hi def LuaTreeFolderName gui=bold guifg='.s:blue
|
|
||||||
execute 'hi def LuaTreeFolderIcon guifg='.s:orange
|
|
||||||
|
|
||||||
execute 'hi def LuaTreeExecFile gui=bold guifg='.s:green
|
|
||||||
execute 'hi def LuaTreeSpecialFile gui=bold,underline guifg='.s:yellow
|
|
||||||
execute 'hi def LuaTreeImageFile gui=bold guifg='.s:purple
|
|
||||||
|
|
||||||
execute 'hi def LuaTreeMarkdownFile guifg='.s:purple
|
|
||||||
execute 'hi def LuaTreeLicenseFile guifg='.s:yellow
|
|
||||||
execute 'hi def LuaTreeYamlFile guifg='.s:yellow
|
|
||||||
execute 'hi def LuaTreeTomlFile guifg='.s:yellow
|
|
||||||
execute 'hi def LuaTreeGitignoreFile guifg='.s:yellow
|
|
||||||
execute 'hi def LuaTreeJsonFile guifg='.s:yellow
|
|
||||||
|
|
||||||
execute 'hi def LuaTreeLuaFile guifg='s:luacolor
|
|
||||||
execute 'hi def LuaTreePythonFile guifg='.s:green
|
|
||||||
execute 'hi def LuaTreeShellFile guifg='.s:green
|
|
||||||
execute 'hi def LuaTreeJavascriptFile guifg='.s:yellow
|
|
||||||
execute 'hi def LuaTreeCFile guifg='.s:blue
|
|
||||||
execute 'hi def LuaTreeReactFile guifg='.s:cyan
|
|
||||||
execute 'hi def LuaTreeHtmlFile guifg='.s:orange
|
|
||||||
execute 'hi def LuaTreeRustFile guifg='.s:orange
|
|
||||||
execute 'hi def LuaTreeVimFile guifg='.s:green
|
|
||||||
execute 'hi def LuaTreeTypescriptFile guifg='.s:blue
|
|
||||||
|
|
||||||
execute 'hi def LuaTreeGitDirty guifg='.s:dark_red
|
|
||||||
execute 'hi def LuaTreeGitStaged guifg='.s:green
|
|
||||||
execute 'hi def LuaTreeGitMerge guifg='.s:orange
|
|
||||||
execute 'hi def LuaTreeGitRenamed guifg='.s:purple
|
|
||||||
execute 'hi def LuaTreeGitNew guifg='.s:yellow
|
|
||||||
endif
|
|
||||||
|
|
||||||
au BufWritePost * lua require'tree'.refresh()
|
au BufWritePost * lua require'tree'.refresh()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user