[nvim] Add a new colors Lua module that deals with colors
it provides a single reloadColorscheme function that applies the colorscheme and a few of my own customizations.
This commit is contained in:
parent
e797d0d213
commit
19cf305d2b
2 changed files with 44 additions and 6 deletions
|
@ -1,16 +1,19 @@
|
||||||
-- Eryn Wells <eryn@erynwells.me>
|
-- Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
vim.opt.runtimepath:prepend "~/.vim"
|
vim.opt.runtimepath:prepend "~/.vim"
|
||||||
vim.cmd [[ source ~/.vimrc.common ]]
|
|
||||||
|
vim.cmd [[
|
||||||
|
source ~/.vimrc.common
|
||||||
|
source ~/.vim/plugins.vim
|
||||||
|
]]
|
||||||
|
|
||||||
require 'configuration'
|
require 'configuration'
|
||||||
|
require 'colors'
|
||||||
require 'keys'
|
require 'keys'
|
||||||
require 'os'
|
require 'os'
|
||||||
|
|
||||||
vim.cmd [[ source ~/.vim/plugins.vim ]]
|
function ensureMetadataDirectoriesExist()
|
||||||
|
local paths = {
|
||||||
function ensure_metadata_directories_exist()
|
|
||||||
paths = {
|
|
||||||
vim.opt.backupdir:get(),
|
vim.opt.backupdir:get(),
|
||||||
vim.opt.directory:get(),
|
vim.opt.directory:get(),
|
||||||
vim.opt.undodir:get()
|
vim.opt.undodir:get()
|
||||||
|
@ -24,4 +27,4 @@ function ensure_metadata_directories_exist()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ensure_metadata_directories_exist()
|
ensureMetadataDirectoriesExist()
|
||||||
|
|
35
config/nvim/lua/colors.lua
Normal file
35
config/nvim/lua/colors.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
-- Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
|
-- Allow using GUI style colors (#RRGGBB hex codes) in color terminals. This is
|
||||||
|
-- required for most modern color themes.
|
||||||
|
vim.g.termguicolors = true
|
||||||
|
|
||||||
|
function reloadColorscheme(colorschemeName)
|
||||||
|
vim.cmd {
|
||||||
|
cmd = "colorscheme",
|
||||||
|
args = {colorschemeName},
|
||||||
|
}
|
||||||
|
|
||||||
|
if vim.env.TERM_PROGRAM == "Apple_Terminal" then
|
||||||
|
-- Add a correction for Apple's Terminal.app, which doesn't support
|
||||||
|
-- 24-bit colors and needs some adjustment to cope.
|
||||||
|
vim.cmd [[
|
||||||
|
highlight default Folded cterm=bold term=bold ctermfg=NONE ctermbg=NONE
|
||||||
|
highlight default CursorLine term=underline cterm=NONE ctermbg=0
|
||||||
|
highlight default CursorLineNr term=underline cterm=NONE ctermfg=7 ctermbg=0
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.g.colors_name == "witchhazel" then
|
||||||
|
vim.cmd [[
|
||||||
|
highlight! default link LineNr CursorLineNr
|
||||||
|
highlight! default link CursorLineNr CursorLine
|
||||||
|
]]
|
||||||
|
elseif vim.g.colors_name == "dracula" then
|
||||||
|
vim.cmd [[
|
||||||
|
highlight CursorLineNr guibg=#44475a
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
reloadColorscheme("dracula")
|
Loading…
Add table
Add a link
Reference in a new issue