Colors fix
Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
parent
ff2f75ba8c
commit
a069cee0c1
|
@ -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)
|
local function trim(str)
|
||||||
return str:gsub("^%s*(.-)%s*$", "%1")
|
return str:gsub("^%s*(.-)%s*$", "%1")
|
||||||
end
|
end
|
||||||
|
|
||||||
function LoadColors()
|
function LoadColors()
|
||||||
local color = nil
|
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
|
-- check if file exists
|
||||||
if file == nil then
|
if file == nil then
|
||||||
|
@ -30,8 +34,9 @@ end
|
||||||
function OnColorschemeChanged()
|
function OnColorschemeChanged()
|
||||||
local newColorscheme = vim.g.colors_name
|
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
|
if file == nil then
|
||||||
|
vim.loop.fs_mkdir(absolute_path .. "/data", 511, OnColorschemeChanged)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
file:write(newColorscheme)
|
file:write(newColorscheme)
|
||||||
|
|
|
@ -6,4 +6,3 @@ require('tiagorg.colors')
|
||||||
require('Comment').setup()
|
require('Comment').setup()
|
||||||
require("nvim-surround").setup()
|
require("nvim-surround").setup()
|
||||||
|
|
||||||
vim.g.nvim_config_path = vim.fn.stdpath('config')
|
|
||||||
|
|
Loading…
Reference in New Issue