summaryrefslogtreecommitdiff
path: root/nvim/.config
diff options
context:
space:
mode:
authorbh <qn+git@epicurus.dev>2025-12-05 20:22:13 +0800
committerbh <qn+git@epicurus.dev>2025-12-05 20:22:13 +0800
commitfd6695cc6782535d30b40b0aa255ca5f3e0769f3 (patch)
tree0307643614f4d157fe73bb226713678d9f1cc3c8 /nvim/.config
Initial Commit
Diffstat (limited to 'nvim/.config')
-rw-r--r--nvim/.config/nvim/init.lua194
-rw-r--r--nvim/.config/nvim/lazy-lock.json34
-rw-r--r--nvim/.config/nvim/lua/config/.bak/.luasnip.bak.bak56
-rw-r--r--nvim/.config/nvim/lua/config/.bak/.neovide.lua.bak81
-rw-r--r--nvim/.config/nvim/lua/config/.bak/dashboard.lua.bak109
-rw-r--r--nvim/.config/nvim/lua/config/.bak/dashboard2.lua.bak122
-rw-r--r--nvim/.config/nvim/lua/config/.bak/greeter.lua.bak5
-rw-r--r--nvim/.config/nvim/lua/config/.bak/keybindings.lua.bak19
-rw-r--r--nvim/.config/nvim/lua/config/.bak/theme.lua.bak2
-rw-r--r--nvim/.config/nvim/lua/config/colorpicker.lua16
-rw-r--r--nvim/.config/nvim/lua/config/completion.lua59
-rw-r--r--nvim/.config/nvim/lua/config/dashboard.lua84
-rw-r--r--nvim/.config/nvim/lua/config/hex.lua24
-rw-r--r--nvim/.config/nvim/lua/config/indent.lua39
-rw-r--r--nvim/.config/nvim/lua/config/lazy.lua35
-rw-r--r--nvim/.config/nvim/lua/config/lsp.lua116
-rw-r--r--nvim/.config/nvim/lua/config/luasnip.lua36
-rw-r--r--nvim/.config/nvim/lua/config/statusline.lua76
-rw-r--r--nvim/.config/nvim/lua/config/tabs.lua81
-rw-r--r--nvim/.config/nvim/lua/config/telescope.lua0
-rw-r--r--nvim/.config/nvim/lua/config/tree.lua29
-rw-r--r--nvim/.config/nvim/lua/config/treesitter.lua69
-rw-r--r--nvim/.config/nvim/lua/config/vimtex.lua30
-rw-r--r--nvim/.config/nvim/lua/plugins/.bak/.init.lua.bak119
-rw-r--r--nvim/.config/nvim/lua/plugins/.bak/old.lua.bak104
-rw-r--r--nvim/.config/nvim/lua/plugins/init.lua134
-rw-r--r--nvim/.config/nvim/lua/plugins/test.c114
27 files changed, 1787 insertions, 0 deletions
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua
new file mode 100644
index 0000000..ae8446f
--- /dev/null
+++ b/nvim/.config/nvim/init.lua
@@ -0,0 +1,194 @@
+-- ░██████╗░██╗░░░██╗██╗██╗░░██╗░█████╗░████████╗██╗░█████╗░░░░░░░███╗░░██╗██╗░░░██╗██╗███╗░░░███╗
+-- ██╔═══██╗██║░░░██║██║╚██╗██╔╝██╔══██╗╚══██╔══╝██║██╔══██╗░░░░░░████╗░██║██║░░░██║██║████╗░████║
+-- ██║██╗██║██║░░░██║██║░╚███╔╝░██║░░██║░░░██║░░░██║██║░░╚═╝█████╗██╔██╗██║╚██╗░██╔╝██║██╔████╔██║
+-- ╚██████╔╝██║░░░██║██║░██╔██╗░██║░░██║░░░██║░░░██║██║░░██╗╚════╝██║╚████║░╚████╔╝░██║██║╚██╔╝██║
+-- ░╚═██╔═╝░╚██████╔╝██║██╔╝╚██╗╚█████╔╝░░░██║░░░██║╚█████╔╝░░░░░░██║░╚███║░░╚██╔╝░░██║██║░╚═╝░██║
+-- ░░░╚═╝░░░░╚═════╝░╚═╝╚═╝░░╚═╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░░░░░░░╚═╝░░╚══╝░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝
+--
+-- By QuixoticNapoleon
+
+--------------------------------------------------------
+-- 🪶 Plugins
+--------------------------------------------------------
+
+require("config.lazy")
+
+--------------------------------------------------------
+-- 🪶 Theme
+--------------------------------------------------------
+
+local dark_teal = "#003636"
+vim.cmd("colorscheme terafox")
+
+--------------------------------------------------------
+-- 🪶 Basic Settings
+--------------------------------------------------------
+
+-- List Chars
+vim.o.list = true
+vim.opt.listchars = {
+ -- tab = "»·",
+ tab = "│»",
+ space = "·",
+ trail = "·",
+ eol = "↲",
+ extends = "›",
+ precedes = "‹",
+ nbsp = "␣",
+}
+
+-- Enable wrapping
+vim.opt.wrap = true
+
+-- Break lines at word boundaries
+vim.opt.linebreak = true
+
+-- Prefix shown on wrapped lines
+vim.opt.showbreak = "↳ "
+
+-- Indent wrapped lines to match indentation
+vim.opt.breakindent = true
+
+-- (Optional) fine-tune breakindent behavior
+-- vim.opt.breakindentopt = "shift:2"
+
+-- Line Numbers
+vim.wo.number = true
+vim.wo.relativenumber = true
+
+
+-- Change the color of the line numbers
+vim.api.nvim_set_hl(0, 'LineNr', { fg = '#74c4c4', bg = 'NONE' })
+vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '#74c4c4', bg = 'NONE' })
+
+
+-- Tab Spaces
+vim.cmd("set tabstop=4")
+vim.cmd("set shiftwidth=4")
+-- vim.cmd("set expandtab")
+vim.cmd("set noexpandtab")
+vim.cmd("set smarttab")
+
+-- Indentation Options
+vim.opt.indentkeys:remove(":")
+vim.opt.smartindent = true
+
+
+
+--------------------------------------------------------
+-- 🪶 Basic Keybindings
+--------------------------------------------------------
+
+-- Leader Key
+vim.g.mapleader = ' '
+
+-- Tree
+vim.api.nvim_set_keymap('n', '<leader>t', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
+
+-- ~/.config/nvim/lua/keymaps.lua
+vim.keymap.set('n', '<Space>;', function()
+ local row, col = unpack(vim.api.nvim_win_get_cursor(0)) -- save cursor
+ local line = vim.api.nvim_get_current_line()
+
+ -- Only add semicolon if it doesn't exist
+ if not line:match(";$") then
+ vim.api.nvim_set_current_line(line .. ";")
+ end
+
+ -- Restore cursor
+ vim.api.nvim_win_set_cursor(0, {row, col})
+end, { noremap = true, silent = true })
+
+
+-- Telescope
+local builtin = require('telescope.builtin')
+vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
+vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
+vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
+
+--------------------------------------------------------
+-- 🪶 GUI and Colour Configuration
+--------------------------------------------------------
+
+-- Colors
+vim.opt.termguicolors = true
+vim.opt.background = "dark" -- or "light" depending on theme
+
+-- Remove Vim Background
+vim.api.nvim_set_hl(0, "Normal", { ctermbg = "none", bg = "none" })
+
+-- Colors (Foreground and Background)
+-- Neovide uses Neovim's colorscheme, so we’ll override via highlight groups
+-- vim.api.nvim_set_hl(0, "Normal", { fg = "#8affff", bg = "#003636" })
+vim.api.nvim_set_hl(0, "Normal", { fg = "#8affff", bg = "none", ctermbg = "none" })
+vim.api.nvim_set_hl(0, "NormalFloat", { fg = "#8affff", bg = "#003636" })
+
+
+-- Set font and size
+-- vim.o.guifont = "JetBrainsMono Nerd Font:h14"
+-- vim.o.guifont = "Source Code Pro:h10.5"
+vim.o.guifont = "JetBrainsMono Nerd Font:h10.5"
+
+
+-- General Neovim GUI
+vim.cmd([[
+ highlight Normal guibg=NONE ctermbg=NONE
+ highlight NormalNC guibg=NONE ctermbg=NONE
+ highlight LineNr guibg=NONE
+ highlight SignColumn guibg=NONE
+ highlight WinSeparator guifg=#74c4c4 guibg=NONE
+
+
+ highlight Pmenu guibg=NONE
+ highlight PmenuSel guifg=#FFFFFF guibg=#008282
+ highlight FloatBorder guifg=#74c4c4
+
+ highlight NvimTreeNormal guibg=NONE
+ highlight NvimTreeNormalFloat guibg=NONE
+ highlight NvimTreeCursorLine guibg=#395e5e
+
+ highlight Visual guibg=#395e5e
+
+ highlight EndOfBuffer guifg=#016868
+ highlight SpecialKey guifg=#016868
+ highlight Trailing guifg=#016868
+ highlight Whitespace guifg=#016868
+ highlight NonText guifg=#016868
+]])
+
+
+-- For Tabs and Folds
+vim.cmd [[
+ highlight BufferCurrent guifg=#FFFFFF guibg=#003636
+ highlight BufferVisible guifg=#CCCCCC guibg=#003636
+ highlight BufferInactive guifg=#888888 guibg=#003636
+
+ highlight BufferCurrentMod guifg=#fce094 guibg=#003636
+ highlight BufferVisibleMod guibg=#003636
+ highlight BufferInactiveMod guibg=#003636
+
+ highlight BufferDefaultCurrent guifg=#FFFFFF guibg=#003636
+ highlight BufferDefaultVisible guifg=#CCCCCC guibg=#003636
+ highlight BufferDefaultInactive guifg=#888888 guibg=#003636
+
+ highlight BufferInactiveSign guifg=#8affff guibg=#003636
+ highlight BufferVisibleSign guifg=#8affff guibg=#003636
+ highlight BufferCurrentSign guifg=#8affff guibg=#003636
+
+ highlight BufferDefaultInactiveSign guifg=#8affff guibg=#003636
+ highlight BufferDefaultVisibleSign guifg=#8affff guibg=#003636
+ highlight BufferDefaultCurrentSign guifg=#8affff guibg=#003636
+
+ highlight BufferDefaultInactiveIcon guifg=#8affff guibg=#003636
+ highlight BufferDefaultVisibleIcon guifg=#8affff guibg=#003636
+ highlight BufferDefaultCurrentIcon guifg=#8affff guibg=#003636
+
+ highlight BufferInactiveIcon guifg=#8affff guibg=#003636
+ highlight BufferVisibleIcon guifg=#8affff guibg=#003636
+ highlight BufferCurrentIcon guifg=#8affff guibg=#003636
+
+ highlight BufferTabpageFill guibg=#003636
+
+ highlight Folded guifg=#74c4c4 guibg=#003636
+ highlight FoldColumn guifg=#74c4c4 guibg=#003636
+]]
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json
new file mode 100644
index 0000000..f61a56e
--- /dev/null
+++ b/nvim/.config/nvim/lazy-lock.json
@@ -0,0 +1,34 @@
+{
+ "HexEditor.nvim": { "branch": "master", "commit": "40708985ea840207c3c8a9acd6043871c2ed8862" },
+ "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
+ "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" },
+ "ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" },
+ "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
+ "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
+ "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
+ "darkplus.nvim": { "branch": "main", "commit": "6101ffce60682208e9e076710299d189ce11c40d" },
+ "dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
+ "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
+ "gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
+ "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
+ "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
+ "lspkind.nvim": { "branch": "master", "commit": "3ddd1b4edefa425fda5a9f95a4f25578727c0bb3" },
+ "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
+ "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" },
+ "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
+ "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
+ "nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
+ "nvim-lspconfig": { "branch": "master", "commit": "effe4bf2e1afb881ea67291c648b68dd3dfc927a" },
+ "nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
+ "nvim-tree.lua": { "branch": "master", "commit": "776a5cdfac948b490e06f1d1d22c4cb986e40699" },
+ "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
+ "nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
+ "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
+ "onedark.nvim": { "branch": "master", "commit": "213c23ae45a04797572242568d5d51937181792d" },
+ "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
+ "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
+ "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
+ "vim-grammarous": { "branch": "master", "commit": "db46357465ce587d5325e816235b5e92415f8c05" },
+ "vimtex": { "branch": "master", "commit": "32bcb3922c20588e00de68f73c86312eda2141ad" }
+}
diff --git a/nvim/.config/nvim/lua/config/.bak/.luasnip.bak.bak b/nvim/.config/nvim/lua/config/.bak/.luasnip.bak.bak
new file mode 100644
index 0000000..e0b5617
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/.luasnip.bak.bak
@@ -0,0 +1,56 @@
+-- ~/.config/nvim/lua/config/luasnip.lua
+return function()
+ local ls = require("luasnip")
+ local s = ls.snippet
+ local t = ls.text_node
+ local i = ls.insert_node
+
+ -- Minimal test snippets
+ ls.snippets = {
+ all = {
+ s("hi", t("Hello, world!")), -- trigger: hi
+ },
+ lua = {
+ s("fn", { -- trigger: fn
+ t("function "), i(1, "name"), t("("), i(2), t({")", "\t"}),
+ i(0),
+ t({"", "end"})
+ }),
+ s("fori", { -- for loop snippet
+ t("for "), i(1, "i"), t(" = "), i(2, "1"), t(", "), i(3, "10"), t(" do"),
+ t({"", "\t"}), i(0),
+ t({"", "end"})
+ }),
+ },
+ }
+
+ -- Load VSCode-style snippets (optional)
+ require("luasnip.loaders.from_vscode").lazy_load()
+
+ -- Load Lua snippets from a separate file (optional)
+ -- require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/config/snippets.lua" })
+
+ local opts = { silent = true, noremap = true }
+
+ -- Expand snippet or jump forward
+ vim.keymap.set({ "i", "s" }, "<C-l>", function()
+ if ls.expand_or_jumpable() then
+ ls.expand_or_jump()
+ end
+ end, opts)
+
+ -- Jump backward
+ vim.keymap.set({ "i", "s" }, "<C-h>", function()
+ if ls.jumpable(-1) then
+ ls.jump(-1)
+ end
+ end, opts)
+
+ -- Cycle choice nodes
+ vim.keymap.set({ "i", "s" }, "<C-k>", function()
+ if ls.choice_active() then
+ ls.change_choice(1)
+ end
+ end, opts)
+end
+
diff --git a/nvim/.config/nvim/lua/config/.bak/.neovide.lua.bak b/nvim/.config/nvim/lua/config/.bak/.neovide.lua.bak
new file mode 100644
index 0000000..aa62665
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/.neovide.lua.bak
@@ -0,0 +1,81 @@
+-- --------------------------------------------------------
+-- -- 🪶 Neovide GUI Configuration
+-- --------------------------------------------------------
+-- -- NEOVIDE --
+--
+-- -- Enable transparency
+-- vim.g.neovide_opacity = 0.75
+--
+-- -- Set font and size
+-- -- vim.o.guifont = "JetBrainsMono Nerd Font:h14"
+-- vim.o.guifont = "Source Code Pro:h10.5"
+--
+-- -- Colors (Foreground and Background)
+-- -- Neovide uses Neovim's colorscheme, so we’ll override via highlight groups
+-- vim.api.nvim_set_hl(0, "Normal", { fg = "#8affff", bg = "#003636" })
+-- vim.api.nvim_set_hl(0, "NormalFloat", { fg = "#8affff", bg = "#003636" })
+--
+-- -- Neovide also supports an extra blending layer
+-- vim.g.neovide_background_color = "#003636" .. string.format("%x", math.floor(255 * vim.g.neovide_opacity))
+--
+--
+-- -- Padding (Kitty → Neovide scaling)
+-- vim.g.neovide_padding_top = 5
+-- vim.g.neovide_padding_bottom = 5
+-- vim.g.neovide_padding_right = 5
+-- vim.g.neovide_padding_left = 5
+--
+-- -- Set cursor effects
+-- -- vim.g.neovide_cursor_vfx_mode = "railgun"
+--
+-- -- Enable fullscreen
+-- -- vim.g.neovide_fullscreen = true
+--
+-- -- Scale factor (zoom)
+-- vim.g.neovide_scale_factor = 0.75
+--
+-- -- Helper function to zoom in/out
+-- -- local change_scale_factor = function(delta)
+-- -- vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
+-- -- end
+-- -- vim.keymap.set("n", "<C-=>", function() change_scale_factor(1.25) end)
+-- -- vim.keymap.set("n", "<C-->", function() change_scale_factor(1/1.25) end)
+--
+--
+
+--------------------------------------------------------
+-- 🪶 Neovide GUI Configuration
+--------------------------------------------------------
+-- NEOVIDE --
+
+-- Enable transparency
+vim.g.neovide_opacity = 0.75
+
+
+
+-- Neovide also supports an extra blending layer
+vim.g.neovide_background_color = "#003636" .. string.format("%x", math.floor(255 * vim.g.neovide_opacity))
+
+
+-- Padding (Kitty → Neovide scaling)
+vim.g.neovide_padding_top = 5
+vim.g.neovide_padding_bottom = 5
+vim.g.neovide_padding_right = 5
+vim.g.neovide_padding_left = 5
+
+-- Set cursor effects
+-- vim.g.neovide_cursor_vfx_mode = "railgun"
+
+-- Enable fullscreen
+-- vim.g.neovide_fullscreen = true
+
+-- Scale factor (zoom)
+vim.g.neovide_scale_factor = 0.75
+
+-- Helper function to zoom in/out
+-- local change_scale_factor = function(delta)
+-- vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta
+-- end
+-- vim.keymap.set("n", "<C-=>", function() change_scale_factor(1.25) end)
+-- vim.keymap.set("n", "<C-->", function() change_scale_factor(1/1.25) end)
+
diff --git a/nvim/.config/nvim/lua/config/.bak/dashboard.lua.bak b/nvim/.config/nvim/lua/config/.bak/dashboard.lua.bak
new file mode 100644
index 0000000..d5c81c0
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/dashboard.lua.bak
@@ -0,0 +1,109 @@
+-- local home = os.getenv('HOME')
+-- local db = require('dashboard')
+-- db.default_banner =
+-- {
+-- '',
+-- '',
+-- '',
+-- '██████╗ ██╗ ██╗ ███╗ ██╗██╗ ██╗██╗███╗ ███╗',
+-- '██╔══██╗██║ ██║ ████╗ ██║██║ ██║██║████╗ ████║',
+-- '██████╔╝███████║█████╗██╔██╗ ██║██║ ██║██║██╔████╔██║',
+-- '██╔══██╗██╔══██║╚════╝██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║',
+-- '██████╔╝██║ ██║ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║',
+-- '╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═ ',
+-- '',
+-- ' [TIP: To exit Vim, use a sledgehammer.] ',
+-- '',
+--
+--
+-- }
+-- db.preview_file_height = 11
+-- db.preview_file_width = 70
+-- db.custom_center =
+-- {
+-- { icon = ' ',
+-- desc = 'Recently Opened Files ',
+-- action = 'Telescope oldfiles',
+-- shortcut = 'SPC f h' },
+-- { icon = ' ',
+-- desc = 'New File ',
+-- action = ':tabnew',
+-- shortcut = 'SPC f n' },
+-- { icon = ' ',
+-- desc = 'Find File ',
+-- action = 'Telescope find_files find_command=rg,--hidden,--files',
+-- shortcut = 'SPC f f' },
+-- { icon = ' ',
+-- desc = 'File Browser ',
+-- action = 'Telescope file_browser',
+-- shortcut = 'SPC f b' },
+-- { icon = ' ',
+-- desc = 'Find Word ',
+-- action = 'Telescope live_grep',
+-- shortcut = 'SPC f w' },
+-- { icon = ' ',
+-- desc = 'View Harpoon Marks ',
+-- action = 'Telescope harpoon marks',
+-- shortcut = 'SPC f r' },
+-- { icon = '⚒ ',
+-- desc = 'Use A Sledgehammer ',
+-- action = 'qa',
+-- shortcut = 'SPC w q' },
+-- }
+
+local db = require("dashboard")
+db.setup {
+ theme = "hyper",
+ config = {
+ header = {
+ " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
+ " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
+ " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
+ " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
+ " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
+ " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ "
+
+ },
+-- center = {
+-- { icon = " ", desc = "Find File", action = "Telescope find_files", shortcut = "f" },
+-- { icon = " ", desc = "Recent Files", action = "Telescope oldfiles", shortcut = "r" },
+-- { icon = " ", desc = "New File", action = "enew", shortcut = "n" },
+-- { icon = "󰓢 ", desc = "Open Config", action = "edit ~/.config/nvim/init.lua", shortcut = "c" },
+-- { icon = "󰗼 ", desc = "Quit", action = "qa", shortcut = "q" },
+-- },
+ center =
+ {
+ { icon = ' ',
+ desc = 'Recently Opened Files ',
+ action = 'Telescope oldfiles',
+ shortcut = 'SPC f h' },
+ { icon = ' ',
+ desc = 'New File ',
+ action = ':tabnew',
+ shortcut = 'SPC f n' },
+ { icon = ' ',
+ desc = 'Find File ',
+ action = 'Telescope find_files find_command=rg,--hidden,--files',
+ shortcut = 'SPC f f' },
+ { icon = ' ',
+ desc = 'File Browser ',
+ action = 'Telescope file_browser',
+ shortcut = 'SPC f b' },
+ { icon = ' ',
+ desc = 'Find Word ',
+ action = 'Telescope live_grep',
+ shortcut = 'SPC f w' },
+ { icon = ' ',
+ desc = 'View Harpoon Marks ',
+ action = 'Telescope harpoon marks',
+ shortcut = 'SPC f r' },
+ { icon = '⚒ ',
+ desc = 'Use A Sledgehammer ',
+ action = 'qa',
+ shortcut = 'SPC w q' },
+ },
+
+ footer = { "Have a productive day!" },
+ },
+}
+
diff --git a/nvim/.config/nvim/lua/config/.bak/dashboard2.lua.bak b/nvim/.config/nvim/lua/config/.bak/dashboard2.lua.bak
new file mode 100644
index 0000000..8eeb687
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/dashboard2.lua.bak
@@ -0,0 +1,122 @@
+-- local home = os.getenv('HOME')
+-- local db = require('dashboard')
+-- db.default_banner =
+-- {
+-- '',
+-- '',
+-- '',
+-- '██████╗ ██╗ ██╗ ███╗ ██╗██╗ ██╗██╗███╗ ███╗',
+-- '██╔══██╗██║ ██║ ████╗ ██║██║ ██║██║████╗ ████║',
+-- '██████╔╝███████║█████╗██╔██╗ ██║██║ ██║██║██╔████╔██║',
+-- '██╔══██╗██╔══██║╚════╝██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║',
+-- '██████╔╝██║ ██║ ██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║',
+-- '╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═ ',
+-- '',
+-- ' [TIP: To exit Vim, use a sledgehammer.] ',
+-- '',
+--
+--
+-- }
+-- db.preview_file_height = 11
+-- db.preview_file_width = 70
+-- db.custom_center =
+-- {
+-- { icon = ' ',
+-- desc = 'Recently Opened Files ',
+-- action = 'Telescope oldfiles',
+-- shortcut = 'SPC f h' },
+-- { icon = ' ',
+-- desc = 'New File ',
+-- action = ':tabnew',
+-- shortcut = 'SPC f n' },
+-- { icon = ' ',
+-- desc = 'Find File ',
+-- action = 'Telescope find_files find_command=rg,--hidden,--files',
+-- shortcut = 'SPC f f' },
+-- { icon = ' ',
+-- desc = 'File Browser ',
+-- action = 'Telescope file_browser',
+-- shortcut = 'SPC f b' },
+-- { icon = ' ',
+-- desc = 'Find Word ',
+-- action = 'Telescope live_grep',
+-- shortcut = 'SPC f w' },
+-- { icon = ' ',
+-- desc = 'View Harpoon Marks ',
+-- action = 'Telescope harpoon marks',
+-- shortcut = 'SPC f r' },
+-- { icon = '⚒ ',
+-- desc = 'Use A Sledgehammer ',
+-- action = 'qa',
+-- shortcut = 'SPC w q' },
+-- }
+
+local db = require("dashboard")
+db.setup {
+ theme = "hyper",
+ config = {
+ header = {
+ " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗",
+ " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║",
+ " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║",
+ " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██╔╝██╔╝██║",
+ " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║",
+ " ╚═╝ ╚═══╝╚══════╝╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
+ " "
+ },
+ week_header = {
+ enable = false -- or true if you want date/time header
+ },
+ shortcut = {
+ {
+ icon = " ",
+ desc = "Find File",
+ key = "f",
+ action = "Telescope find_files"
+ },
+ {
+ icon = " ",
+ desc = "Recent Files",
+ key = "r",
+ action = "Telescope oldfiles"
+ },
+ {
+ icon = " ",
+ desc = "New File",
+ key = "n",
+ action = "enew"
+ },
+ {
+ icon = "󰓢 ",
+ desc = "Open Config",
+ key = "c",
+ action = "edit ~/.config/nvim/init.lua"
+ },
+ {
+ icon = "󰗼 ",
+ desc = "Quit",
+ key = "q",
+ action = "qa"
+ },
+ },
+ packages = {
+ enable = true -- set to true if you want plugin count display
+ },
+ project = {
+ enable = false, -- set true if you want project list
+ limit = 8,
+ icon = " ",
+ label = "Projects",
+ action = "Telescope find_files cwd="
+ },
+ mru = {
+ enable = true, -- set true if you want MRU files
+ limit = 10,
+ icon = " ",
+ label = "Recent",
+ cwd_only = false
+ },
+ footer = { "Have a productive day!" },
+ },
+}
+
diff --git a/nvim/.config/nvim/lua/config/.bak/greeter.lua.bak b/nvim/.config/nvim/lua/config/.bak/greeter.lua.bak
new file mode 100644
index 0000000..a41cfd9
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/greeter.lua.bak
@@ -0,0 +1,5 @@
+-- vim.g.dashboard_custom_header =
+-- {
+-- [[ Hello ]]
+-- }
+
diff --git a/nvim/.config/nvim/lua/config/.bak/keybindings.lua.bak b/nvim/.config/nvim/lua/config/.bak/keybindings.lua.bak
new file mode 100644
index 0000000..65d2b2b
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/keybindings.lua.bak
@@ -0,0 +1,19 @@
+-- Keybindings
+
+-- Swap Ctrl + C to Esc
+-- vim.api.nvim_set_keymap('i', '<C-c>', '<Esc>', { noremap = true, silent = true })
+-- vim.api.nvim_set_keymap('i', '<C-g>', '<Esc>', { noremap = true, silent = true })
+-- vim.api.nvim_set_keymap('i', '<Esc>', '<C-c>', { noremap = true, silent = true })
+
+
+-- Leader Key
+vim.g.mapleader = ' '
+
+-- Tree
+vim.api.nvim_set_keymap('n', '<leader>t', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
+
+-- Telescope
+local builtin = require('telescope.builtin')
+vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
+vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
+vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
diff --git a/nvim/.config/nvim/lua/config/.bak/theme.lua.bak b/nvim/.config/nvim/lua/config/.bak/theme.lua.bak
new file mode 100644
index 0000000..4c2a94a
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/.bak/theme.lua.bak
@@ -0,0 +1,2 @@
+vim.cmd("colorscheme default")
+
diff --git a/nvim/.config/nvim/lua/config/colorpicker.lua b/nvim/.config/nvim/lua/config/colorpicker.lua
new file mode 100644
index 0000000..39772be
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/colorpicker.lua
@@ -0,0 +1,16 @@
+return function()
+ -- Enable true color
+ vim.opt.termguicolors = true
+
+ local ccc = require("ccc")
+ local mapping = ccc.mapping
+
+ ccc.setup({
+ highlighter = {
+ auto_enable = true,
+ lsp = true,
+ },
+ -- add other options here
+ })
+end
+
diff --git a/nvim/.config/nvim/lua/config/completion.lua b/nvim/.config/nvim/lua/config/completion.lua
new file mode 100644
index 0000000..09a934e
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/completion.lua
@@ -0,0 +1,59 @@
+-- return a function for lazy.nvim
+return function()
+ local cmp = require("cmp")
+ local luasnip = require("luasnip")
+ local lspkind = require("lspkind")
+
+ -- load friendly-snippets
+ require("luasnip.loaders.from_vscode").lazy_load()
+
+ cmp.setup({
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
+ mapping = cmp.mapping.preset.insert({
+ ["<C-b>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-Space>"] = cmp.mapping.complete(), -- manual trigger
+ ["<CR>"] = cmp.mapping.confirm({ select = true }),
+ ["<Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ elseif luasnip.expand_or_jumpable() then
+ luasnip.expand_or_jump()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<S-Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ elseif luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ }),
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" },
+ { name = "path" },
+ { name = "luasnip" },
+ }, {
+ { name = "buffer" },
+ }),
+ formatting = {
+ format = lspkind.cmp_format({ with_text = true, maxwidth = 50 }),
+ },
+ window = {
+ completion = cmp.config.window.bordered(),
+ documentation = cmp.config.window.bordered(),
+ },
+ completion = {
+ autocomplete = false, -- only trigger with <C-Space>
+ },
+ })
+end
+
diff --git a/nvim/.config/nvim/lua/config/dashboard.lua b/nvim/.config/nvim/lua/config/dashboard.lua
new file mode 100644
index 0000000..c317a71
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/dashboard.lua
@@ -0,0 +1,84 @@
+return function()
+local db = require("dashboard")
+
+-- Safe fortune function
+local function quote()
+ local handle = io.popen("fortune -s") -- run fortune
+ local result = handle:read("*a") -- read all output
+ handle:close()
+ -- Remove all newlines and carriage returns
+ result = result:gsub("\r",""):gsub("\n"," ")
+ return result
+end
+
+db.setup {
+ theme = "hyper",
+ config = {
+ week_header = {
+ enable = false -- or true if you want date/time header
+ },
+ header = {
+ " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗",
+ " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║",
+ " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║",
+ " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██╔╝██╔╝██║",
+ " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║",
+ " ╚═╝ ╚═══╝╚══════╝╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
+ " ",
+ "  " .. os.date("%A, %B %d, %Y"), -- your custom date/day line
+ "",
+ "[TIP: To exit Vim, use a Sledgehammer!]",
+ "" -- optional empty line to separate from center shortcuts
+ },
+ shortcut = {
+ {
+ icon = " ",
+ desc = "New File",
+ key = "n",
+ action = "enew"
+ },
+ {
+ icon = " ",
+ desc = "Find File",
+ key = "f",
+ action = "Telescope find_files"
+ },
+ {
+ icon = " ",
+ desc = "Recent Files",
+ key = "r",
+ action = "Telescope oldfiles"
+ },
+ {
+ icon = "󰓢 ",
+ desc = "Open Config",
+ key = "c",
+ action = "edit ~/.config/nvim/"
+ },
+ {
+ icon = "󰣪 ",
+ desc = "SLEDGEHAMMER!",
+ action = "qa"
+ },
+ },
+ packages = {
+ enable = true -- set to true if you want plugin count display
+ },
+ mru = {
+ enable = true, -- set true if you want MRU files
+ limit = 10,
+ icon = " ",
+ label = "Recent",
+ cwd_only = false
+ },
+ project = {
+ enable = false, -- set true if you want project list
+ limit = 8,
+ icon = " ",
+ label = "Projects",
+ action = "Telescope find_files cwd="
+ },
+ footer = { "", quote() },
+ },
+}
+end
diff --git a/nvim/.config/nvim/lua/config/hex.lua b/nvim/.config/nvim/lua/config/hex.lua
new file mode 100644
index 0000000..a743620
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/hex.lua
@@ -0,0 +1,24 @@
+return function()
+
+ require 'HexEditor'.setup {
+
+ -- cli command used to dump hex data
+ dump_cmd = 'xxd -g 1 -u',
+
+ -- cli command used to assemble from hex data
+ assemble_cmd = 'xxd -r',
+
+ -- function that runs on BufReadPre to determine if it's binary or not
+ is_buf_binary_pre_read = function()
+ -- logic that determines if a buffer contains binary data or not
+ -- must return a bool
+ end,
+
+ -- function that runs on BufReadPost to determine if it's binary or not
+ is_buf_binary_post_read = function()
+ -- logic that determines if a buffer contains binary data or not
+ -- must return a bool
+ end,
+}
+
+end
diff --git a/nvim/.config/nvim/lua/config/indent.lua b/nvim/.config/nvim/lua/config/indent.lua
new file mode 100644
index 0000000..e703212
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/indent.lua
@@ -0,0 +1,39 @@
+-- ~/.config/nvim/lua/config/indent.lua
+return function()
+ local ibl = require("ibl")
+ local hooks = require("ibl.hooks")
+
+ -- Define your highlight colors
+ local highlight = {
+ "RainbowRed",
+ "RainbowYellow",
+ "RainbowBlue",
+ "RainbowOrange",
+ "RainbowGreen",
+ "RainbowViolet",
+ "RainbowCyan",
+ }
+
+ -- Register hook to set highlights (resets on colorscheme change)
+ hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
+ vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
+ vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
+ vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
+ vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
+ vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
+ vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
+ vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
+ end)
+
+ -- Setup ibl with your highlights
+ ibl.setup {
+ indent = {
+ highlight = highlight,
+ },
+ exclude = {
+ filetypes = { "dashboard", "alpha", "help", "neo-tree", "NvimTree", "lazy" },
+ buftypes = { "nofile", "terminal" }, -- optional but useful
+ },
+ }
+end
+
diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua
new file mode 100644
index 0000000..0b93d4e
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/lazy.lua
@@ -0,0 +1,35 @@
+-- Bootstrap lazy.nvim
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not (vim.uv or vim.loop).fs_stat(lazypath) then
+ local lazyrepo = "https://github.com/folke/lazy.nvim.git"
+ local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
+ if vim.v.shell_error ~= 0 then
+ vim.api.nvim_echo({
+ { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
+ { out, "WarningMsg" },
+ { "\nPress any key to exit..." },
+ }, true, {})
+ vim.fn.getchar()
+ os.exit(1)
+ end
+end
+vim.opt.rtp:prepend(lazypath)
+
+-- Make sure to setup `mapleader` and `maplocalleader` before
+-- loading lazy.nvim so that mappings are correct.
+-- This is also a good place to setup other settings (vim.opt)
+vim.g.mapleader = " "
+vim.g.maplocalleader = "\\"
+
+-- Setup lazy.nvim
+require("lazy").setup({
+ spec = {
+ -- import your plugins
+ { import = "plugins" },
+ },
+ -- Configure any other settings here. See the documentation for more details.
+ -- colorscheme that will be used when installing plugins.
+ install = { colorscheme = { "habamax" } },
+ -- automatically check for plugin updates
+ checker = { enabled = false },
+})
diff --git a/nvim/.config/nvim/lua/config/lsp.lua b/nvim/.config/nvim/lua/config/lsp.lua
new file mode 100644
index 0000000..5d7aa3e
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/lsp.lua
@@ -0,0 +1,116 @@
+-- ~/.config/nvim/lua/config/lsp.lua
+return function()
+ -- Shared settings✖
+ local cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
+ local capabilities = vim.lsp.protocol.make_client_capabilities()
+ if cmp_ok then
+ capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
+ end
+
+ local on_attach = function(client, bufnr)
+ local opts = { noremap = true, silent = true, buffer = bufnr }
+ vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
+ vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
+ vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
+ vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
+ -- Normal mode: show diagnostics in a floating window
+ vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, { noremap=true, silent=true })
+
+ end
+
+ -- Server‑specific configurations
+ local servers = {
+ lua_ls = {
+ settings = {
+ Lua = {
+ diagnostics = { globals = { "vim" } },
+ workspace = { library = vim.api.nvim_get_runtime_file("", true) },
+ telemetry = { enable = false },
+ },
+ },
+ },
+ ts_ls = {},
+ texlab = {
+ settings = {
+ texlab = {
+ auxDirectory = "build",
+ build = {
+ executable = "latexmk",
+ args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
+ onSave = true,
+ },
+ forwardSearch = {
+ executable = "zathura",
+ args = { "--synctex-forward", "%l:1:%f", "%p" },
+ },
+ },
+ },
+ },
+ clangd = {}, -- C & C++
+ pyright = {}, -- Python
+ rust_analyzer = {}, -- Rust
+ zls = {}, -- Zig
+ hls = {}, -- Haskell
+ jdtls = {}, -- Java
+ asm_lsp = {}, -- Assembly (if you install it)
+ }
+
+ for name, cfg in pairs(servers) do
+ -- Use the new api
+ vim.lsp.config(name, {
+ on_attach = on_attach,
+ capabilities = capabilities,
+ settings = cfg.settings,
+ root_dir = cfg.root_dir, -- optional if you have special root logic
+ })
+ vim.lsp.enable(name)
+
+ -- Diagnostic Icons
+ vim.diagnostic.config({
+ signs = {
+ active = true, -- enable signs
+ text = {
+ [vim.diagnostic.severity.ERROR] = "✖",
+ [vim.diagnostic.severity.WARN] = "",
+ [vim.diagnostic.severity.INFO] = "",
+ [vim.diagnostic.severity.HINT] = "", -- lightbulb for hint
+ },
+ },
+ -- virtual_text = {
+ -- prefix = "●GAY●",
+ -- },
+ underline = true,
+ severity_sort = true,
+ virtual_text = true, -- inline messages
+ signs = true, -- show signs in the gutter
+ underline = true, -- underline errors/warnings
+ update_in_insert = false,
+ -- severity_sort = true,
+ })
+
+ -- local signs = { Error = "✖", Warn = "", Hint = "", Info = "" }
+ -- for type, icon in pairs(signs) do
+ -- local hl = "DiagnosticSign" .. type
+ -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
+ -- end
+
+ -- Use Nerd Font symbols for diagnostics
+ -- vim.fn.sign_define("DiagnosticSignError", {text = "✖", texthl = "DiagnosticError"}) -- x-mark
+ -- vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticWarn"}) -- warning triangle
+ -- vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticInfo"}) -- info circle
+ -- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticHint"}) -- lightbulb
+
+
+ lualine_x = {
+ {
+ "diagnostics",
+ sources = {"nvim_lsp"},
+ sections = {"error", "warn", "info", "hint"},
+ symbols = { error = " ", warn = " ", info = " ", hint = " " },
+ }
+ }
+
+ end
+end
+
diff --git a/nvim/.config/nvim/lua/config/luasnip.lua b/nvim/.config/nvim/lua/config/luasnip.lua
new file mode 100644
index 0000000..4524322
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/luasnip.lua
@@ -0,0 +1,36 @@
+-- Return a function so we can call it from Lazy.nvim
+return function()
+ local ls = require("luasnip")
+
+ -- Load snippets from friendly-snippets
+ require("luasnip.loaders.from_vscode").lazy_load()
+
+ -- Example Lua snippets
+ ls.add_snippets("lua", {
+ ls.parser.parse_snippet("hi", "print('Hello, world!')"),
+ ls.parser.parse_snippet("fn", "function ${1:name}(${2:args})\n\t$0\nend"),
+ })
+
+ local opts = { silent = true, noremap = true }
+
+ -- Expand snippet or jump forward
+ vim.keymap.set({ "i", "s" }, "<C-k>", function()
+ if ls.expand_or_jumpable() then
+ ls.expand_or_jump()
+ end
+ end, opts)
+
+ -- Jump backward
+ vim.keymap.set({ "i", "s" }, "<C-j>", function()
+ if ls.jumpable(-1) then
+ ls.jump(-1)
+ end
+ end, opts)
+
+ -- Change choice in choice node
+ vim.keymap.set({ "i", "s" }, "<C-l>", function()
+ if ls.choice_active() then
+ ls.change_choice(1)
+ end
+ end, opts)
+end
diff --git a/nvim/.config/nvim/lua/config/statusline.lua b/nvim/.config/nvim/lua/config/statusline.lua
new file mode 100644
index 0000000..9e5fbb8
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/statusline.lua
@@ -0,0 +1,76 @@
+-- ~/.config/nvim/lua/config/statusline.lua
+return function()
+ local colors = {
+ fg = '#8affff',
+ bg = '#003636',
+ blue1 = '#00a8e6',
+ blue2 = '#2dc5fc',
+ green = '#00e6a9',
+ purple = '#d38cff',
+ red1 = '#f07178',
+ red2 = '#ff5370',
+ yellow = '#ffcb6b',
+ }
+
+ local theal = {
+ normal = {
+ a = { fg = colors.bg, bg = colors.blue2, gui = 'bold' },
+ b = { fg = colors.fg, bg = colors.bg },
+ c = { fg = colors.fg, bg = colors.bg },
+ },
+ insert = {
+ a = { fg = colors.bg, bg = colors.green, gui = 'bold' },
+ b = { fg = colors.fg, bg = colors.bg },
+ },
+ visual = {
+ a = { fg = colors.bg, bg = colors.purple, gui = 'bold' },
+ b = { fg = colors.fg, bg = colors.bg },
+ },
+ replace = {
+ a = { fg = colors.bg, bg = colors.red1, gui = 'bold' },
+ b = { fg = colors.fg, bg = colors.bg },
+ },
+ command = {
+ a = { fg = colors.bg, bg = colors.yellow, gui = 'bold' },
+ b = { fg = colors.fg, bg = colors.bg },
+ },
+ inactive = {
+ a = { fg = colors.fg, bg = colors.bg, gui = 'bold' },
+ b = { fg = colors.fg, bg = colors.bg },
+ c = { fg = colors.fg, bg = colors.bg },
+ },
+ }
+
+ require('lualine').setup {
+ options = {
+ icons_enabled = true,
+ theme = theal,
+ component_separators = { left = '', right = '' },
+ section_separators = { left = '', right = '' },
+ always_divide_middle = true,
+ globalstatus = false,
+ refresh = { statusline = 1000, tabline = 1000, winbar = 1000 },
+ },
+ sections = {
+ lualine_a = {'mode'},
+ lualine_b = {'branch', 'diff', 'diagnostics'},
+ lualine_c = {'filename'},
+ lualine_x = {'encoding', 'fileformat', 'filetype'},
+ lualine_y = {'progress'},
+ lualine_z = {'location'}
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_c = {'filename'},
+ lualine_x = {'location'},
+ lualine_y = {},
+ lualine_z = {}
+ },
+ tabline = {},
+ winbar = {},
+ inactive_winbar = {},
+ extensions = {}
+ }
+end
+
diff --git a/nvim/.config/nvim/lua/config/tabs.lua b/nvim/.config/nvim/lua/config/tabs.lua
new file mode 100644
index 0000000..82e9e8f
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/tabs.lua
@@ -0,0 +1,81 @@
+-- ~/.config/nvim/lua/config/tabs.lua
+return function()
+ -- Disable auto-setup
+ vim.g.barbar_auto_setup = false -- disable auto-setup
+
+ require'barbar'.setup {
+ -- WARN: do not copy everything below into your config!
+ -- It is just an example of what configuration options there are.
+ -- The defaults are suitable for most people.
+
+ -- Enable/disable animations
+ animation = true,
+
+ -- Automatically hide the tabline when there are this many buffers left.
+ -- Set to any value >=0 to enable.
+ auto_hide = 1,
+
+ -- Set the filetypes which barbar will offset itself for
+ sidebar_filetypes = {
+ -- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'}
+ NvimTree = true,
+ -- Or, specify the text used for the offset:
+ undotree = {
+ text = 'undotree',
+ align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
+ },
+ -- Or, specify the event which the sidebar executes when leaving:
+ ['neo-tree'] = {event = 'BufWipeout'},
+ -- Or, specify all three
+ Outline = {event = 'BufWinLeave', text = 'symbols-outline', align = 'right'},
+ },
+
+ -- icons = {
+ -- -- Configure the base icons on the bufferline.
+ -- -- Valid options to display the buffer index and -number are `true`, 'superscript' and 'subscript'
+ -- buffer_index = false,
+ -- buffer_number = false,
+ -- button = '',
+ -- -- Enables / disables diagnostic symbols
+ -- diagnostics = {
+ -- [vim.diagnostic.severity.ERROR] = {enabled = true, icon = 'ff'},
+ -- [vim.diagnostic.severity.WARN] = {enabled = false},
+ -- [vim.diagnostic.severity.INFO] = {enabled = false},
+ -- [vim.diagnostic.severity.HINT] = {enabled = true},
+ -- },
+ -- gitsigns = {
+ -- added = {enabled = true, icon = '+'},
+ -- changed = {enabled = true, icon = '~'},
+ -- deleted = {enabled = true, icon = '-'},
+ -- },
+ -- filetype = {
+ -- -- Sets the icon's highlight group.
+ -- -- If false, will use nvim-web-devicons colors
+ -- custom_colors = false,
+
+ -- -- Requires `nvim-web-devicons` if `true`
+ -- enabled = true,
+ -- },
+ -- separator = {left = '▎', right = ''},
+
+ -- -- If true, add an additional separator at the end of the buffer list
+ -- separator_at_end = true,
+
+ -- -- Configure the icons on the bufferline when modified or pinned.
+ -- -- Supports all the base icon options.
+ -- modified = {button = '●'},
+ -- pinned = {button = '', filename = true},
+
+ -- -- Use a preconfigured buffer appearance— can be 'default', 'powerline', or 'slanted'
+ -- preset = 'default',
+
+ -- -- Configure the icons on the bufferline based on the visibility of a buffer.
+ -- -- Supports all the base icon options, plus `modified` and `pinned`.
+ -- alternate = {filetype = {enabled = false}},
+ -- current = {buffer_index = true},
+ -- inactive = {button = '×'},
+ -- visible = {modified = {buffer_number = false}},
+ -- },
+ }
+end
+
diff --git a/nvim/.config/nvim/lua/config/telescope.lua b/nvim/.config/nvim/lua/config/telescope.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/telescope.lua
diff --git a/nvim/.config/nvim/lua/config/tree.lua b/nvim/.config/nvim/lua/config/tree.lua
new file mode 100644
index 0000000..bb1c6c9
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/tree.lua
@@ -0,0 +1,29 @@
+-- ~/.config/nvim/lua/config/tree.lua
+return function()
+ -- disable netrw
+ vim.g.loaded_netrw = 1
+ vim.g.loaded_netrwPlugin = 1
+
+ -- enable 24-bit colors
+ vim.opt.termguicolors = true
+
+ -- nvim-tree setup
+ require("nvim-tree").setup({
+ sort = {
+ sorter = "case_sensitive",
+ },
+ view = {
+ width = 30,
+ },
+ renderer = {
+ group_empty = true,
+ },
+ filters = {
+ dotfiles = true,
+ },
+ })
+
+ -- keybindings
+ vim.api.nvim_set_keymap('n', '<leader>t', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
+end
+
diff --git a/nvim/.config/nvim/lua/config/treesitter.lua b/nvim/.config/nvim/lua/config/treesitter.lua
new file mode 100644
index 0000000..897f758
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/treesitter.lua
@@ -0,0 +1,69 @@
+-- ~/.config/nvim/lua/config/treesitter.lua
+return function()
+ require("nvim-treesitter.configs").setup {
+ ensure_installed = {
+ "c",
+ "lua",
+ "vim",
+ "vimdoc",
+ "query",
+ "markdown",
+ "markdown_inline",
+ "python",
+ "javascript",
+ "cpp",
+ "rust",
+ "haskell",
+ },
+ sync_install = false,
+ auto_install = true,
+ highlight = {
+ enable = true,
+ disable = {"latex"},
+ additional_vim_regex_highlighting = false,
+ },
+ indent = {
+ enable = true,
+ },
+ -- incremental_selection = {
+ -- enable = true,
+ -- keymaps = {
+ -- init_selection = "gnn",
+ -- node_incremental = "grn",
+ -- scope_incremental = "grc",
+ -- node_decremental = "grm",
+ -- },
+ -- },
+ textobjects = {
+ select = {
+ enable = true,
+ keymaps = {
+ ["af"] = "@function.outer",
+ ["if"] = "@function.inner",
+ ["ac"] = "@class.outer",
+ ["ic"] = "@class.inner",
+ },
+ },
+ },
+ fold = {
+ enable = true,
+ },
+
+ }
+ -- Add folding settings here
+ vim.opt.foldmethod = "expr"
+ vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
+ vim.opt.foldlevelstart = 99
+ vim.api.nvim_create_autocmd("FileType", {
+ callback = function()
+ if require("nvim-treesitter.parsers").has_parser() then
+ vim.opt.foldmethod = "expr"
+ vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
+ else
+ vim.opt.foldmethod = "indent" -- or whatever you prefer
+ end
+ end,
+})
+
+
+end
diff --git a/nvim/.config/nvim/lua/config/vimtex.lua b/nvim/.config/nvim/lua/config/vimtex.lua
new file mode 100644
index 0000000..24679bf
--- /dev/null
+++ b/nvim/.config/nvim/lua/config/vimtex.lua
@@ -0,0 +1,30 @@
+return function()
+ -- Use Zathura as the PDF viewer
+ vim.g.vimtex_view_method = "zathura"
+
+ -- Compile using latexmk automatically
+ vim.g.vimtex_compiler_method = "latexmk"
+ vim.g.vimtex_compiler_latexmk = {
+ build_dir = "build", -- Keep files in a separate folder
+ callback = 1,
+ continuous = 1, -- Automatically recompile on save
+ executable = "latexmk",
+ options = {
+ "-pdf",
+ "-interaction=nonstopmode",
+ "-synctex=1",
+ },
+ }
+
+ -- Optional: disable conceal for clearer LaTeX text
+ vim.g.vimtex_syntax_conceal = {
+ accents = 0,
+ ligatures = 0,
+ cites = 0,
+ fancy = 0,
+ spacing = 0,
+ greek = 0,
+ math_delimiters = 0,
+ math_super_sub = 0,
+ }
+end
diff --git a/nvim/.config/nvim/lua/plugins/.bak/.init.lua.bak b/nvim/.config/nvim/lua/plugins/.bak/.init.lua.bak
new file mode 100644
index 0000000..394b181
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/.bak/.init.lua.bak
@@ -0,0 +1,119 @@
+-- Plugins
+return {
+
+ -- Nvim Tree
+ "nvim-tree/nvim-tree.lua",
+
+ -- Icons
+ "nvim-tree/nvim-web-devicons",
+
+ -- Color Picker
+ "uga-rosa/ccc.nvim",
+
+ -- Status Bar
+ 'nvim-lualine/lualine.nvim',
+
+ -- Neoscroll
+ "karb94/neoscroll.nvim",
+ opts = {},
+
+
+ -- Telescope
+ {
+ 'nvim-telescope/telescope.nvim', tag = '0.1.8',
+ -- or , branch = '0.1.x',
+ dependencies = { 'nvim-lua/plenary.nvim' }
+ },
+
+ -- LSP
+
+
+ -- LaTeX
+ {
+ "lervag/vimtex",
+ ft = "tex",
+ init = function()
+ -- Use Zathura as the PDF viewer
+ vim.g.vimtex_view_method = "zathura"
+
+ -- Compile using latexmk automatically
+ vim.g.vimtex_compiler_method = "latexmk"
+ vim.g.vimtex_compiler_latexmk = {
+ build_dir = "build", -- optional: keep files in a separate folder
+ callback = 1,
+ continuous = 1, -- automatically recompile on save
+ executable = "latexmk",
+ options = {
+ "-pdf",
+ "-interaction=nonstopmode",
+ "-synctex=1",
+ },
+ }
+
+ -- Optional: disable conceal for clearer LaTeX text
+ vim.g.vimtex_syntax_conceal = {
+ accents = 0,
+ ligatures = 0,
+ cites = 0,
+ fancy = 0,
+ spacing = 0,
+ greek = 0,
+ math_delimiters = 0,
+ math_super_sub = 0,
+ }
+ end,
+ },
+
+ -- LSP support
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ require("lspconfig").texlab.setup({})
+ end,
+ },
+
+ -- Autocompletion (optional)
+ { "hrsh7th/nvim-cmp" },
+ { "hrsh7th/cmp-nvim-lsp" },
+
+ -- Snippets (optional)
+ { "L3MON4D3/LuaSnip" },
+
+ -- Grammar & spell checking
+ { "rhysd/vim-grammarous", ft = "tex" },
+
+
+ -- Tab Bar
+ {'romgrk/barbar.nvim',
+ dependencies = {
+ 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
+ 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
+ },
+ init = function() vim.g.barbar_auto_setup = false end,
+ opts = {
+ -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
+ -- animation = true,
+ -- insert_at_start = true,
+ -- …etc.
+ },
+ version = '^1.0.0', -- optional: only update when a new 1.x version is released
+ },
+
+ -- Dashboard
+ {
+ 'nvimdev/dashboard-nvim',
+ event = 'VimEnter',
+ config = function()
+ require('dashboard').setup {
+ -- config
+ }
+ end,
+ dependencies = { {'nvim-tree/nvim-web-devicons'}}
+ },
+
+ -- THEMES
+ "martinsione/darkplus.nvim",
+ "folke/tokyonight.nvim",
+ "navarasu/onedark.nvim"
+
+}
diff --git a/nvim/.config/nvim/lua/plugins/.bak/old.lua.bak b/nvim/.config/nvim/lua/plugins/.bak/old.lua.bak
new file mode 100644
index 0000000..e1f3946
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/.bak/old.lua.bak
@@ -0,0 +1,104 @@
+-- Plugins
+return {
+
+
+
+ -- Telescope
+ {
+ 'nvim-telescope/telescope.nvim', tag = '0.1.8',
+ -- or , branch = '0.1.x',
+ dependencies = { 'nvim-lua/plenary.nvim' }
+ },
+
+ -- LSP
+
+
+ -- LaTeX
+ {
+ "lervag/vimtex",
+ ft = "tex",
+ init = function()
+ -- Use Zathura as the PDF viewer
+ vim.g.vimtex_view_method = "zathura"
+
+ -- Compile using latexmk automatically
+ vim.g.vimtex_compiler_method = "latexmk"
+ vim.g.vimtex_compiler_latexmk = {
+ build_dir = "build", -- optional: keep files in a separate folder
+ callback = 1,
+ continuous = 1, -- automatically recompile on save
+ executable = "latexmk",
+ options = {
+ "-pdf",
+ "-interaction=nonstopmode",
+ "-synctex=1",
+ },
+ }
+
+ -- Optional: disable conceal for clearer LaTeX text
+ vim.g.vimtex_syntax_conceal = {
+ accents = 0,
+ ligatures = 0,
+ cites = 0,
+ fancy = 0,
+ spacing = 0,
+ greek = 0,
+ math_delimiters = 0,
+ math_super_sub = 0,
+ }
+ end,
+ },
+
+ -- LSP support
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ require("lspconfig").texlab.setup({})
+ end,
+ },
+
+ -- Autocompletion (optional)
+ { "hrsh7th/nvim-cmp" },
+ { "hrsh7th/cmp-nvim-lsp" },
+
+ -- Snippets (optional)
+ { "L3MON4D3/LuaSnip" },
+
+ -- Grammar & spell checking
+ { "rhysd/vim-grammarous", ft = "tex" },
+
+
+ -- Tab Bar
+ {'romgrk/barbar.nvim',
+ dependencies = {
+ 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
+ 'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
+ },
+ init = function() vim.g.barbar_auto_setup = false end,
+ opts = {
+ -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
+ -- animation = true,
+ -- insert_at_start = true,
+ -- …etc.
+ },
+ version = '^1.0.0', -- optional: only update when a new 1.x version is released
+ },
+
+ -- Dashboard
+ {
+ 'nvimdev/dashboard-nvim',
+ event = 'VimEnter',
+ config = function()
+ require('dashboard').setup {
+ -- config
+ }
+ end,
+ dependencies = { {'nvim-tree/nvim-web-devicons'}}
+ },
+
+ -- THEMES
+ "martinsione/darkplus.nvim",
+ "folke/tokyonight.nvim",
+ "navarasu/onedark.nvim"
+
+}
diff --git a/nvim/.config/nvim/lua/plugins/init.lua b/nvim/.config/nvim/lua/plugins/init.lua
new file mode 100644
index 0000000..eca8d68
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/init.lua
@@ -0,0 +1,134 @@
+-- ~/.config/nvim/lua/plugins/init.lua
+return {
+ -- LSP
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ require("config.lsp")() -- note the () if your lsp.lua returns a function
+ end,
+ },
+
+ -- TreeSitter
+ {"nvim-treesitter/nvim-treesitter", branch = 'master', lazy = false, build = ":TSUpdate",
+ config = function()
+ require("config.treesitter")()
+ end,},
+ {"nvim-treesitter/nvim-treesitter-textobjects", lazy = false, },
+
+ -- Autopairs
+ {
+ 'windwp/nvim-autopairs',
+ event = "InsertEnter",
+ config = true
+ },
+
+ {
+ "kylechui/nvim-surround",
+ version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
+ event = "VeryLazy",
+ config = function()
+ require("nvim-surround").setup({})
+ end
+ },
+
+ -- Auto Completion
+ {
+ "hrsh7th/nvim-cmp",
+ event = "InsertEnter", -- lazy load when entering insert mode
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "saadparwaiz1/cmp_luasnip",
+ "L3MON4D3/LuaSnip",
+ "rafamadriz/friendly-snippets",
+ "onsails/lspkind.nvim",
+ },
+ config = function()
+ require("config.completion")() -- load the separate config file
+ end,
+ },
+
+
+ -- Autocompletion
+ -- { "hrsh7th/nvim-cmp" },
+ -- { "hrsh7th/cmp-nvim-lsp" },
+
+ -- Snippets
+ {
+ "L3MON4D3/LuaSnip",
+ version = "v2.*",
+ dependencies = { "rafamadriz/friendly-snippets" },
+ build = "make install_jsregexp",
+ config = function()
+ -- Call the returned function from your module
+ require("config.luasnip")()
+ end,
+ },
+
+ -- File Explorer
+ { "nvim-tree/nvim-tree.lua", config = require("config.tree") },
+
+ -- Icons
+ { "nvim-tree/nvim-web-devicons" },
+
+ -- Color Picker
+ { "uga-rosa/ccc.nvim", config = require("config.colorpicker") },
+
+ -- Status Line
+ { "nvim-lualine/lualine.nvim", config = require("config.statusline"), opts = {} },
+
+ -- Smooth Scrolling
+ { "karb94/neoscroll.nvim", opts = {} },
+
+ -- Telescope
+ { "nvim-telescope/telescope.nvim", tag = "0.1.8", dependencies = { "nvim-lua/plenary.nvim" }, config = require("config.telescope") },
+
+ -- Plenary
+ { "nvim-lua/plenary.nvim" },
+
+ -- LaTeX
+ { "lervag/vimtex", ft = "tex", config = require("config.vimtex") },
+
+ -- Grammar & Spell Checking
+ { "rhysd/vim-grammarous", ft = "tex" },
+
+ -- Tab Bar
+ {
+ "romgrk/barbar.nvim",
+ dependencies = {
+ "lewis6991/gitsigns.nvim", -- optional: for git status
+ "nvim-tree/nvim-web-devicons", -- optional: for file icons
+ },
+ version = "^1.0.0",
+ config = require("config.tabs"),
+ },
+
+ {
+ "lukas-reineke/indent-blankline.nvim",
+ main = "ibl",
+ ---@module "ibl"
+ ---@type ibl.config
+ opts = {},
+ config = require("config.indent"),
+ },
+
+ -- Dashboard
+ { "nvimdev/dashboard-nvim", event = "VimEnter", dependencies = { "nvim-tree/nvim-web-devicons" }, config = require("config.dashboard") },
+
+ -- Hex Editing
+ { 'ArcaneSpecs/HexEditor.nvim',
+ config = function()
+ require("config.hex")() -- note the () if your lsp.lua returns a function
+ end,
+ },
+
+
+ -- Themes
+ "martinsione/darkplus.nvim",
+ "folke/tokyonight.nvim",
+ "navarasu/onedark.nvim",
+ "EdenEast/nightfox.nvim"
+
+}
+
diff --git a/nvim/.config/nvim/lua/plugins/test.c b/nvim/.config/nvim/lua/plugins/test.c
new file mode 100644
index 0000000..bdba367
--- /dev/null
+++ b/nvim/.config/nvim/lua/plugins/test.c
@@ -0,0 +1,114 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
+#define MAX_NAME_LEN 50
+#define ARRAY_SIZE 5
+
+typedef enum {
+ STUDENT,
+ TEACHER,
+ STAFF
+} Role;
+
+typedef struct {
+ char name[MAX_NAME_LEN];
+ int age;
+ Role role;
+ float grades[ARRAY_SIZE];
+} Person;
+
+// Function declarations
+void print_person(const Person* p);
+float average_grade(const Person* p);
+Person* create_person(const char* name, int age, Role role);
+void fill_random_grades(Person* p);
+void print_all(Person** people, int count);
+void free_all(Person** people, int count);
+int find_oldest(Person** people, int count);
+
+int main() {
+ Person* people[ARRAY_SIZE];
+
+ people[0] = create_person("Alice", 20, STUDENT);
+ people[1] = create_person("Bob", 35, TEACHER);
+ people[2] = create_person("Charlie", 28, STAFF);
+ people[3] = create_person("Diana", 22, STUDENT);
+ people[4] = create_person("Ethan", 40, TEACHER);
+
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ fill_random_grades(people[i]);
+ }
+
+ print_all(people, ARRAY_SIZE);
+
+ int oldest_index = find_oldest(people, ARRAY_SIZE);
+ printf("\nOldest person is: %s, Age: %d\n", people[oldest_index]->name, people[oldest_index]->age);
+
+ free_all(people, ARRAY_SIZE);
+
+ return 0;
+}
+
+void print_person(const Person* p) {
+ const char* role_names[] = {"Student", "Teacher", "Staff"};
+ printf("Name: %s\n", p->name);
+ printf("Age: %d\n", p->age);
+ printf("Role: %s\n", role_names[p->role]);
+ printf("Grades: ");
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ printf("%.2f ", p->grades[i]);
+ }
+ printf("\nAverage Grade: %.2f\n\n", average_grade(p));
+}
+
+float average_grade(const Person* p) {
+ float sum = 0;
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ sum += p->grades[i];
+ }
+ return sum / ARRAY_SIZE;
+}
+
+Person* create_person(const char* name, int age, Role role) {
+ Person* p = (Person*)malloc(sizeof(Person));
+ if (!p) {
+ fprintf(stderr, "Memory allocation failed\n");
+ exit(1);
+ }
+ strncpy(p->name, name, MAX_NAME_LEN);
+ p->age = age;
+ p->role = role;
+ memset(p->grades, 0, sizeof(p->grades));
+ return p;
+}
+
+void fill_random_grades(Person* p) {
+ for (int i = 0; i < ARRAY_SIZE; i++) {
+ p->grades[i] = (float)(rand() % 101); // 0 to 100
+ }
+}
+
+void print_all(Person** people, int count) {
+ for (int i = 0; i < count; i++) {
+ print_person(people[i]);
+ }
+}
+
+void free_all(Person** people, int count) {
+ for (int i = 0; i < count; i++) {
+ free(people[i]);
+ }
+}
+
+int find_oldest(Person** people, int count) {
+ int oldest_index = 0;
+ for (int i = 1; i < count; i++) {
+ if (people[i]->age > people[oldest_index]->age) {
+ oldest_index = i;
+ }
+ }
+ return oldest_index;
+}
+