✅ Checks for .settings files
- Checks for missing files and creates them - More efficient handling of those settings
This commit is contained in:
@@ -9,6 +9,13 @@ vim.api.nvim_create_user_command("Q", function()
|
||||
vim.cmd.qall()
|
||||
end, { force = true })
|
||||
|
||||
-- Restore Colorscheme
|
||||
vim.api.nvim_create_user_command("RestoreColorscheme", function()
|
||||
vim.cmd.colorscheme(
|
||||
STORED_THEME or KITTY_THEME or "catppuccin-frappe" or "tokyonight"
|
||||
)
|
||||
end, { force = true })
|
||||
|
||||
-- ------------------------------ Auto-Commands --------------------------------
|
||||
-- Autosave Colorscheme
|
||||
-- When the colorscheme changes, store the name in .colorscheme
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ------------------------------ CHECK-FILES ----------------------------------
|
||||
-- -----------------------------------------------------------------------------
|
||||
----- Verify settings files exist and create them if they don't exist -----
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
-- Check if the .leader file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.leader") ~= 1 then
|
||||
vim.fn.writefile({ vim.g.mapleader }, vim.fn.stdpath("config") .. "/.leader")
|
||||
end
|
||||
|
||||
-- Check if the .colorscheme file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.colorscheme") ~= 1 then
|
||||
-- Use the kitty theme
|
||||
if os.getenv("KITTY_THEME") then
|
||||
KITTY_THEME = os.getenv("KITTY_THEME")
|
||||
vim.fn.writefile(
|
||||
{ KITTY_THEME },
|
||||
vim.fn.stdpath("config") .. "/.colorscheme"
|
||||
)
|
||||
else
|
||||
-- Use the default colorscheme
|
||||
vim.fn.writefile(
|
||||
{ vim.g.colors_name },
|
||||
vim.fn.stdpath("config") .. "/.colorscheme"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if the .aitool file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") ~= 1 then
|
||||
vim.fn.writefile({ "codeium" }, vim.fn.stdpath("config") .. "/.aitool")
|
||||
end
|
||||
|
||||
-- Check if the .useimage file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.useimage") ~= 1 then
|
||||
vim.fn.writefile({ "true" }, vim.fn.stdpath("config") .. "/.useimage")
|
||||
end
|
||||
|
||||
-- Check if the .wakatime file exists
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.wakatime") ~= 1 then
|
||||
vim.fn.writefile({ "true" }, vim.fn.stdpath("config") .. "/.wakatime")
|
||||
end
|
||||
+7
-15
@@ -5,22 +5,14 @@
|
||||
-- Set Default Leader Key
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Restore Leader Key
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.leader") == 1 then
|
||||
-- Load Stored Leader Key
|
||||
vim.g.mapleader = vim.fn.readfile(vim.fn.stdpath("config") .. "/.leader")[1]
|
||||
end
|
||||
-- Correct missing settings files
|
||||
require("config.check-files")
|
||||
|
||||
-- Restore Colorscheme to variable
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.colorscheme") == 1 then
|
||||
-- Load the stored colorscheme
|
||||
STORED_THEME = vim.fn.readfile(vim.fn.stdpath("config") .. "/.colorscheme")[1]
|
||||
else
|
||||
-- Get the kitty theme
|
||||
if os.getenv("KITTY_THEME") then
|
||||
KITTY_THEME = os.getenv("KITTY_THEME")
|
||||
end
|
||||
end
|
||||
-- Load Stored Leader Key
|
||||
vim.g.mapleader = vim.fn.readfile(vim.fn.stdpath("config") .. "/.leader")[1]
|
||||
|
||||
-- Load the stored colorscheme
|
||||
STORED_THEME = vim.fn.readfile(vim.fn.stdpath("config") .. "/.colorscheme")[1]
|
||||
|
||||
-- ----------------------------------- LSP --------------------------------------
|
||||
vim.g.loaded_perl_provider = 0
|
||||
|
||||
+6
-4
@@ -17,13 +17,15 @@ return {
|
||||
update_interval = 2000,
|
||||
set_dark_mode = function()
|
||||
vim.o.background = "dark"
|
||||
local kitty_theme = os.getenv("KITTY_THEME")
|
||||
vim.cmd.colorscheme(kitty_theme or "catppuccin-frappe")
|
||||
vim.cmd.colorscheme(
|
||||
STORED_THEME or KITTY_THEME or "catppuccin-frappe" or "tokyonight"
|
||||
)
|
||||
end,
|
||||
set_light_mode = function()
|
||||
vim.o.background = "light"
|
||||
local kitty_theme = os.getenv("KITTY_THEME")
|
||||
vim.cmd.colorscheme(kitty_theme or "catppuccin-latte")
|
||||
vim.cmd.colorscheme(
|
||||
STORED_THEME or KITTY_THEME or "catppuccin-frappe" or "tokyonight"
|
||||
)
|
||||
end,
|
||||
},
|
||||
cond = function() -- Not Using SSH
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
-- -----------------------------------------------------------------------------
|
||||
-- ---------------------------------- USER -------------------------------------
|
||||
-- -----------------------------------------------------------------------------
|
||||
|
||||
--
|
||||
-- ---------------------------------- STYLE ------------------------------------
|
||||
----------------------------- Apply the colorscheme ----------------------------
|
||||
-------- 1. Restore last colorscheme if it exists --------
|
||||
|
||||
+15
-25
@@ -6,39 +6,33 @@ return {
|
||||
{
|
||||
import = "lazyvim.plugins.extras.coding.codeium",
|
||||
cond = function()
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") == 1 then
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||
== "codeium"
|
||||
then
|
||||
return true
|
||||
end
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||
== "codeium"
|
||||
then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
import = "lazyvim.plugins.extras.coding.copilot",
|
||||
cond = function()
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") == 1 then
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||
== "copilot"
|
||||
then
|
||||
return true
|
||||
end
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||
== "copilot"
|
||||
then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
import = "lazyvim.plugins.extras.coding.tabnine",
|
||||
cond = function()
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") == 1 then
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||
== "tabnine"
|
||||
then
|
||||
return true
|
||||
end
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||
== "tabnine"
|
||||
then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -107,10 +101,6 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
-- {
|
||||
-- "vim-scripts/AnsiEsc.vim",
|
||||
-- event = "VeryLazy",
|
||||
-- },
|
||||
{
|
||||
"shellRaining/hlchunk.nvim",
|
||||
event = "BufEnter",
|
||||
|
||||
@@ -14,13 +14,11 @@ return {
|
||||
{
|
||||
"wakatime/vim-wakatime",
|
||||
cond = function()
|
||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.wakatime") == 1 then
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.wakatime")[1]
|
||||
== "true"
|
||||
then
|
||||
return true
|
||||
end
|
||||
if
|
||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.wakatime")[1]
|
||||
== "true"
|
||||
then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user