✅ 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()
|
vim.cmd.qall()
|
||||||
end, { force = true })
|
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 --------------------------------
|
-- ------------------------------ Auto-Commands --------------------------------
|
||||||
-- Autosave Colorscheme
|
-- Autosave Colorscheme
|
||||||
-- When the colorscheme changes, store the name in .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
|
-- Set Default Leader Key
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
-- Restore Leader Key
|
-- Correct missing settings files
|
||||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.leader") == 1 then
|
require("config.check-files")
|
||||||
-- Load Stored Leader Key
|
|
||||||
vim.g.mapleader = vim.fn.readfile(vim.fn.stdpath("config") .. "/.leader")[1]
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Restore Colorscheme to variable
|
-- Load Stored Leader Key
|
||||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.colorscheme") == 1 then
|
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]
|
-- Load the stored colorscheme
|
||||||
else
|
STORED_THEME = vim.fn.readfile(vim.fn.stdpath("config") .. "/.colorscheme")[1]
|
||||||
-- Get the kitty theme
|
|
||||||
if os.getenv("KITTY_THEME") then
|
|
||||||
KITTY_THEME = os.getenv("KITTY_THEME")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ----------------------------------- LSP --------------------------------------
|
-- ----------------------------------- LSP --------------------------------------
|
||||||
vim.g.loaded_perl_provider = 0
|
vim.g.loaded_perl_provider = 0
|
||||||
|
|||||||
+6
-4
@@ -17,13 +17,15 @@ return {
|
|||||||
update_interval = 2000,
|
update_interval = 2000,
|
||||||
set_dark_mode = function()
|
set_dark_mode = function()
|
||||||
vim.o.background = "dark"
|
vim.o.background = "dark"
|
||||||
local kitty_theme = os.getenv("KITTY_THEME")
|
vim.cmd.colorscheme(
|
||||||
vim.cmd.colorscheme(kitty_theme or "catppuccin-frappe")
|
STORED_THEME or KITTY_THEME or "catppuccin-frappe" or "tokyonight"
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
set_light_mode = function()
|
set_light_mode = function()
|
||||||
vim.o.background = "light"
|
vim.o.background = "light"
|
||||||
local kitty_theme = os.getenv("KITTY_THEME")
|
vim.cmd.colorscheme(
|
||||||
vim.cmd.colorscheme(kitty_theme or "catppuccin-latte")
|
STORED_THEME or KITTY_THEME or "catppuccin-frappe" or "tokyonight"
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
cond = function() -- Not Using SSH
|
cond = function() -- Not Using SSH
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
-- -----------------------------------------------------------------------------
|
-- -----------------------------------------------------------------------------
|
||||||
-- ---------------------------------- USER -------------------------------------
|
-- ---------------------------------- USER -------------------------------------
|
||||||
-- -----------------------------------------------------------------------------
|
-- -----------------------------------------------------------------------------
|
||||||
|
--
|
||||||
-- ---------------------------------- STYLE ------------------------------------
|
-- ---------------------------------- STYLE ------------------------------------
|
||||||
----------------------------- Apply the colorscheme ----------------------------
|
----------------------------- Apply the colorscheme ----------------------------
|
||||||
-------- 1. Restore last colorscheme if it exists --------
|
-------- 1. Restore last colorscheme if it exists --------
|
||||||
|
|||||||
+15
-25
@@ -6,39 +6,33 @@ return {
|
|||||||
{
|
{
|
||||||
import = "lazyvim.plugins.extras.coding.codeium",
|
import = "lazyvim.plugins.extras.coding.codeium",
|
||||||
cond = function()
|
cond = function()
|
||||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") == 1 then
|
if
|
||||||
if
|
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
== "codeium"
|
||||||
== "codeium"
|
then
|
||||||
then
|
return true
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
import = "lazyvim.plugins.extras.coding.copilot",
|
import = "lazyvim.plugins.extras.coding.copilot",
|
||||||
cond = function()
|
cond = function()
|
||||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") == 1 then
|
if
|
||||||
if
|
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
== "copilot"
|
||||||
== "copilot"
|
then
|
||||||
then
|
return true
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
import = "lazyvim.plugins.extras.coding.tabnine",
|
import = "lazyvim.plugins.extras.coding.tabnine",
|
||||||
cond = function()
|
cond = function()
|
||||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.aitool") == 1 then
|
if
|
||||||
if
|
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
||||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.aitool")[1]
|
== "tabnine"
|
||||||
== "tabnine"
|
then
|
||||||
then
|
return true
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@@ -107,10 +101,6 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- {
|
|
||||||
-- "vim-scripts/AnsiEsc.vim",
|
|
||||||
-- event = "VeryLazy",
|
|
||||||
-- },
|
|
||||||
{
|
{
|
||||||
"shellRaining/hlchunk.nvim",
|
"shellRaining/hlchunk.nvim",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
|
|||||||
@@ -14,13 +14,11 @@ return {
|
|||||||
{
|
{
|
||||||
"wakatime/vim-wakatime",
|
"wakatime/vim-wakatime",
|
||||||
cond = function()
|
cond = function()
|
||||||
if vim.fn.filereadable(vim.fn.stdpath("config") .. "/.wakatime") == 1 then
|
if
|
||||||
if
|
vim.fn.readfile(vim.fn.stdpath("config") .. "/.wakatime")[1]
|
||||||
vim.fn.readfile(vim.fn.stdpath("config") .. "/.wakatime")[1]
|
== "true"
|
||||||
== "true"
|
then
|
||||||
then
|
return true
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user