From 5aa7382d57de224b250caa89f329769c1542f330 Mon Sep 17 00:00:00 2001
From: SinTan1729 <sayantan.santra689@gmail.com>
Date: Wed, 20 Mar 2024 22:28:42 -0500
Subject: [PATCH] chg: Split global configs out and use load modules in the lua
 way

---
 laptop/globals.lua | 35 +++++++++++++++++++++++++++++++++++
 laptop/init.lua    | 46 +++++++---------------------------------------
 server/globals.lua | 29 +++++++++++++++++++++++++++++
 server/init.lua    | 40 +++++++---------------------------------
 vps/globals.lua    | 37 +++++++++++++++++++++++++++++++++++++
 vps/init.lua       | 40 +++++++---------------------------------
 6 files changed, 122 insertions(+), 105 deletions(-)
 create mode 100644 laptop/globals.lua
 create mode 100644 server/globals.lua
 create mode 100644 vps/globals.lua

diff --git a/laptop/globals.lua b/laptop/globals.lua
new file mode 100644
index 0000000..e1d05ff
--- /dev/null
+++ b/laptop/globals.lua
@@ -0,0 +1,35 @@
+-- This file defines all the global config
+local set = vim.opt
+
+-- Turn on numbers
+set.number = true
+-- Turn off line wrapping
+set.wrap = false
+-- Disable cmdline from bottom
+set.cmdheight = 0
+-- Ignore case while searching except when the search term contains capital letters
+set.ignorecase = true
+set.smartcase = true
+-- Use 4 spaces and properly adjust them for files using TAB
+set.tabstop = 4
+set.shiftwidth = 4
+set.softtabstop = 4
+set.expandtab = true
+-- Show LSP signs in the number column
+set.signcolumn = 'number'
+-- Turn on spell checking
+set.spell = true
+-- Enable mouse support
+set.mouse = 'n'
+-- Enable programming dictionary
+set.spelllang = { "en", "programming" }
+-- Use ctrl-[hjkl] to select the active split
+
+-- Disable unused plugins
+vim.g.loaded_perl_provider = 0
+vim.g.loaded_node_provider = 0
+vim.g.loaded_ruby_provider = 0
+
+-- Load UltiSnips snippets from custom-snippets directory
+vim.g.UltiSnipsSnippetDirectories = { "custom-snippets", "UltiSnips" }
+
diff --git a/laptop/init.lua b/laptop/init.lua
index 403e54e..5ac96ac 100644
--- a/laptop/init.lua
+++ b/laptop/init.lua
@@ -1,42 +1,10 @@
-local set = vim.opt
-
--- Turn on numbers
-set.number = true
--- Turn off line wrapping
-set.wrap = false
--- Disable cmdline from bottom
-set.cmdheight = 0
--- Ignore case while searching except when the search term contains capital letters
-set.ignorecase = true
-set.smartcase = true
--- Use 4 spaces and properly adjust them for files using TAB
-set.tabstop = 4
-set.shiftwidth = 4
-set.softtabstop = 4
-set.expandtab = true
--- Show LSP signs in the number column
-set.signcolumn = 'number'
--- Turn on spell checking
-set.spell = true
--- Enable mouse support
-set.mouse = 'n'
--- Enable programming dictionary
-set.spelllang = { "en", "programming" }
--- Use ctrl-[hjkl] to select the active split
-
--- Disable unused plugins
-vim.g.loaded_perl_provider = 0
-vim.g.loaded_node_provider = 0
-vim.g.loaded_ruby_provider = 0
-
--- Load UltiSnips snippets from custom-snippets directory
-vim.g.UltiSnipsSnippetDirectories = { "custom-snippets", "UltiSnips" }
-
--- Load keymaps
-local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua"
-vim.cmd.source(keymaps)
+-- Load the different config files
+package.path = package.path .. ';' .. vim.fn.stdpath("config") .. "/?.lua"
 
+-- Load global configs
+require("globals")
 -- Load plugins using paq-nvim
-local paq = vim.fn.stdpath("config") .. "/paq.lua"
-vim.cmd.source(paq)
+require("paq")
+-- Load keymaps
+require("keymaps")
 
diff --git a/server/globals.lua b/server/globals.lua
new file mode 100644
index 0000000..e8d237c
--- /dev/null
+++ b/server/globals.lua
@@ -0,0 +1,29 @@
+-- This file defines all the global configs
+local set = vim.opt
+
+-- Turn on numbers
+set.number = true
+-- Turn off line wrapping
+set.wrap = false
+-- Disable cmdline from bottom
+set.cmdheight = 0
+-- Ignore case while searching except when the search term contains capital letters
+set.ignorecase = true
+set.smartcase = true
+-- Use 4 spaces and properly adjust them for files using TAB
+set.tabstop = 4
+set.shiftwidth = 4
+set.softtabstop = 4
+set.expandtab = true
+-- Turn on spell checking
+set.spell = true
+-- Enable mouse support
+set.mouse = 'n'
+-- Enable programming dictionary
+set.spelllang = { "en", "programming" }
+
+-- Disable unused plugins
+vim.g.loaded_perl_provider = 0
+vim.g.loaded_node_provider = 0
+vim.g.loaded_ruby_provider = 0
+
diff --git a/server/init.lua b/server/init.lua
index 4c75f54..5ac96ac 100644
--- a/server/init.lua
+++ b/server/init.lua
@@ -1,36 +1,10 @@
-local set = vim.opt
-
--- Turn on numbers
-set.number = true
--- Turn off line wrapping
-set.wrap = false
--- Disable cmdline from bottom
-set.cmdheight = 0
--- Ignore case while searching except when the search term contains capital letters
-set.ignorecase = true
-set.smartcase = true
--- Use 4 spaces and properly adjust them for files using TAB
-set.tabstop = 4
-set.shiftwidth = 4
-set.softtabstop = 4
-set.expandtab = true
--- Turn on spell checking
-set.spell = true
--- Enable mouse support
-set.mouse = 'n'
--- Enable programming dictionary
-set.spelllang = { "en", "programming" }
-
--- Disable unused plugins
-vim.g.loaded_perl_provider = 0
-vim.g.loaded_node_provider = 0
-vim.g.loaded_ruby_provider = 0
-
--- Load keymaps
-local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua"
-vim.cmd.source(keymaps)
+-- Load the different config files
+package.path = package.path .. ';' .. vim.fn.stdpath("config") .. "/?.lua"
 
+-- Load global configs
+require("globals")
 -- Load plugins using paq-nvim
-local paq = vim.fn.stdpath("config") .. "/paq.lua"
-vim.cmd.source(paq)
+require("paq")
+-- Load keymaps
+require("keymaps")
 
diff --git a/vps/globals.lua b/vps/globals.lua
new file mode 100644
index 0000000..c9294ca
--- /dev/null
+++ b/vps/globals.lua
@@ -0,0 +1,37 @@
+-- This file defines all the global configs
+local set = vim.opt
+
+-- Turn on numbers
+set.number = true
+-- Turn off line wrapping
+set.wrap = false
+-- Disable cmdline from bottom
+set.cmdheight = 0
+-- Ignore case while searching except when the search term contains capital letters
+set.ignorecase = true
+set.smartcase = true
+-- Use 4 spaces and properly adjust them for files using TAB
+set.tabstop = 4
+set.shiftwidth = 4
+set.softtabstop = 4
+set.expandtab = true
+-- Turn on spell checking
+set.spell = true
+-- Enable mouse support
+set.mouse = 'n'
+-- Enable programming dictionary
+set.spelllang = { "en", "programming" }
+
+-- Disable unused plugins
+vim.g.loaded_perl_provider = 0
+vim.g.loaded_node_provider = 0
+vim.g.loaded_ruby_provider = 0
+
+-- Load keymaps
+local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua"
+vim.cmd.source(keymaps)
+
+-- Load plugins using paq-nvim
+local paq = vim.fn.stdpath("config") .. "/paq.lua"
+vim.cmd.source(paq)
+
diff --git a/vps/init.lua b/vps/init.lua
index 4c75f54..5ac96ac 100644
--- a/vps/init.lua
+++ b/vps/init.lua
@@ -1,36 +1,10 @@
-local set = vim.opt
-
--- Turn on numbers
-set.number = true
--- Turn off line wrapping
-set.wrap = false
--- Disable cmdline from bottom
-set.cmdheight = 0
--- Ignore case while searching except when the search term contains capital letters
-set.ignorecase = true
-set.smartcase = true
--- Use 4 spaces and properly adjust them for files using TAB
-set.tabstop = 4
-set.shiftwidth = 4
-set.softtabstop = 4
-set.expandtab = true
--- Turn on spell checking
-set.spell = true
--- Enable mouse support
-set.mouse = 'n'
--- Enable programming dictionary
-set.spelllang = { "en", "programming" }
-
--- Disable unused plugins
-vim.g.loaded_perl_provider = 0
-vim.g.loaded_node_provider = 0
-vim.g.loaded_ruby_provider = 0
-
--- Load keymaps
-local keymaps = vim.fn.stdpath("config") .. "/keymaps.lua"
-vim.cmd.source(keymaps)
+-- Load the different config files
+package.path = package.path .. ';' .. vim.fn.stdpath("config") .. "/?.lua"
 
+-- Load global configs
+require("globals")
 -- Load plugins using paq-nvim
-local paq = vim.fn.stdpath("config") .. "/paq.lua"
-vim.cmd.source(paq)
+require("paq")
+-- Load keymaps
+require("keymaps")