Colors fix

Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2024-07-18 00:45:18 +01:00
parent ff2f75ba8c
commit a069cee0c1
Signed by: TiagoRG
GPG Key ID: FF0A53A30B1ADF82
2 changed files with 7 additions and 3 deletions

View File

@ -1,10 +1,14 @@
local path = vim.fn.stdpath('config')
local absolute_path = vim.loop.fs_realpath(path) or path
local colorscheme_file = absolute_path .. "/data/colorscheme.txt"
local function trim(str)
return str:gsub("^%s*(.-)%s*$", "%1")
end
function LoadColors()
local color = nil
local file = io.open("/home/tiagorg/.dotfiles/.config/nvim/data/colorscheme.txt", "r")
local file = io.open(colorscheme_file, "r")
-- check if file exists
if file == nil then
@ -30,8 +34,9 @@ end
function OnColorschemeChanged()
local newColorscheme = vim.g.colors_name
local file = io.open("/home/tiagorg/.dotfiles/.config/nvim/data/colorscheme.txt", "w")
local file = io.open(colorscheme_file, "w+")
if file == nil then
vim.loop.fs_mkdir(absolute_path .. "/data", 511, OnColorschemeChanged)
return
end
file:write(newColorscheme)

View File

@ -6,4 +6,3 @@ require('tiagorg.colors')
require('Comment').setup()
require("nvim-surround").setup()
vim.g.nvim_config_path = vim.fn.stdpath('config')