diff --git a/init.lua b/init.lua index 9bc8238..b6dbc92 100644 --- a/init.lua +++ b/init.lua @@ -53,19 +53,19 @@ ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ROOTIEST ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Rootiest Configuration -require("config.rootiest").setup() -- Set up Rootiest options +require('config.rootiest').setup() -- Set up Rootiest options ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ LAZY ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Load Lazy package manager and plugins -require("config.lazy") -- Bootstrap lazy.nvim and initialize plugins +require('config.lazy') -- Bootstrap lazy.nvim and initialize plugins ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ROCKS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Load LuaRocks package manager and plugins -require("config.rocks") -- Bootstrap LuaRocks and initialize plugins +require('config.rocks') -- Bootstrap LuaRocks and initialize plugins ---━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ PROFILING ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Load profiling package -require("config.profile") -- Set profiling options with environment variables: +require('config.profile') -- Set profiling options with environment variables: -- ╭─────────────────────────────────────────────────────────────────────╮ -- │ NVIM_PROFILE=1 Start profiling at startup │ -- │ NVIM_PROFILE_MODULE="lualine" Set profiling target module │ diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index d203a34..e8d6b53 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -7,47 +7,47 @@ local autogrp = vim.api.nvim_create_augroup local autocmd = vim.api.nvim_create_autocmd -- LazyGit root detection -if pcall(require, "lazygit.utils") then - autocmd("BufEnter", { - pattern = "*", +if pcall(require, 'lazygit.utils') then + autocmd('BufEnter', { + pattern = '*', callback = function() - require("lazygit.utils").project_root_dir() + require('lazygit.utils').project_root_dir() end, }) end -- ━━━━━━━━━━━━━━━━━━━━━━━ Set up Qalc keymappings ━━━━━━━━━━━━━━━━━━━━━━━ -if pcall(require, "qalc") then +if pcall(require, 'qalc') then -- Create a group for filetype-specific mappings - autogrp("QalcFileTypeMappings", { clear = true }) + autogrp('QalcFileTypeMappings', { clear = true }) -- Create an autocommand for the qalc filetype - autocmd("FileType", { - pattern = "qalc", - group = "QalcFileTypeMappings", + autocmd('FileType', { + pattern = 'qalc', + group = 'QalcFileTypeMappings', callback = function() -- Set the key mapping: 'y' to run the :QalcYank command in normal mode vim.keymap.set( -- Yank Result - "n", - "y", - ":QalcYank +", + 'n', + 'y', + ':QalcYank +', { noremap = true, silent = true } ) -- Set the key mapping: 'q' to run the :QalcClose command in normal mode vim.keymap.set( -- Close Qalc - "n", - "q", - ":QalcClose", + 'n', + 'q', + ':QalcClose', { noremap = true, silent = true } ) end, }) -- Define a custom command to close the Qalc buffer - vim.api.nvim_create_user_command("QalcClose", function() + vim.api.nvim_create_user_command('QalcClose', function() local buf_name = vim.api.nvim_buf_get_name(0) - if buf_name ~= "" then - vim.cmd("bd!") + if buf_name ~= '' then + vim.cmd('bd!') else -- If the buffer has no name, just remove it without invoking :bd! vim.api.nvim_buf_delete(0, { force = true }) @@ -56,19 +56,19 @@ if pcall(require, "qalc") then end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Set up highlights ━━━━━━━━━━━━━━━━━━━━━━━━━━ -local load_highlight = require("utils.highlight") +local load_highlight = require('utils.highlight') load_highlight.setup_autocommands() load_highlight.setup_dashboard_highlight() -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Set up cpp picker ━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Adds a keymap for quicker picking when in cpp files -require("data.autocmd").cpp_picker() +require('data.autocmd').cpp_picker() -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Set up nvim_exec ━━━━━━━━━━━━━━━━━━━━━━━ -- Function to check and execute the NVIM_EXEC environment variable local function execute_nvim_exec() - local exec_command = os.getenv("NVIM_EXEC") + local exec_command = os.getenv('NVIM_EXEC') -- If NVIM_EXEC is set, execute the command if exec_command then @@ -77,9 +77,9 @@ local function execute_nvim_exec() end -- Define an autogroup for the autocmd -autogrp("NvimExec", { clear = true }) +autogrp('NvimExec', { clear = true }) -- Define an autocmd to run the function at startup -autocmd("VimEnter", { - group = "NvimExec", +autocmd('VimEnter', { + group = 'NvimExec', callback = execute_nvim_exec, }) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 3e40c79..bd8af73 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -10,49 +10,49 @@ -- be defined in a single central location -- Add keymapper function -local add_keymap = require("data.func").add_keymap +local add_keymap = require('data.func').add_keymap -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Group Keybinds ━━━━━━━━━━━━━━━━━━━━━━━━ -- Add keymaps for menu groups -for _, item in ipairs(require("data.keys").groups) do +for _, item in ipairs(require('data.keys').groups) do add_keymap(item) end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ General Keybinds ━━━━━━━━━━━━━━━━━━━━━━━ -- Add keymaps for miscellaneous keybinds -for _, item in ipairs(require("data.keys").misc) do +for _, item in ipairs(require('data.keys').misc) do add_keymap(item) end -- ━━━━━━━━━━━━━━━━━━━━━━━━━ Telescope Keybinds ━━━━━━━━━━━━━━━━━━━━━━ -- Add keymaps for telescope symbols -for _, item in ipairs(require("data.keys").telescope.symbols) do +for _, item in ipairs(require('data.keys').telescope.symbols) do add_keymap(item) end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Resizing splits ━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Add keymaps for resizing splits -for _, map in ipairs(require("data.keys").splits.resize) do - add_keymap(map[1], map[2], map[3], require("data.types").all_modes) +for _, map in ipairs(require('data.keys').splits.resize) do + add_keymap(map[1], map[2], map[3], require('data.types').all_modes) end -- ━━━━━━━━━━━━━━━━━━━━━━━━ Moving between splits ━━━━━━━━━━━━━━━━━━━━━━━━ -- Add keymaps for moving between splits -for _, map in ipairs(require("data.keys").splits.move) do - add_keymap(map[1], map[2], map[3], require("data.types").all_modes) +for _, map in ipairs(require('data.keys').splits.move) do + add_keymap(map[1], map[2], map[3], require('data.types').all_modes) end -- ━━━━━━━━━━━━━━━━━━ Swapping buffers between windows ━━━━━━━━━━━━━━━ -- Add keymaps for swapping buffers -for _, map in ipairs(require("data.keys").splits.swap) do - add_keymap(map[1], map[2], map[3], require("data.types").all_modes) +for _, map in ipairs(require('data.keys').splits.swap) do + add_keymap(map[1], map[2], map[3], require('data.types').all_modes) end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ MultiCursor ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -- Add keymaps for multicursor -for _, item in ipairs(require("data.keys").multicursor) do +for _, item in ipairs(require('data.keys').multicursor) do add_keymap(item) end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Overrides ━━━━━━━━━━━━━━━━━━━━━━━━━━ -require("config.overrides") +require('config.overrides') diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 0d1f888..30c40c2 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -4,7 +4,7 @@ -- ╭─────────────────────────────────────────────────────────╮ -- │ Lazy │ -- ╰─────────────────────────────────────────────────────────╯ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' if not vim.uv.fs_stat(lazypath) then -- stylua: ignore vim.fn.system({ @@ -21,27 +21,28 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath) local plugin_specs = { { - "LazyVim/LazyVim", -- LazyVim - import = "lazyvim.plugins", -- LazyVim Core Plugins + 'LazyVim/LazyVim', -- LazyVim + import = 'lazyvim.plugins', -- LazyVim Core Plugins }, { -- VSCode - import = "lazyvim.plugins.extras.vscode", + import = 'lazyvim.plugins.extras.vscode', }, - { import = "plugins" }, -- General Plugins + { import = 'plugins' }, -- General Plugins } -- Automatically import all subdirectories of `lua/plugins` -local plugin_dirs = vim.fn.glob("~/.config/nvim/lua/plugins/*", true, true) +local plugin_dirs = vim.fn.glob('~/.config/nvim/lua/plugins/*', true, true) for _, dir in ipairs(plugin_dirs) do if vim.fn.isdirectory(dir) == 1 then table.insert( -- Add directory to the plugin import table plugin_specs, - { import = "plugins." .. vim.fn.fnamemodify(dir, ":t") } + { import = 'plugins.' .. vim.fn.fnamemodify(dir, ':t') } ) end end -require("lazy").setup({ +-- Initialize Lazy plugin manager +require('lazy').setup({ spec = plugin_specs, rocks = { hererocks = true, @@ -52,12 +53,12 @@ require("lazy").setup({ }, install = { missing = true, - colorscheme = { "catppuccin-mocha", "tokyonight", "default" }, + colorscheme = { 'catppuccin-mocha', 'tokyonight', 'default' }, }, defaults = { lazy = true, version = nil, - event = "VeryLazy", + event = 'VeryLazy', }, checker = { -- automatically check for plugin updates @@ -78,7 +79,7 @@ require("lazy").setup({ reset_packpath = true, rtp = { reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory - disabled_plugins = require("data.types").lazy.disabled_plugins, + disabled_plugins = require('data.types').lazy.disabled_plugins, }, }, profiling = { @@ -86,7 +87,7 @@ require("lazy").setup({ require = true, }, ui = { - border = "rounded", - title = " Plugin Manager ", + border = 'rounded', + title = ' Plugin Manager ', }, }) diff --git a/lua/config/minifiles.lua b/lua/config/minifiles.lua index 2577992..bc82bef 100644 --- a/lua/config/minifiles.lua +++ b/lua/config/minifiles.lua @@ -2,9 +2,9 @@ -- │ Setup Git Signs for Mini.Files │ -- ╰─────────────────────────────────────────────────────────╯ -local nsMiniFiles = vim.api.nvim_create_namespace("mini_files_git") +local nsMiniFiles = vim.api.nvim_create_namespace('mini_files_git') local autocmd = vim.api.nvim_create_autocmd -local _, MiniFiles = pcall(require, "mini.files") +local _, MiniFiles = pcall(require, 'mini.files') -- Cache for git status local gitStatusCache = {} @@ -33,7 +33,7 @@ local function mapSymbols(status) -- stylua: ignore end } - local result = statusMap[status] or { symbol = "?", hlGroup = "NonText" } + local result = statusMap[status] or { symbol = '?', hlGroup = 'NonText' } return result.symbol, result.hlGroup end @@ -48,7 +48,7 @@ local function fetchGitStatus(cwd, callback) end end vim.system( - { "git", "status", "--ignored", "--porcelain" }, + { 'git', 'status', '--ignored', '--porcelain' }, { text = true, cwd = cwd }, on_exit ) @@ -57,7 +57,7 @@ end ---@param str string? local function escapePattern(str) ---@diagnostic disable-next-line: need-check-nil - return str:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1") + return str:gsub('([%^%$%(%)%%%.%[%]%*%+%-%?])', '%%%1') end ---@param buf_id integer @@ -66,10 +66,10 @@ end local function updateMiniWithGit(buf_id, gitStatusMap) vim.schedule(function() local nlines = vim.api.nvim_buf_line_count(buf_id) - local cwd = vim.fs.root(buf_id, ".git") + local cwd = vim.fs.root(buf_id, '.git') local escapedcwd = escapePattern(cwd) - if vim.fn.has("win32") == 1 then - escapedcwd = escapedcwd:gsub("\\", "/") + if vim.fn.has('win32') == 1 then + escapedcwd = escapedcwd:gsub('\\', '/') end for i = 1, nlines do @@ -77,7 +77,7 @@ local function updateMiniWithGit(buf_id, gitStatusMap) if not entry then break end - local relativePath = entry.path:gsub("^" .. escapedcwd .. "/", "") + local relativePath = entry.path:gsub('^' .. escapedcwd .. '/', '') local status = gitStatusMap[relativePath] if status then @@ -99,19 +99,19 @@ end local function parseGitStatus(content) local gitStatusMap = {} -- lua match is faster than vim.split (in my experience ) - for line in content:gmatch("[^\r\n]+") do - local status, filePath = string.match(line, "^(..)%s+(.*)") + for line in content:gmatch('[^\r\n]+') do + local status, filePath = string.match(line, '^(..)%s+(.*)') -- Split the file path into parts local parts = {} - for part in filePath:gmatch("[^/]+") do + for part in filePath:gmatch('[^/]+') do table.insert(parts, part) end -- Start with the root directory - local currentKey = "" + local currentKey = '' for i, part in ipairs(parts) do if i > 1 then -- Concatenate parts with a separator to create a unique key - currentKey = currentKey .. "/" .. part + currentKey = currentKey .. '/' .. part else currentKey = part end @@ -133,11 +133,11 @@ end ---@return nil local function updateGitStatus(buf_id) ---@diagnostic disable-next-line: param-type-mismatch - if not vim.fs.root(vim.uv.cwd(), ".git") then + if not vim.fs.root(vim.uv.cwd(), '.git') then return end - local cwd = vim.fn.expand("%:p:h") + local cwd = vim.fn.expand('%:p:h') local currentTime = os.time() if gitStatusCache[cwd] @@ -162,12 +162,12 @@ local function clearCache() end local function augroup(name) - return vim.api.nvim_create_augroup("MiniFiles_" .. name, { clear = true }) + return vim.api.nvim_create_augroup('MiniFiles_' .. name, { clear = true }) end -autocmd("User", { - group = augroup("start"), - pattern = "MiniFilesExplorerOpen", +autocmd('User', { + group = augroup('start'), + pattern = 'MiniFilesExplorerOpen', -- pattern = { "minifiles" }, callback = function() local bufnr = vim.api.nvim_get_current_buf() @@ -175,20 +175,20 @@ autocmd("User", { end, }) -autocmd("User", { - group = augroup("close"), - pattern = "MiniFilesExplorerClose", +autocmd('User', { + group = augroup('close'), + pattern = 'MiniFilesExplorerClose', callback = function() clearCache() end, }) -autocmd("User", { - group = augroup("update"), - pattern = "MiniFilesBufferUpdate", +autocmd('User', { + group = augroup('update'), + pattern = 'MiniFilesBufferUpdate', callback = function(sii) local bufnr = sii.data.buf_id - local cwd = vim.fn.expand("%:p:h") + local cwd = vim.fn.expand('%:p:h') if gitStatusCache[cwd] then updateMiniWithGit(bufnr, gitStatusCache[cwd].statusMap) end diff --git a/lua/config/neovide.lua b/lua/config/neovide.lua index c779a7e..858c8fa 100644 --- a/lua/config/neovide.lua +++ b/lua/config/neovide.lua @@ -3,14 +3,15 @@ -- ╭─────────────────────────────────────────────────────────╮ -- │ Neovide │ -- ╰─────────────────────────────────────────────────────────╯ + -- Set GUI font -vim.opt.guifont = "Iosevka Rootiest V2:#e-subpixelantialias:h12" +vim.opt.guifont = 'Iosevka Rootiest V2:#e-subpixelantialias:h12' -- refresh rate and translucency vim.g.neovide_refresh_rate = 120 vim.g.neovide_transparency = 0.85 vim.g.neovide_window_blurred = true -- cursor fx -vim.g.neovide_cursor_vfx_mode = "pixiedust" +vim.g.neovide_cursor_vfx_mode = 'pixiedust' vim.g.neovide_cursor_smooth_blink = true vim.g.neovide_cursor_vfx_particle_density = 16.0 vim.g.neovide_cursor_vfx_particle_lifetime = 2.1 @@ -35,26 +36,26 @@ vim.g.neovide_padding_left = 0 -- ━━━━━━━━━━━━━━━━━━━━━━━━━ Clipboard mappings ━━━━━━━━━━━━━━━━━━━━━━ -local modes = { "n", "v", "c", "i" } +local modes = { 'n', 'v', 'c', 'i' } -- System clipboard mappings for _, mode in ipairs(modes) do - if mode == "c" or mode == "i" then - vim.keymap.set(mode, "", "+", { silent = true }) - vim.keymap.set(mode, "", "+", { silent = true }) + if mode == 'c' or mode == 'i' then + vim.keymap.set(mode, '', '+', { silent = true }) + vim.keymap.set(mode, '', '+', { silent = true }) else - vim.keymap.set(mode, "", ":r !xsel -b", { silent = true }) - vim.keymap.set(mode, "", ":w !xsel -i -b", { silent = true }) + vim.keymap.set(mode, '', ':r !xsel -b', { silent = true }) + vim.keymap.set(mode, '', ':w !xsel -i -b', { silent = true }) end end -- Wezterm-style clipboard mappings (Control-Shift) for _, mode in ipairs(modes) do - if mode == "c" or mode == "i" then - vim.keymap.set(mode, "", "+", { silent = true }) - vim.keymap.set(mode, "", "+", { silent = true }) + if mode == 'c' or mode == 'i' then + vim.keymap.set(mode, '', '+', { silent = true }) + vim.keymap.set(mode, '', '+', { silent = true }) else - vim.keymap.set(mode, "", ":r !xsel -b", { silent = true }) - vim.keymap.set(mode, "", ":w !xsel -i -b", { silent = true }) + vim.keymap.set(mode, '', ':r !xsel -b', { silent = true }) + vim.keymap.set(mode, '', ':w !xsel -i -b', { silent = true }) end end diff --git a/lua/config/nvim_updater.lua b/lua/config/nvim_updater.lua new file mode 100644 index 0000000..186f7e8 --- /dev/null +++ b/lua/config/nvim_updater.lua @@ -0,0 +1,17 @@ +-- ╭─────────────────────────────────────────────────────────╮ +-- │ Neovim Updater Debug Functions │ +-- ╰─────────────────────────────────────────────────────────╯ + +local D = {} + +-- local P = require("nvim_updater") +local U = require('nvim_updater.utils') + +function D.test_floating_window() + local output = U.run_hidden_command( + "cd ~/.local/src/neovim && git --no-pager log --pretty=format:'%s' HEAD..origin/master" + ) + U.draw_floating_window(output) +end + +return D diff --git a/lua/config/options.lua b/lua/config/options.lua index 9eab8d8..29d7190 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -8,6 +8,8 @@ -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ KEYS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +vim.opt.foldlevel = 99 + -- Set the mapleader variable to the space key vim.g.mapleader = " " ---@type string Options: @@ -68,7 +70,7 @@ vim.g.usetodo = false ---@type boolean Options: -- Use dev mode for rootiest plugins -vim.g.rootiest_dev = false ---@type boolean Options: +vim.g.rootiest_dev = true ---@type boolean Options: -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ PICKER ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -105,6 +107,9 @@ vim.g.useavante = true ---@type boolean Options: +----- Use Blink instead of nvim-cmp ----- +vim.g.useblinkcmp = true ---@type boolean Options: + -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ STATUS COLUMN ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ vim.g.statuscolumn = "native" ---@type string Options: [statuscolumn] diff --git a/lua/config/overrides.lua b/lua/config/overrides.lua index b575b3f..04c5004 100644 --- a/lua/config/overrides.lua +++ b/lua/config/overrides.lua @@ -5,33 +5,33 @@ -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Keymap Overrides ━━━━━━━━━━━━━━━━━━━━━━━ -- Add keymapper function -local add_keymap = require("data.func").add_keymap +local add_keymap = require('data.func').add_keymap -- Add keymaps for overrides -add_keymap(require("data.keys").overrides) +add_keymap(require('data.keys').overrides) -- Replace '...' with '…' (ellipsis) on InsertLeave -require("data.func").setup_replace_ellipsis(true) +require('data.func').setup_replace_ellipsis(true) -- Search selected text in visual mode -add_keymap("/", "*", "Search selected text", "v") +add_keymap('/', '*', 'Search selected text', 'v') -- Use modern cipher instead of rot13 -add_keymap(require("data.keys").cipher.hex) +add_keymap(require('data.keys').cipher.hex) -- Help keybinds -for _, item in ipairs(require("data.keys").help) do +for _, item in ipairs(require('data.keys').help) do add_keymap(item) end -- Remap Command Mode List -require("data.keys").cmd_mode() +require('data.keys').cmd_mode() -- ━━━━━━━━━━━━━━━━━━━━━━━━ Additional Overrides ━━━━━━━━━━━━━━━━━━━━━ if vim.g.is_termux then - if require("data.func").is_installed("neominimap") then + if require('data.func').is_installed('neominimap') then -- Disable NeoMiniMap - vim.cmd("Neominimap off") + vim.cmd('Neominimap off') end end diff --git a/lua/config/postopts.lua b/lua/config/postopts.lua index 37bf76f..e0e39ca 100644 --- a/lua/config/postopts.lua +++ b/lua/config/postopts.lua @@ -1,10 +1,10 @@ -- ━━━━━━━━━━━━━━━━━━━━━━━━ Post-Config Functions ━━━━━━━━━━━━━━━━━━━━━━━━ -- Setup blinky cursor -require("utils.blinky").setup(vim.g.blinky) +require('utils.blinky').setup(vim.g.blinky) -- Setup nvim-remote -if vim.fn.executable("nvr") == 1 then +if vim.fn.executable('nvr') == 1 then vim.env.GIT_EDITOR = "nvr -cc split --remote-wait +'set bufhidden=wipe'" end @@ -13,7 +13,7 @@ local prefix = vim.env.PREFIX -- Check if prefix contains "com.termux" if prefix ~= nil then - if prefix:match("com.termux") then + if prefix:match('com.termux') then vim.g.useimage = false vim.g.is_termux = true end diff --git a/lua/config/profile.lua b/lua/config/profile.lua index 5986380..8d7ec22 100644 --- a/lua/config/profile.lua +++ b/lua/config/profile.lua @@ -12,32 +12,32 @@ -- ╰─────────────────────────────────────────────────────────╯ -- Check if the environment variable is set -local should_profile = os.getenv("NVIM_PROFILE") -local profile_module = os.getenv("NVIM_PROFILE_MODULE") or "*" +local should_profile = os.getenv('NVIM_PROFILE') +local profile_module = os.getenv('NVIM_PROFILE_MODULE') or '*' -- Start the profiler if should_profile then - require("profile").instrument_autocmds() - if should_profile:lower():match("^start") then - require("profile").start(profile_module) + require('profile').instrument_autocmds() + if should_profile:lower():match('^start') then + require('profile').start(profile_module) else - require("profile").instrument(profile_module) + require('profile').instrument(profile_module) end end -- Function to toggle the profiler local function toggle_profile() - local prof = require("profile") + local prof = require('profile') if prof.is_recording() then prof.stop() vim.ui.input({ - prompt = "Save profile to:", - completion = "file", - default = "profile.json", + prompt = 'Save profile to:', + completion = 'file', + default = 'profile.json', }, function(filename) if filename then prof.export(filename) - vim.notify(string.format("Wrote %s", filename)) + vim.notify(string.format('Wrote %s', filename)) end end) else @@ -46,11 +46,11 @@ local function toggle_profile() end -- Add the keybind to toggle the profiler -require("data").func.add_keymap("d", function() +require('data').func.add_keymap('d', function() local prof_name = profile_module - if profile_module == "*" then - prof_name = "all" + if profile_module == '*' then + prof_name = 'all' end - print("Profiling module: " .. prof_name) + print('Profiling module: ' .. prof_name) toggle_profile() -end, "Toggle Profiler") +end, 'Toggle Profiler') diff --git a/lua/config/rocks.lua b/lua/config/rocks.lua index 66120cc..77e0a0b 100644 --- a/lua/config/rocks.lua +++ b/lua/config/rocks.lua @@ -10,66 +10,66 @@ local M = {} function M.bootstrap() do local rocks_config = { - rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks", + rocks_path = vim.env.HOME .. '/.local/share/nvim/rocks', } vim.g.rocks_nvim = rocks_config local luarocks_path = { - vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"), + vim.fs.joinpath(rocks_config.rocks_path, 'share', 'lua', '5.1', '?.lua'), vim.fs.joinpath( rocks_config.rocks_path, - "share", - "lua", - "5.1", - "?", - "init.lua" + 'share', + 'lua', + '5.1', + '?', + 'init.lua' ), } - package.path = package.path .. ";" .. table.concat(luarocks_path, ";") + package.path = package.path .. ';' .. table.concat(luarocks_path, ';') local luarocks_cpath = { - vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"), - vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"), + vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.so'), + vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.so'), -- Remove the dylib and dll paths if you do not need macos or windows support - vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"), + vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.dylib'), vim.fs.joinpath( rocks_config.rocks_path, - "lib64", - "lua", - "5.1", - "?.dylib" + 'lib64', + 'lua', + '5.1', + '?.dylib' ), - vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"), - vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"), + vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.dll'), + vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.dll'), } - package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";") + package.cpath = package.cpath .. ';' .. table.concat(luarocks_cpath, ';') vim.opt.runtimepath:append( vim.fs.joinpath( rocks_config.rocks_path, - "lib", - "luarocks", - "rocks-5.1", - "rocks.nvim", - "*" + 'lib', + 'luarocks', + 'rocks-5.1', + 'rocks.nvim', + '*' ) ) end -- If rocks.nvim is not installed then install it! - if not pcall(require, "rocks") then + if not pcall(require, 'rocks') then local rocks_location = ---@diagnostic disable-next-line: param-type-mismatch - vim.fs.joinpath(vim.fn.stdpath("cache"), "rocks.nvim") + vim.fs.joinpath(vim.fn.stdpath('cache'), 'rocks.nvim') if not vim.uv.fs_stat(rocks_location) then -- Pull down rocks.nvim vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/nvim-neorocks/rocks.nvim", + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/nvim-neorocks/rocks.nvim', rocks_location, }) end @@ -77,24 +77,24 @@ function M.bootstrap() -- If the clone was successful then source the bootstrapping script assert( vim.v.shell_error == 0, - "rocks.nvim installation failed. Try exiting and re-entering Neovim!" + 'rocks.nvim installation failed. Try exiting and re-entering Neovim!' ) - vim.cmd.source(vim.fs.joinpath(rocks_location, "bootstrap.lua")) + vim.cmd.source(vim.fs.joinpath(rocks_location, 'bootstrap.lua')) - vim.fn.delete(rocks_location, "rf") + vim.fn.delete(rocks_location, 'rf') end end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━ Ensure Luarocks ━━━━━━━━━━━━━━━━━━━━━━━ function M.ensure_luarocks() -- Check if 'luarocks' command is available - if os.execute("luarocks --version") ~= 0 then + if os.execute('luarocks --version') ~= 0 then -- 'luarocks' is not installed, set up 'luarocks.nvim' plugin - local status_ok, lazy = pcall(require, "lazy") + local status_ok, lazy = pcall(require, 'lazy') if not status_ok then vim.notify( - "Lazy.nvim not found. Please install it to manage plugins.", + 'Lazy.nvim not found. Please install it to manage plugins.', vim.log.levels.ERROR ) return @@ -102,14 +102,14 @@ function M.ensure_luarocks() lazy.setup({ { - "vhyrro/luarocks.nvim", + 'vhyrro/luarocks.nvim', priority = 1000, -- Ensure this plugin loads first opts = { - rocks = { "magick" }, -- Example of a rock that you want to install + rocks = { 'magick' }, -- Example of a rock that you want to install }, config = function() -- Restart Neovim to apply changes after 'luarocks.nvim' sets up - vim.cmd("source $MYVIMRC | qa") + vim.cmd('source $MYVIMRC | qa') end, }, }) @@ -117,17 +117,17 @@ function M.ensure_luarocks() end -- ━━━━━━━━━━━━━━━━━━━━━━━━━━ Rocks plugin spec ━━━━━━━━━━━━━━━━━━━━━━ M.plugin_spec = { - "vhyrro/luarocks.nvim", + 'vhyrro/luarocks.nvim', priority = 1000, -- Very high priority is required opts = { - rocks = { "magick" }, -- specifies a list of rocks to install + rocks = { 'magick' }, -- specifies a list of rocks to install }, } -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Load plugins ━━━━━━━━━━━━━━━━━━━━━━━━━ -- Load rocks package manager M.load_rocks = function() - require("rocks") + require('rocks') end -- Perform setup diff --git a/lua/config/rootiest.lua b/lua/config/rootiest.lua index f7fb4fe..234ff0f 100644 --- a/lua/config/rootiest.lua +++ b/lua/config/rootiest.lua @@ -10,18 +10,18 @@ local M = {} ---@param message string The error message to trigger ---@return boolean condition true if the error message was triggered, false otherwise local function trigger_error(message) - return require("data").func.notify(message, "ERROR") + return require('data').func.notify(message, 'ERROR') end local function setup_os_vars() -- Check if we are on windows - vim.g.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1 + vim.g.is_windows = vim.fn.has('win32') == 1 or vim.fn.has('win64') == 1 end --- Yank line without leading/trailing whitespace ---@return nil function M.yank_line() - vim.api.nvim_feedkeys("_v$hy$", "n", true) + vim.api.nvim_feedkeys('_v$hy$', 'n', true) end -- Variable to track if the precognition plugin has been called once @@ -30,9 +30,9 @@ local precog_first_time = true --- Toggle the precognition plugin ---@return nil function M.toggle_precognition() - if pcall(require, "precognition") then + if pcall(require, 'precognition') then -- Initialize precognition plugin - local precognition = require("precognition") + local precognition = require('precognition') -- Toggle the plugin if precog_first_time then precognition.toggle() @@ -42,19 +42,19 @@ function M.toggle_precognition() precognition.toggle() -- Call toggle once end else - trigger_error("precognition plugin is not installed") + trigger_error('precognition plugin is not installed') end end --- Toggle Hardtime and Precognition together ---@return nil function M.toggle_hardmode() - if pcall(require, "hardtime") then - local hardtime = require("hardtime") + if pcall(require, 'hardtime') then + local hardtime = require('hardtime') hardtime.toggle() M.toggle_precognition() else - trigger_error("hardtime plugin is not installed") + trigger_error('hardtime plugin is not installed') end end @@ -63,18 +63,18 @@ end ---@param size number|nil The size of the terminal split (default: 0.3) ---@return boolean condition true if the terminal was toggled, false otherwise function M.toggle_lazygit_term(direction, size) - if pcall(require, "toggleterm.terminal") then - local Terminal = require("toggleterm.terminal").Terminal + if pcall(require, 'toggleterm.terminal') then + local Terminal = require('toggleterm.terminal').Terminal local lazygit = Terminal:new({ - cmd = "lazygit", + cmd = 'lazygit', hidden = true, - direction = direction or "horizontal", -- Set direction to horizontal split + direction = direction or 'horizontal', -- Set direction to horizontal split size = size or 0.3, -- Set size to 30% of the screen }) lazygit:toggle() return true else - trigger_error("toggleterm plugin is not installed") + trigger_error('toggleterm plugin is not installed') return false end end @@ -83,23 +83,23 @@ end ---@param my_args string|nil The arguments to pass to the lazygit command (default: nil) ---@return boolean condition true if the terminal was toggled, false otherwise function M.toggle_lazygit_float(my_args) - if pcall(require, "toggleterm.terminal") then - local Util = require("lazyvim.util") + if pcall(require, 'toggleterm.terminal') then + local Util = require('lazyvim.util') my_args = my_args or nil - if my_args ~= "" or my_args ~= nil then + if my_args ~= '' or my_args ~= nil then Util.terminal.open( - { "lazygit", my_args }, + { 'lazygit', my_args }, { cwd = Util.root(), interactive = true, esc_esc = false } ) else Util.terminal.open( - { "lazygit" }, + { 'lazygit' }, { cwd = Util.root(), interactive = true, esc_esc = false } ) end return true else - trigger_error("toggleterm plugin is not installed") + trigger_error('toggleterm plugin is not installed') return false end end @@ -107,13 +107,13 @@ end --- Load remote-nvim plugin ---@return boolean condition true if the plugin was loaded, false otherwise function M.load_remote() - if pcall(require, "remote-nvim") then + if pcall(require, 'remote-nvim') then ---@diagnostic disable-next-line: missing-parameter - require("remote-nvim").setup() - vim.cmd("RemoteStart") + require('remote-nvim').setup() + vim.cmd('RemoteStart') return true else - trigger_error("remote-nvim plugin is not installed") + trigger_error('remote-nvim plugin is not installed') return false end end @@ -122,19 +122,19 @@ end --- @return boolean true if any text was pasted successfully, false otherwise function M.YankAndPasteInQuotes() -- Yank text inside quotes on the current line - vim.cmd("normal! yiq") + vim.cmd('normal! yiq') -- Get the yanked text from the "0 register (the unnamed register) local yanked_text = vim.fn.getreg('"') -- List of marks to check ('a' to 'z') - local marks = "abcdefghijklmnopqrstuvwxyz" + local marks = 'abcdefghijklmnopqrstuvwxyz' -- Flag to track if any pasting was successful local was_pasted = false -- Loop through each mark - for mark in marks:gmatch(".") do + for mark in marks:gmatch('.') do -- Check if the mark exists (returns the line number or nil) local position = vim.fn.getpos("'" .. mark) @@ -143,8 +143,8 @@ function M.YankAndPasteInQuotes() vim.cmd("normal! '" .. mark) -- Select text inside quotes and paste the yanked text - vim.cmd("normal! viq") - vim.cmd('normal! "' .. yanked_text .. "P") + vim.cmd('normal! viq') + vim.cmd('normal! "' .. yanked_text .. 'P') -- Set the flag to true since pasting was successful was_pasted = true @@ -159,7 +159,7 @@ end ---@return boolean condition true if Neovide is active, false otherwise function M.eval_neovide() if vim.g.neovide then - require("config.neovide") + require('config.neovide') return true else return false @@ -170,14 +170,14 @@ end ---@return nil function M.define_commands() -- Define Q as a usercmd - vim.api.nvim_create_user_command("Q", "qall", { desc = "Quit all buffers" }) + vim.api.nvim_create_user_command('Q', 'qall', { desc = 'Quit all buffers' }) -- Define yank line command - vim.api.nvim_create_user_command("YankLine", function() + vim.api.nvim_create_user_command('YankLine', function() M.yank_line() - end, { force = true, desc = "Yank line without leading whitespace" }) + end, { force = true, desc = 'Yank line without leading whitespace' }) vim.api.nvim_create_user_command( - "YankAndPasteQuotes", + 'YankAndPasteQuotes', M.YankAndPasteInQuotes, {} ) @@ -190,9 +190,9 @@ function M.setup() M.define_commands() -- Setup types data - require("data.types").setup() + require('data.types').setup() -- Setup indentor - require("utils.indentor") + require('utils.indentor') end return M diff --git a/lua/data/autocmd.lua b/lua/data/autocmd.lua index c7eba8f..a834cc0 100644 --- a/lua/data/autocmd.lua +++ b/lua/data/autocmd.lua @@ -9,13 +9,13 @@ local augroup = vim.api.nvim_create_augroup local autocmd = vim.api.nvim_create_autocmd M.cpp_picker = function() - augroup("cpp_picker", { clear = true }) + augroup('cpp_picker', { clear = true }) -- C++ Picker - autocmd("FileType", { - group = "cpp_picker", - pattern = { "cpp", "c", "h", "hpp" }, + autocmd('FileType', { + group = 'cpp_picker', + pattern = { 'cpp', 'c', 'h', 'hpp' }, callback = function() - require("data.func").add_keymap(require("data.keys").cpp_picker) + require('data.func').add_keymap(require('data.keys').cpp_picker) end, }) end @@ -28,9 +28,9 @@ M.minifiles = { if vim.g.minifiles_width ~= nil then multiplier = vim.g.minifiles_width end - if package.loaded["mini.files"] then + if package.loaded['mini.files'] then -- Obtain the existing config - local config = require("mini.files").config + local config = require('mini.files').config -- Update the width_preview based on the current window size if multiplier > 1 then -- If the multiplier is greater than 1, use as the preview width @@ -40,7 +40,7 @@ M.minifiles = { config.windows.width_preview = math.floor(vim.o.columns * multiplier) end -- Apply the updated config - require("mini.files").setup(config) + require('mini.files').setup(config) end end @@ -48,21 +48,21 @@ M.minifiles = { local is_mini_files_active = false -- Autocommand group to handle dynamic resizing - augroup("MiniFilesDynamicWidth", { clear = true }) + augroup('MiniFilesDynamicWidth', { clear = true }) -- Handle mini.files open event to set the flag - autocmd("User", { - group = "MiniFilesDynamicWidth", - pattern = "MiniFilesExplorerOpen", + autocmd('User', { + group = 'MiniFilesDynamicWidth', + pattern = 'MiniFilesExplorerOpen', callback = function() is_mini_files_active = true end, }) -- Handle mini.files close event to reset the flag and update the preview width - autocmd("User", { - group = "MiniFilesDynamicWidth", - pattern = "MiniFilesExplorerClose", + autocmd('User', { + group = 'MiniFilesDynamicWidth', + pattern = 'MiniFilesExplorerClose', callback = function() is_mini_files_active = false update_width_preview() @@ -70,14 +70,14 @@ M.minifiles = { }) -- Handle window resize event - autocmd("VimResized", { - group = "MiniFilesDynamicWidth", + autocmd('VimResized', { + group = 'MiniFilesDynamicWidth', callback = function() if is_mini_files_active then -- Defer the update until mini.files closes - autocmd("User", { - group = "MiniFilesDynamicWidth", - pattern = "MiniFilesExplorerClose", + autocmd('User', { + group = 'MiniFilesDynamicWidth', + pattern = 'MiniFilesExplorerClose', callback = update_width_preview, once = true, -- Ensure this runs only once }) diff --git a/lua/data/cmd.lua b/lua/data/cmd.lua index 0acd6ff..e3f4749 100644 --- a/lua/data/cmd.lua +++ b/lua/data/cmd.lua @@ -8,92 +8,92 @@ local M = {} --- Autosave plugin cmds M.autosave = { - "ASToggle", + 'ASToggle', } --- Codesnap plugin cmds M.codesnap = { - "CodeSnap", - "CodeSnapSave", - "CodeSnapHighlight", - "CodeSnapASCII", + 'CodeSnap', + 'CodeSnapSave', + 'CodeSnapHighlight', + 'CodeSnapASCII', } --- Gists plugin cmds M.gist = { - "GistCreate", - "GistCreateFromFile", - "GistsList", + 'GistCreate', + 'GistCreateFromFile', + 'GistsList', } --- Gx plugin cmds M.gx = { - "Browse", + 'Browse', } --- Kitty-Scrollback plugin cmds M.kitty_scrollback = { - "KittyScrollbackGenerateKittens", - "KittyScrollbackCheckHealth", + 'KittyScrollbackGenerateKittens', + 'KittyScrollbackCheckHealth', } --- LazyGit plugin cmds M.lazygit = { - "LazyGit", - "LazyGitConfig", - "LazyGitCurrentFile", - "LazyGitFilter", - "LazyGitFilterCurrentFile", + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', } --- Nekifoch plugin cmds -M.nekifoch = "Nekifoch" +M.nekifoch = 'Nekifoch' --- Thanks plugin cmds M.thanks = { - "ThanksAll", - "ThanksGithubAuth", - "ThanksGithubLogout", - "ThanksClearCache", + 'ThanksAll', + 'ThanksGithubAuth', + 'ThanksGithubLogout', + 'ThanksClearCache', } --- Gitlinker plugin cmds M.gitlinker = { - "GitLink", + 'GitLink', } --- Qalc plugin cmds M.qalc = { - "Qalc", - "QalcAttach", - "QalcYank", + 'Qalc', + 'QalcAttach', + 'QalcYank', } --- Ripsub plugin cmds M.ripsub = { - "RipSubstitute", + 'RipSubstitute', } M.spell_errors = { - "Telescope spell_errors", + 'Telescope spell_errors', } --- Suda plugin cmds M.suda = { - "SudaWrite", - "SudaRead", + 'SudaWrite', + 'SudaRead', } --- Transparent plugin cmds M.transparent = { - "TransparentEnable", - "TransparentDisable", - "TransparentToggle", + 'TransparentEnable', + 'TransparentDisable', + 'TransparentToggle', } --- Trouble plugin cmds M.trouble = { - "Trouble", + 'Trouble', } return M diff --git a/lua/data/cond.lua b/lua/data/cond.lua index e389f80..ddf5d51 100644 --- a/lua/data/cond.lua +++ b/lua/data/cond.lua @@ -5,31 +5,31 @@ -- ╰─────────────────────────────────────────────────────────╯ local M = {} -local func = require("data.func") -local types = require("data.types") +local func = require('data.func') +local types = require('data.types') -- Auto-dark-mode conditional options M.auto_dark_mode = function() - return func.check_global_var("autodarkmode", true, false) + return func.check_global_var('autodarkmode', true, false) and not func.is_ssh() end --- Auto Save conditional options M.autosave = function() - return func.check_global_var("autosave", true, false) + return func.check_global_var('autosave', true, false) end -- Auto Format conditional options M.autoformat = function() - return func.check_global_var("autoformat", true, false) + return func.check_global_var('autoformat', true, false) end --- Bars-N-Lines conditional options M.barsNlines = function() if - func.check_global_var("statuscolumn", "barsNlines", "native") - or func.check_global_var("tabline", "barsNlines", "bufferline") - or func.check_global_var("statusline", "barsNlines", "lualine") + func.check_global_var('statuscolumn', 'barsNlines', 'native') + or func.check_global_var('tabline', 'barsNlines', 'bufferline') + or func.check_global_var('statusline', 'barsNlines', 'lualine') then return true end @@ -37,42 +37,42 @@ M.barsNlines = function() end M.avante = function() - return func.check_global_var("useavante", true, false) + return func.check_global_var('useavante', true, false) end M.chatgpt = function() - return func.check_global_var("usechatgpt", true, false) + return func.check_global_var('usechatgpt', true, false) end M.gp = function() - return func.check_global_var("usegpai", true, false) + return func.check_global_var('usegpai', true, false) end --- Codeium conditional options M.codeium = function() - return func.check_global_var("aitool", "codeium", "neocodeium") + return func.check_global_var('aitool', 'codeium', 'neocodeium') end --- CodeSnap conditional options M.codesnap = function() - return func.check_global_var("codesnap", true, false) + return func.check_global_var('codesnap', true, false) end --- Colorful Window-Separators conditional options M.colorfulwinsep = function() - return func.check_global_var("colorfulwinsep", true, false) + return func.check_global_var('colorfulwinsep', true, false) end --- Auto-CursorLine conditional options M.cursorline = function() - return func.check_global_var("auto_cursorline", true, true) + return func.check_global_var('auto_cursorline', true, true) end --- Bufferline conditional options M.bufferline = function() if - func.check_global_var("tabline", "bufferline", "bufferline") - or func.check_global_var("tabline", "barsNlines", "bufferline") + func.check_global_var('tabline', 'bufferline', 'bufferline') + or func.check_global_var('tabline', 'barsNlines', 'bufferline') then return true end @@ -81,17 +81,17 @@ end --- CoPilot conditional options M.copilot = function() - return vim.g.aitool == "copilot" + return vim.g.aitool == 'copilot' end --- HardTime conditional options M.hardtime = function() - return func.check_global_var("usehardtime", true, false) + return func.check_global_var('usehardtime', true, false) end --- Heirline conditional options M.heirline = function() - return func.check_global_var("statusline", "heirline", "heirline") + return func.check_global_var('statusline', 'heirline', 'heirline') end --- Image conditional options @@ -106,7 +106,7 @@ end --- LuaRocks conditional options M.luarocks = function() - return func.check_global_var("useluarocks", true, true) + return func.check_global_var('useluarocks', true, true) end --- Minimap conditional options @@ -124,12 +124,12 @@ end --- Minuet conditional options M.minuet = function() - return func.check_global_var("aitool", "minuet", "neocodeium") + return func.check_global_var('aitool', 'minuet', 'neocodeium') end --- Music Controls conditional options M.musiccontrols = function() - return func.check_global_var("usemusic", true, true) + return func.check_global_var('usemusic', true, true) end --- NekiFoch conditional options @@ -140,17 +140,17 @@ end --- Tabnine conditional options --- Codeium conditional options M.neocodeium = function() - return func.check_global_var("aitool", "neocodeium", "neocodeium") + return func.check_global_var('aitool', 'neocodeium', 'neocodeium') end M.tabnine = function() - return func.check_global_var("aitool", "tabnine", "neocodeium") + return func.check_global_var('aitool', 'tabnine', 'neocodeium') end M.todo = function() - if func.check_global_var("usetodo", true, true) then + if func.check_global_var('usetodo', true, true) then if vim.bo.readonly == false then - if func.dir_is_git_repo(vim.fn.expand("%:p:h")) then + if func.dir_is_git_repo(vim.fn.expand('%:p:h')) then return true end end diff --git a/lua/data/dash.lua b/lua/data/dash.lua index a6ed92b..a53833b 100644 --- a/lua/data/dash.lua +++ b/lua/data/dash.lua @@ -7,9 +7,9 @@ local M = {} -- Define default path to the logo art -local logofile = vim.fn.stdpath("config") .. "/logo/" .. "neovim.txt" +local logofile = vim.fn.stdpath('config') .. '/logo/' .. 'neovim.txt' if vim.g.dash_logo then - logofile = vim.fn.stdpath("config") .. "/logo/" .. vim.g.dash_logo + logofile = vim.fn.stdpath('config') .. '/logo/' .. vim.g.dash_logo end M.logo = logofile @@ -25,7 +25,7 @@ local dashboard_buttons = { { key = "c", icon = " ", desc = " Config", action = function() require("data.func").pick("config_files") end }, { key = "s", icon = "󰶮 ", desc = " Restore Session", action = function() require("persistence").load() end }, { key = "S", icon = " ", desc = " Remote Session", action = function() require("config.rootiest").load_remote() end }, - { key = "l", icon = "󰒲 ", desc = " Lazy", action = function() vim.cmd("Lazy") end }, + { key = "l", icon = "󰒲 ", desc = " Lazy", action = function() vim.cmd("Lazy ") end }, { key = "q", icon = " ", desc = " Quit", action = function() vim.api.nvim_input("qa") end }, } -- stylua: ignore end @@ -35,7 +35,7 @@ M.alpha = { ---@return table dashboard The alpha dashboard options opts = function() -- Load the alpha plugin dashboard-nvim theme - local dashboard = require("alpha.themes.dashboard") + local dashboard = require('alpha.themes.dashboard') --- Function to read the ASCII art from the logo file ---@param logo_path string The path to the logo file @@ -66,13 +66,13 @@ M.alpha = { end for _, button in ipairs(dashboard.section.buttons.val) do - button.opts.hl = "AlphaButtons" - button.opts.hl_shortcut = "AlphaShortcut" + button.opts.hl = 'AlphaButtons' + button.opts.hl_shortcut = 'AlphaShortcut' end -- Set up highlight groups for the dashboard - dashboard.section.header.opts.hl = "Conditional" or "AlphaHeader" - dashboard.section.footer.opts.hl = "AlphaFooter" + dashboard.section.header.opts.hl = 'Conditional' or 'AlphaHeader' + dashboard.section.footer.opts.hl = 'AlphaFooter' -- Calculate the dashboard layout padding local padding = 0 diff --git a/lua/data/deps.lua b/lua/data/deps.lua index ba27588..9e1f889 100644 --- a/lua/data/deps.lua +++ b/lua/data/deps.lua @@ -7,157 +7,157 @@ local M = {} M.avante = { - "stevearc/dressing.nvim", - "nvim-lua/plenary.nvim", - "MunifTanjim/nui.nvim", + 'stevearc/dressing.nvim', + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', } M.chatgpt = { - "MunifTanjim/nui.nvim", - "nvim-lua/plenary.nvim", - "folke/trouble.nvim", - "nvim-telescope/telescope.nvim", + 'MunifTanjim/nui.nvim', + 'nvim-lua/plenary.nvim', + 'folke/trouble.nvim', + 'nvim-telescope/telescope.nvim', } --- nvim-cmp dependencies ---@return table The nvim-cmp dependencies M.cmp = { { - "L3MON4D3/LuaSnip", + 'L3MON4D3/LuaSnip', --- Function to build the dependencies ---@return string|nil The command to build the dependencies build = (function() - if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then + if vim.fn.has('win32') == 1 or vim.fn.executable('make') == 0 then return end - return "make install_jsregexp" + return 'make install_jsregexp' end)(), dependencies = { { - "rafamadriz/friendly-snippets", + 'rafamadriz/friendly-snippets', config = function() - require("luasnip.loaders.from_vscode").lazy_load() + require('luasnip.loaders.from_vscode').lazy_load() end, }, }, }, { - "petertriho/cmp-git", + 'petertriho/cmp-git', opts = {}, --- Function to configure the cmp-git dependency ---@return table|nil The cmp-git config config = function() - local cmp = require("cmp") - cmp.setup.filetype("gitcommit", { + local cmp = require('cmp') + cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ - { name = "git", priority = 50 }, - { name = "path", priority = 40 }, + { name = 'git', priority = 50 }, + { name = 'path', priority = 40 }, }, { - { name = "buffer", priority = 50 }, + { name = 'buffer', priority = 50 }, }), }) end, }, - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-path", - "hrsh7th/cmp-buffer", - "onsails/lspkind.nvim", + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-buffer', + 'onsails/lspkind.nvim', -- "hrsh7th/cmp-emoji", - "hrsh7th/cmp-cmdline", - "dmitmel/cmp-cmdline-history", - "teramako/cmp-cmdline-prompt.nvim", - "mtoohey31/cmp-fish", - "vim-dadbod-completion", + 'hrsh7th/cmp-cmdline', + 'dmitmel/cmp-cmdline-history', + 'teramako/cmp-cmdline-prompt.nvim', + 'mtoohey31/cmp-fish', + 'vim-dadbod-completion', { - "chrisgrieser/cmp_yanky", + 'chrisgrieser/cmp_yanky', option = { onlyCurrentFiletype = false, }, }, - "SergioRibera/cmp-dotenv", - "hrsh7th/cmp-calc", - "davidsierradz/cmp-conventionalcommits", + 'SergioRibera/cmp-dotenv', + 'hrsh7th/cmp-calc', + 'davidsierradz/cmp-conventionalcommits', -- "Dynge/gitmoji.nvim", } --- Gx plugin dependencies M.gx = { - "nvim-lua/plenary.nvim", + 'nvim-lua/plenary.nvim', } --- Hardtime plugin dependencies M.hardtime = { - "MunifTanjim/nui.nvim", - "nvim-lua/plenary.nvim", + 'MunifTanjim/nui.nvim', + 'nvim-lua/plenary.nvim', } --- LazyGit plugin dependencies M.lazygit = { - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim", + 'nvim-telescope/telescope.nvim', + 'nvim-lua/plenary.nvim', } --- Lualine plugin dependencies M.lualine = { - { "bezhermoso/todos-lualine.nvim" }, - { "folke/todo-comments.nvim" }, + { 'bezhermoso/todos-lualine.nvim' }, + { 'folke/todo-comments.nvim' }, } --- Minuet plugin dependencies M.minuet = { - { "nvim-lua/plenary.nvim" }, + { 'nvim-lua/plenary.nvim' }, } --- MusicControls plugin dependencies M.musiccontrols = { - "rcarriga/nvim-notify", + 'rcarriga/nvim-notify', } --- Table for plugins that need Telescope as a dependency M.needs_telescope = { - "nvim-telescope/telescope.nvim", + 'nvim-telescope/telescope.nvim', } --- Table for plugins that need Treesitter as a dependency M.needs_treesitter = { - "nvim-treesitter/nvim-treesitter", + 'nvim-treesitter/nvim-treesitter', } --- Neotest plugin adapters and dependencies M.neotest = { adapters = { - "neotest-plenary", - "neotest-python", - "neotest-vim-test", - "neotest-minitest", - "neotest-bash", + 'neotest-plenary', + 'neotest-python', + 'neotest-vim-test', + 'neotest-minitest', + 'neotest-bash', }, deps = { - "nvim-neotest/nvim-nio", - "nvim-lua/plenary.nvim", - "zidhuss/neotest-minitest", - "rcasia/neotest-bash", - "antoinemadec/FixCursorHold.nvim", - "nvim-treesitter/nvim-treesitter", + 'nvim-neotest/nvim-nio', + 'nvim-lua/plenary.nvim', + 'zidhuss/neotest-minitest', + 'rcasia/neotest-bash', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-treesitter/nvim-treesitter', }, } --- Recorder plugin dependencies M.recorder = { - "rcarriga/nvim-notify", + 'rcarriga/nvim-notify', } --- nvim-remote plugin dependencies M.remotenvim = { - "nvim-lua/plenary.nvim", -- For standard functions - "MunifTanjim/nui.nvim", -- To build the plugin UI - "nvim-telescope/telescope.nvim", -- For picking b/w different remote methods + 'nvim-lua/plenary.nvim', -- For standard functions + 'MunifTanjim/nui.nvim', -- To build the plugin UI + 'nvim-telescope/telescope.nvim', -- For picking b/w different remote methods } --- Zenbones plugin dependencies M.zenbones = { - "rktjmp/lush.nvim", + 'rktjmp/lush.nvim', } return M diff --git a/lua/data/events.lua b/lua/data/events.lua index 6954c4c..0e8bb62 100644 --- a/lua/data/events.lua +++ b/lua/data/events.lua @@ -6,42 +6,42 @@ local M = {} --- DEFAULT --- -M.default = "VeryLazy" +M.default = 'VeryLazy' --- Alpha events -M.alpha = { "VimEnter" } +M.alpha = { 'VimEnter' } --- Auto Save events -M.autosave = { "InsertLeave", "TextChanged" } +M.autosave = { 'InsertLeave', 'TextChanged' } --- Colorful Window Separators events -M.colorfulwinsep = { "WinLeave" } +M.colorfulwinsep = { 'WinLeave' } --- Dashboard-Nvim events -M.dashboard = { "UIEnter" } +M.dashboard = { 'UIEnter' } --- Dead Column -M.deadcolumn = { "BufEnter" } +M.deadcolumn = { 'BufEnter' } --- Heirline events -M.heirline = { "UIEnter" } +M.heirline = { 'UIEnter' } --- Highlight Colors events -M.highlightcolor = { "BufReadPre" } +M.highlightcolor = { 'BufReadPre' } --- Mini.Align events -M.minialign = { "InsertEnter" } +M.minialign = { 'InsertEnter' } --- Mini.SplitJoin events -M.minisplitjoin = { "InsertEnter" } +M.minisplitjoin = { 'InsertEnter' } --- Discord Presence events -M.presence = { "BufReadPre" } +M.presence = { 'BufReadPre' } --- RipGrep Substitute events -M.ripsub = { "InsertEnter" } +M.ripsub = { 'InsertEnter' } --- SmoothCursor events -M.smoothcursor = { "BufEnter" } +M.smoothcursor = { 'BufEnter' } return M diff --git a/lua/data/ft.lua b/lua/data/ft.lua index ded4348..3f48f08 100644 --- a/lua/data/ft.lua +++ b/lua/data/ft.lua @@ -5,6 +5,6 @@ -- ╰─────────────────────────────────────────────────────────╯ local M = {} -M.helpview = "help" +M.helpview = 'help' return M diff --git a/lua/data/func.lua b/lua/data/func.lua index 9db5ef5..0db9de6 100644 --- a/lua/data/func.lua +++ b/lua/data/func.lua @@ -10,15 +10,15 @@ local M = {} ---@function Check if the terminal is kitty ---@return boolean condition true if the terminal is kitty, false otherwise function M.is_kitty() - local term = os.getenv("TERM") or "" - local kit = string.find(term, "kitty") + local term = os.getenv('TERM') or '' + local kit = string.find(term, 'kitty') return kit ~= nil end ---@function Check if using kitty-scrollback ---@return boolean condition true if using kitty-scrollback, false otherwise function M.is_kitty_scrollback() - if vim.env.KITTY_SCROLLBACK_NVIM == "true" then + if vim.env.KITTY_SCROLLBACK_NVIM == 'true' then return true end return false @@ -27,21 +27,21 @@ end ---@function Check if the terminal is alacritty ---@return boolean condition true if the terminal is alacritty, false otherwise function M.is_alacritty() - local term = os.getenv("TERM") or "" - local alc = string.find(term, "alacritty") + local term = os.getenv('TERM') or '' + local alc = string.find(term, 'alacritty') return alc ~= nil end ---@function Check if the terminal is tmux ---@return boolean condition true if the terminal is tmux, false otherwise function M.is_tmux() - local tterm = os.getenv("TERM") - if tterm and string.find(tterm, "screen") then - if os.getenv("TMUX") then + local tterm = os.getenv('TERM') + if tterm and string.find(tterm, 'screen') then + if os.getenv('TMUX') then return true end else - if tterm and string.find(tterm, "tmux") then + if tterm and string.find(tterm, 'tmux') then return true end end @@ -51,8 +51,8 @@ end ---@function Check if the terminal is wezterm ---@return boolean condition true if the terminal is wezterm, false otherwise function M.is_wezterm() - local wterm = os.getenv("TERM_PROGRAM") - if wterm and string.find(wterm, "WezTerm") then + local wterm = os.getenv('TERM_PROGRAM') + if wterm and string.find(wterm, 'WezTerm') then return true end return false @@ -71,7 +71,7 @@ end ---@function Check if the terminal is ssh ---@return boolean condition true if the terminal is ssh, false otherwise function M.is_ssh() - local ssh = os.getenv("SSH_TTY") or false + local ssh = os.getenv('SSH_TTY') or false if ssh then return true end @@ -81,7 +81,7 @@ end ---@function Check if OS is Windows ---@return boolean condition true if the OS is Windows, false otherwise function M.is_windows() - local win = vim.fn.has("win32") == 1 or vim.fn.has("win64") == 1 + local win = vim.fn.has('win32') == 1 or vim.fn.has('win64') == 1 if win then return true end @@ -91,7 +91,7 @@ end ---@function Check if OS is macOS ---@return boolean condition true if the OS is macOS, false otherwise function M.is_mac() - local mac = vim.fn.has("macunix") + local mac = vim.fn.has('macunix') if mac == 1 then return true end @@ -101,7 +101,7 @@ end ---@function Check if OS is Linux ---@return boolean condition true if the OS is Linux, false otherwise function M.is_linux() - local lin = vim.fn.has("unix") + local lin = vim.fn.has('unix') if lin == 1 then return true end @@ -119,101 +119,101 @@ end function M.get_os(format) ---@diagnostic disable-next-line: undefined-field local uname = vim.loop and vim.loop.os_uname and vim.loop.os_uname() or {} - local os_name = uname.sysname or "unknown" + local os_name = uname.sysname or 'unknown' - if os_name == "Windows_NT" then - if format == "platform" then - return "windows" - elseif format == "short" then - return "Win" - elseif format == "code" then - return "win" + if os_name == 'Windows_NT' then + if format == 'platform' then + return 'windows' + elseif format == 'short' then + return 'Win' + elseif format == 'code' then + return 'win' else - return "Windows" + return 'Windows' end - elseif os_name == "Darwin" then - if format == "platform" then - return "osx" - elseif format == "short" then - return "macOS" - elseif format == "code" then - return "osx" + elseif os_name == 'Darwin' then + if format == 'platform' then + return 'osx' + elseif format == 'short' then + return 'macOS' + elseif format == 'code' then + return 'osx' else - return "macOS" + return 'macOS' end - elseif os_name == "Linux" then + elseif os_name == 'Linux' then -- Check if the system is running Android if vim.env.ANDROID_ROOT then - if format == "platform" then - return "linux" - elseif format == "short" then - return "Android" - elseif format == "code" then - return "android" + if format == 'platform' then + return 'linux' + elseif format == 'short' then + return 'Android' + elseif format == 'code' then + return 'android' else - return "Android" + return 'Android' end end -- Determine the Linux distribution - local distro = "Linux" - local release_file = "/etc/os-release" + local distro = 'Linux' + local release_file = '/etc/os-release' - local fd = io.open(release_file, "r") + local fd = io.open(release_file, 'r') if fd then for line in fd:lines() do - if line:match("^ID=") then - distro = line:gsub("ID=", ""):gsub('"', "") + if line:match('^ID=') then + distro = line:gsub('ID=', ''):gsub('"', '') break end end fd:close() end - if format == "platform" then - return "linux" - elseif format == "short" then - return "Linux" - elseif format == "code" then + if format == 'platform' then + return 'linux' + elseif format == 'short' then + return 'Linux' + elseif format == 'code' then return distro else - return "Linux (" .. distro .. ")" + return 'Linux (' .. distro .. ')' end else -- Falback tests if M.is_mac() then - if format == "platform" then - return "osx" - elseif format == "short" then - return "macOS" - elseif format == "code" then - return "osx" + if format == 'platform' then + return 'osx' + elseif format == 'short' then + return 'macOS' + elseif format == 'code' then + return 'osx' else - return "macOS" + return 'macOS' end elseif M.is_linux() then - if format == "platform" then - return "linux" - elseif format == "short" then - return "Linux" - elseif format == "code" then - return "linux" + if format == 'platform' then + return 'linux' + elseif format == 'short' then + return 'Linux' + elseif format == 'code' then + return 'linux' else - return "Linux" + return 'Linux' end elseif M.is_windows() then - if format == "platform" then - return "windows" - elseif format == "short" then - return "Win" - elseif format == "code" then - return "win" + if format == 'platform' then + return 'windows' + elseif format == 'short' then + return 'Win' + elseif format == 'code' then + return 'win' else - return "Windows" + return 'Windows' end else -- Failed to determine OS - return "Unknown OS" + return 'Unknown OS' end end end @@ -226,7 +226,7 @@ function M.dir_is_git_repo(dir) dir = dir or vim.fn.getcwd() local result = vim - .system({ "git", "-C", dir, "rev-parse", "--is-inside-work-tree" }) + .system({ 'git', '-C', dir, 'rev-parse', '--is-inside-work-tree' }) :wait() return result.code == 0 -- returns true if the command succeeded end @@ -237,7 +237,7 @@ end ---@param title string|nil The title of the notification ---@return boolean condition true if the notification was sent successfully, false otherwise function M.notify(message, level, title) - level = level or "info" + level = level or 'info' if title then vim.notify(message, vim.log.levels[level:upper()], { title = title }) else @@ -253,32 +253,32 @@ end function M.ConfirmPrompt(prompt, action) -- Validate the action parameter local function perform_action() - if type(action) == "function" then + if type(action) == 'function' then action() -- Call the function - elseif type(action) == "string" then + elseif type(action) == 'string' then vim.cmd(action) -- Run the Vim command else M.notify( - "Action must be a function or a string", - "ERROR", - "Configuration Error" + 'Action must be a function or a string', + 'ERROR', + 'Configuration Error' ) end end -- Create a new buffer local buf = vim.api.nvim_create_buf(false, true) -- Create a new empty buffer -- Set the prompt text in the buffer - vim.api.nvim_buf_set_lines(buf, 0, -1, false, { prompt, "y/n: " }) + vim.api.nvim_buf_set_lines(buf, 0, -1, false, { prompt, 'y/n: ' }) -- Create a floating window to display the buffer local win_height = 2 -- Height of floating window local win_width = math.floor(vim.o.columns * 0.25) -- Width of floating window local row = math.floor((vim.o.lines - win_height) / 2) -- Position row local col = math.floor((vim.o.columns - win_width) / 2) -- Position column - local win_border = "rounded" - local style = "minimal" + local win_border = 'rounded' + local style = 'minimal' -- Create a floating window local win = vim.api.nvim_open_win(buf, true, { - relative = "editor", + relative = 'editor', width = win_width, height = win_height, col = col, @@ -297,7 +297,7 @@ function M.ConfirmPrompt(prompt, action) -- Define the no function local no = function() vim.api.nvim_win_close(win, true) - M.notify("Action Canceled", "INFO", "Info") + M.notify('Action Canceled', 'INFO', 'Info') end -- Define buffer-specific key mappings local keymaps = { @@ -310,13 +310,13 @@ function M.ConfirmPrompt(prompt, action) q = function() no() end, - [""] = function() + [''] = function() no() end, } -- Set the key mappings for key, callback in pairs(keymaps) do - vim.api.nvim_buf_set_keymap(buf, "n", key, "", { + vim.api.nvim_buf_set_keymap(buf, 'n', key, '', { noremap = true, nowait = true, callback = callback, @@ -334,25 +334,25 @@ function M.InputPrompt(prompt, callback) local buf = vim.api.nvim_create_buf(false, true) -- Create a new empty buffer -- Set the buffer name - vim.api.nvim_buf_set_name(buf, "Input") + vim.api.nvim_buf_set_name(buf, 'Input') -- Set the buffer filetype (e.g., for custom behavior or syntax highlighting) - vim.bo[buf].filetype = "input" + vim.bo[buf].filetype = 'input' -- Set the buffer type to "nofile" to avoid editing or saving the buffer - vim.bo[buf].buftype = "nofile" + vim.bo[buf].buftype = 'nofile' -- Set the prompt text in the buffer - vim.api.nvim_buf_set_lines(buf, 0, -1, false, { prompt, "Input: " }) + vim.api.nvim_buf_set_lines(buf, 0, -1, false, { prompt, 'Input: ' }) -- Create a floating window to display the buffer local win_height = 2 -- Height of floating window local win_width = math.floor(vim.o.columns * 0.25) -- Width of floating window local row = math.floor((vim.o.lines - win_height) / 2) -- Position row local col = math.floor((vim.o.columns - win_width) / 2) -- Position column - local win_border = "rounded" - local style = "minimal" + local win_border = 'rounded' + local style = 'minimal' -- Create a floating window local win = vim.api.nvim_open_win(buf, true, { - relative = "editor", + relative = 'editor', width = win_width, height = win_height, col = col, @@ -364,11 +364,11 @@ function M.InputPrompt(prompt, callback) -- Move the cursor to the end of the buffer vim.api.nvim_win_set_cursor(win, { 2, 8 }) -- Set input mode - vim.api.nvim_command("startinsert") + vim.api.nvim_command('startinsert') -- Function to close the window local function exit_win() - vim.api.nvim_command("stopinsert") + vim.api.nvim_command('stopinsert') vim.api.nvim_win_close(win, true) end @@ -398,18 +398,18 @@ function M.InputPrompt(prompt, callback) -- Define buffer-specific key mappings local keymaps = { - [""] = yes, - [""] = no, + [''] = yes, + [''] = no, } -- Set the key mappings for key, keyback in pairs(keymaps) do - vim.api.nvim_buf_set_keymap(buf, "n", key, "", { + vim.api.nvim_buf_set_keymap(buf, 'n', key, '', { noremap = true, nowait = true, callback = keyback, }) - vim.api.nvim_buf_set_keymap(buf, "i", key, "", { + vim.api.nvim_buf_set_keymap(buf, 'i', key, '', { noremap = true, nowait = true, callback = keyback, @@ -436,7 +436,7 @@ function M.move_visual(up, multiplier) end -- escape visual mode - vim.cmd("norm v") + vim.cmd('norm v') -- GET REGION -- eg region = { [103] = {0,-1}, [104] = {0,-1}, [105] = {0,-1}} ---@diagnostic disable-next-line: deprecated @@ -461,10 +461,10 @@ function M.move_visual(up, multiplier) -- EXECUTE local new_pos = offset > 0 and bottom + offset or top + offset - vim.cmd(string.format("silent %d, %d move %d", top, bottom, new_pos)) + vim.cmd(string.format('silent %d, %d move %d', top, bottom, new_pos)) -- eg :silent 104, 106 move 107 - vim.cmd("norm gv") + vim.cmd('norm gv') end ---@function Function to paste over text with overwrite @@ -475,31 +475,31 @@ function M.paste_overwrite() local regcontents = register.regcontents -- Enter Virtual Replace Mode - vim.api.nvim_feedkeys("gR", "n", false) + vim.api.nvim_feedkeys('gR', 'n', false) -- Process each line in the register contents for i, line in ipairs(regcontents) do if i > 1 then -- Handle formatting of multi-line pastes (except for the first line) vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes("0gR", true, false, true), - "n", + vim.api.nvim_replace_termcodes('0gR', true, false, true), + 'n', false ) end -- Paste the current line; add a newline if it's not the last line if i < #regcontents then - vim.api.nvim_feedkeys(line .. "\n", "n", false) + vim.api.nvim_feedkeys(line .. '\n', 'n', false) else - vim.api.nvim_feedkeys(line, "n", false) + vim.api.nvim_feedkeys(line, 'n', false) end end -- Properly exit Virtual Replace Mode using vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes("", true, false, true), - "n", + vim.api.nvim_replace_termcodes('', true, false, true), + 'n', false ) end @@ -508,7 +508,7 @@ end ---@param register string? The name of the register to dump the buffer to (defaults to unnamed register if nil) ---@return nil function M.dump_buffer_to_table(register) - register = register or "" -- Default to unnamed register if not provided + register = register or '' -- Default to unnamed register if not provided -- Get the lines from the current buffer local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) @@ -516,12 +516,12 @@ function M.dump_buffer_to_table(register) -- Process the buffer contents local result = {} for _, line in ipairs(lines) do - local entry = line:gsub("%.lua$", "") -- Remove ".lua" extension + local entry = line:gsub('%.lua$', '') -- Remove ".lua" extension table.insert(result, '"' .. entry .. '"') end -- Join the result into a single string and format as a Lua table - local output = "{ " .. table.concat(result, ", ") .. " }" + local output = '{ ' .. table.concat(result, ', ') .. ' }' -- Dump the result into a register vim.fn.setreg(register, output) @@ -531,14 +531,14 @@ end ---@return nil function M.reload_config() -- Notify the user about the reload process - M.notify("Reloading configuration...", "WARN", "Reloading Config") + M.notify('Reloading configuration...', 'WARN', 'Reloading Config') -- 1. Save all buffers - vim.cmd("silent! wa") + vim.cmd('silent! wa') -- 2. Record the list of open buffers to reopen later local buffer_list = vim.api.nvim_list_bufs() local buffers_to_reopen = {} for _, buf in ipairs(buffer_list) do - if vim.api.nvim_buf_is_loaded(buf) and vim.fn.bufname(buf) ~= "" then + if vim.api.nvim_buf_is_loaded(buf) and vim.fn.bufname(buf) ~= '' then table.insert( buffers_to_reopen, { buf = buf, file = vim.api.nvim_buf_get_name(buf) } @@ -546,26 +546,26 @@ function M.reload_config() end end -- 3. Close all buffers - vim.cmd("silent! bufdo! bwipeout") + vim.cmd('silent! bufdo! bwipeout') -- 4. Clear loaded lua modules related to your custom configuration for name, _ in pairs(package.loaded) do -- Replace 'userconfig' and 'plugin' with your actual config module names - if name:match("^userconfig") or name:match("^plugins") then + if name:match('^userconfig') or name:match('^plugins') then package.loaded[name] = nil end end -- 5. Reload the vim script (init.lua) - vim.cmd("source $MYVIMRC") + vim.cmd('source $MYVIMRC') -- 6. Reopen the buffers for _, bufinfo in ipairs(buffers_to_reopen) do local buf = vim.fn.bufadd(bufinfo.file) - vim.cmd("buffer " .. buf) + vim.cmd('buffer ' .. buf) vim.api.nvim_buf_call(buf, function() -- You could also restore the exact cursor position if desired vim.cmd('silent! normal! g`"') end) end -- Notify the user that the config has been reloaded - M.notify("Configuration reloaded successfully!", "INFO", "Reloaded Config") + M.notify('Configuration reloaded successfully!', 'INFO', 'Reloaded Config') end ---@function Function to reload all plugins. @@ -595,29 +595,29 @@ function M.reload_all_plugins() if vim.g.plugin_reloader.exclusion_list then -- Use global variable if provided exclude = vim.g.plugin_reloader.exclusion_list - elseif pcall(require, "data.types") then + elseif pcall(require, 'data.types') then -- Use data.types if available - exclude = require("data.types").plugin_reloader.exclusion_list + exclude = require('data.types').plugin_reloader.exclusion_list else -- Fallback to default exclude = { - ["lazy.nvim"] = true, - ["noice.nvim"] = true, - ["unception.nvim"] = true, - ["nvim-unception"] = true, - ["nui.nvim"] = true, - ["packer.nvim"] = true, - ["trouble.nvim"] = true, - ["which-key.nvim"] = true, + ['lazy.nvim'] = true, + ['noice.nvim'] = true, + ['unception.nvim'] = true, + ['nvim-unception'] = true, + ['nui.nvim'] = true, + ['packer.nvim'] = true, + ['trouble.nvim'] = true, + ['which-key.nvim'] = true, } end -- Try to require the lazy.core.config module - local ok, lazy_config = pcall(require, "lazy.core.config") + local ok, lazy_config = pcall(require, 'lazy.core.config') if not ok then -- Handle the error; the module is not available - print("lazy.core.config not found") + print('lazy.core.config not found') else -- Get the list of currently loaded plugins local plugins = lazy_config.plugins @@ -625,7 +625,7 @@ function M.reload_all_plugins() -- Iterate over each plugin and reload it if it's not in the exclusion list for plugin_name, _ in pairs(plugins) do if not exclude[plugin_name] then - vim.cmd("Lazy reload " .. plugin_name) + vim.cmd('Lazy reload ' .. plugin_name) end end end @@ -646,8 +646,8 @@ end --- If the input is a table of plugin modules, the return type is a table. function M.is_installed(plugins, opts) opts = opts or {} - local is_single = type(plugins) == "string" - if type(plugins) ~= "table" then + local is_single = type(plugins) == 'string' + if type(plugins) ~= 'table' then plugins = { plugins } end @@ -662,11 +662,11 @@ function M.is_installed(plugins, opts) if simple then return pcall(require, name) else - local lazy_installed = pcall(require, "lazy") - if lazy_installed and require("lazy.core.config").plugins[name] then + local lazy_installed = pcall(require, 'lazy') + if lazy_installed and require('lazy.core.config').plugins[name] then return true end - local packer_installed = pcall(require, "packer_plugins") + local packer_installed = pcall(require, 'packer_plugins') if packer_installed ---@diagnostic disable-next-line: undefined-field @@ -676,7 +676,7 @@ function M.is_installed(plugins, opts) then return true end - if vim.fn.exists("g:plugs") == 1 and vim.g.plugs[name] then + if vim.fn.exists('g:plugs') == 1 and vim.g.plugs[name] then return true end return pcall(require, name) @@ -687,8 +687,8 @@ function M.is_installed(plugins, opts) installed = check_plugin(plugin) -- If not installed, try replacing hyphens with underscores - if not installed and plugin:find("-") then - local underscored_name = plugin:gsub("-", "_") + if not installed and plugin:find('-') then + local underscored_name = plugin:gsub('-', '_') installed = check_plugin(underscored_name) end @@ -697,15 +697,15 @@ function M.is_installed(plugins, opts) -- Optionally preload the plugin(s) if load_plug then - local lazy_installed = pcall(require, "lazy") + local lazy_installed = pcall(require, 'lazy') if lazy_installed then for _, plugin in ipairs(plugins) do if installed_plugins[plugin] then - require("lazy").load({ plugins = { plugin } }) + require('lazy').load({ plugins = { plugin } }) end end else - M.notify("Unable to preload plugin(s)", "ERROR", "Lazy not found") + M.notify('Unable to preload plugin(s)', 'ERROR', 'Lazy not found') end end @@ -718,7 +718,7 @@ function M.open_floating_terminal() local buf = vim.api.nvim_create_buf(false, true) -- Create an unnamed, non-file, scratch buffer if not buf or buf == 0 then - vim.notify("Failed to create buffer", vim.log.levels.ERROR) + vim.notify('Failed to create buffer', vim.log.levels.ERROR) return end @@ -732,13 +732,13 @@ function M.open_floating_terminal() -- Define settings of the floating window, sizing it to 80% of the full editor size local win_opts = { - style = "minimal", -- Minimal UI, no status line or tab line - relative = "editor", -- Float relative to the whole editor UI + style = 'minimal', -- Minimal UI, no status line or tab line + relative = 'editor', -- Float relative to the whole editor UI width = win_width, -- Set width to 80% of editor width height = win_height, -- Set height to 80% of editor height row = math.floor((height - win_height) / 2), -- Centered vertically col = math.floor((width - win_width) / 2), -- Centered horizontally - border = "rounded", -- Add a border for aesthetics (can be 'single', 'double', etc.) + border = 'rounded', -- Add a border for aesthetics (can be 'single', 'double', etc.) } -- Open the floating window with our newly created buffer @@ -746,13 +746,13 @@ function M.open_floating_terminal() -- Check if the window was created successfully if not win or win == 0 then - vim.notify("Failed to create floating window", vim.log.levels.ERROR) + vim.notify('Failed to create floating window', vim.log.levels.ERROR) return end -- Set very specific buffer and window configurations - vim.api.nvim_set_option_value("bufhidden", "wipe", { buf = buf }) -- Auto-remove when the buffer is closed - vim.api.nvim_set_option_value("winblend", 10, { win = win }) -- Add slight transparency to the floating window + vim.api.nvim_set_option_value('bufhidden', 'wipe', { buf = buf }) -- Auto-remove when the buffer is closed + vim.api.nvim_set_option_value('winblend', 10, { win = win }) -- Add slight transparency to the floating window -- Now that the floating window is ready, we run the terminal shell in the created buffer -- Open the terminal in the buffer when we're sure the buffer is set up in the float @@ -761,7 +761,7 @@ function M.open_floating_terminal() -- Safety measure: Ensure the window still exists before trying to close it if vim.api.nvim_win_is_valid(win) then -- Notify the user that the terminal has closed - vim.notify("Terminal closed", vim.log.levels.INFO) + vim.notify('Terminal closed', vim.log.levels.INFO) -- Close and wipe the associated floating window and its buffer vim.api.nvim_win_close(win, true) -- Force close the terminal window end @@ -770,7 +770,7 @@ function M.open_floating_terminal() -- Switch focus to the terminal window in the floating buffer and enter insert mode vim.api.nvim_set_current_win(win) - vim.cmd("startinsert!") -- Automatically enter insert mode within the terminal + vim.cmd('startinsert!') -- Automatically enter insert mode within the terminal end ---@function Helper function to add keymaps with common properties @@ -837,8 +837,8 @@ function M.add_keymap( hidden ) -- Check if which-key.nvim is installed - if M.is_installed("which-key.nvim") and not bufnr then - require("which-key").add({ + if M.is_installed('which-key.nvim') and not bufnr then + require('which-key').add({ -- stylua: ignore start { lhs, -- The keybind @@ -854,12 +854,12 @@ function M.add_keymap( return true else -- Handle the case where lhs is a table - if type(lhs) == "table" then + if type(lhs) == 'table' then for _, keymap in ipairs(lhs) do -- Set default values or use provided ones local keymap_rhs = keymap.rhs or rhs local keymap_desc = keymap.desc or desc - local keymap_mode = keymap.mode or mode or "n" + local keymap_mode = keymap.mode or mode or 'n' local keymap_icon = keymap.icon or icon local keymap_group = keymap.group or group local keymap_lhs = keymap.lhs @@ -876,15 +876,15 @@ function M.add_keymap( ) else if -- Check if the keymap is compatible with buffer-based keymaps - type(keymap_mode) == "table" or type(keymap_rhs) == "function" + type(keymap_mode) == 'table' or type(keymap_rhs) == 'function' then -- The keymap is incompatible with buffer-based keymaps local msg = string.format( - "Mapping incompatible with buffer-based keymaps:\n%s%s", + 'Mapping incompatible with buffer-based keymaps:\n%s%s', vim.inspect(keymap_lhs), -- Convert lhs to a readable format - keymap_desc and ("\nDescription: " .. keymap_desc) or "" + keymap_desc and ('\nDescription: ' .. keymap_desc) or '' ) - M.notify(msg, "WARN") + M.notify(msg, 'WARN') return false end -- Apply the keymap using vim.api.nvim_buf_set_keymap @@ -900,11 +900,11 @@ function M.add_keymap( else -- The keymap requires which-key.nvim local msg = string.format( - "Mapping requires which-key.nvim:\n%s%s", + 'Mapping requires which-key.nvim:\n%s%s', vim.inspect(keymap_lhs), -- Convert lhs to a readable format - keymap_desc and ("\nDescription: " .. keymap_desc) or "" + keymap_desc and ('\nDescription: ' .. keymap_desc) or '' ) - M.notify(msg, "WARN") + M.notify(msg, 'WARN') return false end end @@ -913,7 +913,7 @@ function M.add_keymap( if not group and not icon then if not bufnr then vim.keymap.set( - mode or "n", -- Default to "n" (normal mode) if mode is not provided + mode or 'n', -- Default to "n" (normal mode) if mode is not provided lhs, -- The keybind ---@diagnostic disable-next-line: param-type-mismatch rhs, -- Function to execute when the key is pressed @@ -921,21 +921,21 @@ function M.add_keymap( ) else if -- Check if the keymap is compatible with buffer-based keymaps - type(mode) == "table" or type(rhs) == "function" + type(mode) == 'table' or type(rhs) == 'function' then -- The keymap is incompatible with buffer-based keymaps local msg = string.format( - "Mapping incompatible with buffer-based keymaps:\n%s%s", + 'Mapping incompatible with buffer-based keymaps:\n%s%s', vim.inspect(lhs), -- Convert lhs to a readable format - desc and ("\nDescription: " .. desc) or "" + desc and ('\nDescription: ' .. desc) or '' ) - M.notify(msg, "WARN") + M.notify(msg, 'WARN') return false end -- Apply the keymap using vim.api.nvim_buf_set_keymap vim.api.nvim_buf_set_keymap( bufnr, - mode or "n", + mode or 'n', lhs, ---@diagnostic disable-next-line: param-type-mismatch rhs, @@ -945,11 +945,11 @@ function M.add_keymap( return true else local msg = string.format( - "Mapping requires which-key.nvim:\n%s%s", + 'Mapping requires which-key.nvim:\n%s%s', vim.inspect(lhs), -- Convert lhs to a readable format - desc and ("\nDescription: " .. desc) or "" + desc and ('\nDescription: ' .. desc) or '' ) - M.notify(msg, "WARN") + M.notify(msg, 'WARN') return false end end @@ -968,7 +968,7 @@ function M.rm_keymap( mode, -- Mode(s) in which the keybind should be removed bufnr -- Buffer number to remove the keymap from ) - mode = mode or "n" -- Default to "n" (normal mode) if mode is not provided + mode = mode or 'n' -- Default to "n" (normal mode) if mode is not provided ---@class Keymap ---@field lhs string The keybind @@ -1015,12 +1015,12 @@ end ---@return boolean condition true if the mark was removed, false otherwise function M.rm_mark(mark) -- Get a list of marks in the current buffer - local marks = vim.fn.getmarklist(vim.fn.bufnr("%")) + local marks = vim.fn.getmarklist(vim.fn.bufnr('%')) -- Check if the mark exists for _, m in ipairs(marks) do if m.mark == mark then -- Mark exists, remove it - vim.cmd("delmarks " .. mark) + vim.cmd('delmarks ' .. mark) return true -- Indicate that the mark was removed end end @@ -1036,7 +1036,7 @@ end ---@function Function to check if buffer is empty ---@return boolean condition true if buffer is empty, false otherwise function M.is_buffer_empty() - return vim.fn.empty(vim.fn.expand("%:t")) == 1 + return vim.fn.empty(vim.fn.expand('%:t')) == 1 end ---@function Function to check if buffer is read-only @@ -1049,7 +1049,7 @@ end ---@param filepath string The path to the file ---@return boolean condition true if file exists, false otherwise function M.file_exists(filepath) - local f = io.open(filepath, "r") + local f = io.open(filepath, 'r') if f then f:close() end @@ -1059,22 +1059,22 @@ end ---@function Function to get the current git branch ---@return string branch git branch name or "No branch" function M.get_git_branch() - local branch = vim.fn.systemlist("git rev-parse --abbrev-ref HEAD")[1] - if branch and branch ~= "" then + local branch = vim.fn.systemlist('git rev-parse --abbrev-ref HEAD')[1] + if branch and branch ~= '' then return branch else - return "No branch" + return 'No branch' end end ---@function Function to get the current git commit hash ---@return string The current git commit hash or "No commit hash" function M.get_git_commit_hash() - local commit_hash = vim.fn.systemlist("git rev-parse --short HEAD")[1] - if commit_hash and commit_hash ~= "" then + local commit_hash = vim.fn.systemlist('git rev-parse --short HEAD')[1] + if commit_hash and commit_hash ~= '' then return commit_hash else - return "No commit hash" + return 'No commit hash' end end @@ -1084,12 +1084,12 @@ end function M.run_shell_command(cmd) local handle = io.popen(cmd) if handle then - local result = handle:read("*a") + local result = handle:read('*a') handle:close() return result else -- Handle the error case where `handle` is nil - M.notify("Failed to run the command: " .. cmd, "ERROR") + M.notify('Failed to run the command: ' .. cmd, 'ERROR') return nil end end @@ -1098,24 +1098,24 @@ end ---@param format string The format of the dimensions ---@return string|table dimensions dimensions of the current window function M.get_ws_dimensions(format) - format = format or "verbose" + format = format or 'verbose' local dimensions = { width = tonumber(vim.opt.columns:get()) or 0, height = tonumber(vim.opt.lines:get()) or 0, } - if format == "verbose" then + if format == 'verbose' then return string.format( - "Width: %d cells\nHeight: %d cells", + 'Width: %d cells\nHeight: %d cells', dimensions.width, dimensions.height ) - elseif format == "basic" then - return string.format("%dx%d", dimensions.width, dimensions.height) - elseif format == "raw" then + elseif format == 'basic' then + return string.format('%dx%d', dimensions.width, dimensions.height) + elseif format == 'raw' then return dimensions else -- Trigger an error if the format is not valid - error("Invalid format: " .. format) + error('Invalid format: ' .. format) end end @@ -1150,10 +1150,10 @@ end ---@return table output The split string function M.split_string(inputstr, sep) if sep == nil then - sep = "%s" + sep = '%s' end local output = {} - for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do + for str in string.gmatch(inputstr, '([^' .. sep .. ']+)') do table.insert(output, str) end return output @@ -1163,7 +1163,7 @@ end ---@param rgb table The RGB color ---@return string hex The hexadecimal color function M.rgb_to_hex(rgb) - return string.format("#%02x%02x%02x", rgb[1], rgb[2], rgb[3]) + return string.format('#%02x%02x%02x', rgb[1], rgb[2], rgb[3]) end ---@function Function to get the foreground color of a highlight group @@ -1203,16 +1203,16 @@ end ---@return string The number with its ordinal suffix. function M.get_ordinal_suffix(number) -- Determine the last two digits to handle 'teen' cases correctly - local suffix = "th" -- Default suffix + local suffix = 'th' -- Default suffix local last_digit = number % 10 local last_two_digits = number % 100 if last_digit == 1 and last_two_digits ~= 11 then - suffix = "st" + suffix = 'st' elseif last_digit == 2 and last_two_digits ~= 12 then - suffix = "nd" + suffix = 'nd' elseif last_digit == 3 and last_two_digits ~= 13 then - suffix = "rd" + suffix = 'rd' end return tostring(number) .. suffix @@ -1237,13 +1237,13 @@ end ---@function Function to get the current date ---@return string|osdate date The current date function M.get_date() - return os.date("%Y-%m-%d") + return os.date('%Y-%m-%d') end ---@function Function to exit neovim ---@return nil function M.exit() - vim.api.nvim_command("wqall") + vim.api.nvim_command('wqall') end ---@function Function to render the MultiCursor statusline @@ -1252,16 +1252,16 @@ function M.mc_statusline() -- Define the default status object local status = { enabled = false, - icon = "󰘪 ", - short_text = "NO", - text = "SINGLE", - color = "lualine_a_normal", + icon = '󰘪 ', + short_text = 'NO', + text = 'SINGLE', + color = 'lualine_a_normal', cursors = 1, disabled = 0, installed = false, } - local ok, mc = pcall(require, "multicursor-nvim") + local ok, mc = pcall(require, 'multicursor-nvim') if not ok then -- Handle the case where the plugin is not installed return status @@ -1272,18 +1272,18 @@ function M.mc_statusline() status.enabled = true status.cursors = mc.numEnabledCursors() status.disabled = mc.numDisabledCursors() - if vim.fn.mode() == "v" then + if vim.fn.mode() == 'v' then -- status.icon = "󰚕 " - status.icon = "󰆿" - status.short_text = "V" - status.text = "VISUAL" - status.color = "lualine_a_visual" + status.icon = '󰆿' + status.short_text = 'V' + status.text = 'VISUAL' + status.color = 'lualine_a_visual' else -- status.icon = "󰬸 " - status.icon = "󰇀" - status.short_text = "N" - status.text = "NORMAL" - status.color = "lualine_a_normal" + status.icon = '󰇀' + status.short_text = 'N' + status.text = 'NORMAL' + status.color = 'lualine_a_normal' end end @@ -1293,11 +1293,11 @@ function M.mc_statusline() -- Update the status object if status.cursors > 1 and status.disabled > 0 then - status.count = status.cursors .. "/" .. status.disabled + status.count = status.cursors .. '/' .. status.disabled elseif status.cursors > 1 and status.disabled <= 0 then status.count = status.cursors else - status.count = "" + status.count = '' end return status end @@ -1330,34 +1330,34 @@ function M.spellcheck(spellcheck, filetypes) -- Handle filetype-specific spellchecking if filetypes then -- Set up description text - local desc = "Enable" + local desc = 'Enable' if not spellcheck then - desc = "Disable" + desc = 'Disable' end -- Make a comma-separated list of filetypes local typedesc - if type(filetypes) == "table" then - typedesc = table.concat(filetypes, ",") + if type(filetypes) == 'table' then + typedesc = table.concat(filetypes, ',') else -- Fallback to a string typedesc = tostring(filetypes) end -- If filetypes is a boolean if filetypes == true then - filetypes = { "*" } -- Apply to all filetypes + filetypes = { '*' } -- Apply to all filetypes elseif filetypes == false then toggle() end -- Create an autocommand for the specified filetypes to manage spellcheck - vim.api.nvim_create_autocmd("FileType", { - group = "Spellcheck", + vim.api.nvim_create_autocmd('FileType', { + group = 'Spellcheck', pattern = filetypes, callback = function() vim.opt_local.spell = spellcheck end, - desc = desc .. " spellcheck for " .. typedesc, + desc = desc .. ' spellcheck for ' .. typedesc, }) else -- Handle local spellchecking @@ -1382,11 +1382,11 @@ function M.swap_paste(default) -- Preserve the original actions of `p` and `P` using Vim commands to avoid interference -- Set `p` to the original paste after cursor - vim.api.nvim_set_keymap("n", "p", '"_dP', { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', 'p', '"_dP', { noremap = true, silent = true }) -- Set `P` to the original paste before cursor vim.api.nvim_set_keymap( - "n", - "P", + 'n', + 'P', '"_d"0p', { noremap = true, silent = true } ) @@ -1396,10 +1396,10 @@ function M.swap_paste(default) -- `P` will now revert to pasting before the cursor (original behavior) -- Remap `p` to its original behavior - vim.api.nvim_set_keymap("n", "p", "p", { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', 'p', 'p', { noremap = true, silent = true }) -- Remap `P` to its original behavior - vim.api.nvim_set_keymap("n", "P", "P", { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', 'P', 'P', { noremap = true, silent = true }) end end @@ -1410,7 +1410,7 @@ end --- - string if the text is in the specified range function M.trim_yank() -- Execute the last command in normal mode - vim.cmd.normal("!") + vim.cmd.normal('!') -- Get the start and finish positions of the selected text local start = vim.fn.getpos("'<") @@ -1420,13 +1420,13 @@ function M.trim_yank() local lines = vim.fn.getline(start[2], finish[2]) -- Ensure lines is a table even if only one line is selected - if type(lines) == "string" then + if type(lines) == 'string' then lines = { lines } end -- Drop empty lines from the selection for i = #lines, 1, -1 do - if lines[i] == "" then + if lines[i] == '' then table.remove(lines, i) end end @@ -1439,7 +1439,7 @@ function M.trim_yank() -- Find the minimum whitespace (indentation) in the selected lines local ws = 9999 for _, line in ipairs(lines) do - local lws = line:match("^%s*") -- Extract leading whitespace + local lws = line:match('^%s*') -- Extract leading whitespace if lws and #lws < ws then ws = #lws end @@ -1451,29 +1451,29 @@ function M.trim_yank() end -- Return the resulting lines as a single concatenated string - return table.concat(lines, "\n") + return table.concat(lines, '\n') end ---@function Function to open the lazygit popup in a floaterm ---@return nil function M.open_lazygit_popup() -- Set floaterm border characters - vim.g.floaterm_borderchars = "─│─│╭╮╯╰" + vim.g.floaterm_borderchars = '─│─│╭╮╯╰' -- Floaterm configuration properties local floaterm_props = { - width = "0.98", -- Width of the floaterm - height = "0.95", -- Height of the floaterm - autoclose = "1", -- Auto close the floaterm when finished - command = "lazygit", -- Command to run in the floaterm - name = "LazyGit", -- Name of the floaterm - title = "LazyGit", -- Title of the floaterm - titlepos = "center", -- Title position of the floaterm + width = '0.98', -- Width of the floaterm + height = '0.95', -- Height of the floaterm + autoclose = '1', -- Auto close the floaterm when finished + command = 'lazygit', -- Command to run in the floaterm + name = 'LazyGit', -- Name of the floaterm + title = 'LazyGit', -- Title of the floaterm + titlepos = 'center', -- Title position of the floaterm } -- Construct the command string for opening the floaterm with the specified settings local cmd = string.format( - "FloatermNew --height=%s --width=%s --name=%s --title=%s --titleposition=%s --autoclose=%s %s", + 'FloatermNew --height=%s --width=%s --name=%s --title=%s --titleposition=%s --autoclose=%s %s', floaterm_props.height, floaterm_props.width, floaterm_props.name, @@ -1487,7 +1487,7 @@ function M.open_lazygit_popup() vim.cmd(cmd) -- Using vim.cmd to run the constructed command -- Enter insert mode in the floaterm - vim.cmd("startinsert") + vim.cmd('startinsert') end ---@function Function to replace '...' with '…' (ellipsis) @@ -1498,9 +1498,9 @@ function M.replace_ellipsis() local cursor_pos = vim.api.nvim_win_get_cursor(0) -- Get the current cursor position -- Check if the current line ends with '...' - if current_line:sub(cursor_pos[2] - 2, cursor_pos[2]) == "..." then + if current_line:sub(cursor_pos[2] - 2, cursor_pos[2]) == '...' then -- Replace '...' with '…' using string manipulation - local new_line = current_line:sub(1, cursor_pos[2] - 3) .. "…" + local new_line = current_line:sub(1, cursor_pos[2] - 3) .. '…' -- Set the new line content vim.api.nvim_set_current_line(new_line) @@ -1523,25 +1523,25 @@ function M.setup_replace_ellipsis(enable) end -- Create an autogroup to handle the autocmds - vim.api.nvim_create_augroup("EllipsisReplace", { clear = true }) + vim.api.nvim_create_augroup('EllipsisReplace', { clear = true }) if enable then -- Add an autocmd to handle the InsertLeave event - vim.api.nvim_create_autocmd("InsertLeave", { - group = "EllipsisReplace", + vim.api.nvim_create_autocmd('InsertLeave', { + group = 'EllipsisReplace', callback = M.replace_ellipsis, }) -- Optionally, you could call the function on text change as well - vim.api.nvim_create_autocmd("TextChangedI", { - group = "EllipsisReplace", + vim.api.nvim_create_autocmd('TextChangedI', { + group = 'EllipsisReplace', callback = M.replace_ellipsis, }) return true else -- Remove the autocmds vim.api.nvim_del_augroup_by_id( - vim.api.nvim_create_augroup("EllipsisReplace", { clear = true }) + vim.api.nvim_create_augroup('EllipsisReplace', { clear = true }) ) end @@ -1558,16 +1558,16 @@ function M.append_modeline() -- Create the modeline string. local modeline = string.format( - " vim: set ts=%d sw=%d tw=%d %set :", + ' vim: set ts=%d sw=%d tw=%d %set :', tabstop, shiftwidth, textwidth, - expandtab and "" or "no" + expandtab and '' or 'no' ) -- Replace the placeholder in the comment string. local commentstring = vim.o.commentstring - modeline = commentstring:gsub("%%s", modeline) + modeline = commentstring:gsub('%%s', modeline) -- Append the modeline after the last line in the buffer. vim.api.nvim_buf_set_lines(0, -1, -1, false, { modeline }) @@ -1583,8 +1583,8 @@ function M.bufremove(buf) if vim.bo.modified then local choice = vim.fn.confirm( - ("Save changes to %q?"):format(vim.fn.bufname()), - "&Yes\n&No\n&Cancel" + ('Save changes to %q?'):format(vim.fn.bufname()), + '&Yes\n&No\n&Cancel' ) if choice == 0 or choice == 3 then -- 0 for / and 3 for Cancel return @@ -1603,7 +1603,7 @@ function M.bufremove(buf) return end -- Try using alternate buffer - local alt = vim.fn.bufnr("#") + local alt = vim.fn.bufnr('#') if alt ~= buf and vim.fn.buflisted(alt) == 1 then vim.api.nvim_win_set_buf(win, alt) return @@ -1611,7 +1611,7 @@ function M.bufremove(buf) -- Try using previous buffer ---@diagnostic disable-next-line: param-type-mismatch - local has_previous = pcall(vim.cmd, "bprevious") + local has_previous = pcall(vim.cmd, 'bprevious') if has_previous and buf ~= vim.api.nvim_win_get_buf(win) then return end @@ -1623,7 +1623,7 @@ function M.bufremove(buf) end if vim.api.nvim_buf_is_valid(buf) then ---@diagnostic disable-next-line: param-type-mismatch - pcall(vim.cmd, "bdelete! " .. buf) + pcall(vim.cmd, 'bdelete! ' .. buf) end end @@ -1632,7 +1632,7 @@ end ---@param pwd? boolean Check if project directory is a git repository ---@return boolean is_git_repo true if working directory or project directory is a git repository, false otherwise function M.is_git_repo(cwd, pwd) - if type(cwd) == "table" then + if type(cwd) == 'table' then pwd = cwd.pwd cwd = cwd.cwd end @@ -1656,10 +1656,10 @@ function M.is_git_repo(cwd, pwd) -- Helper function to check for a .git directory local function has_git_dir(path) - local git_path = path .. "/.git" + local git_path = path .. '/.git' ---@diagnostic disable-next-line: undefined-field local stat = vim.loop.fs_stat(git_path) - return stat and stat.type == "directory" + return stat and stat.type == 'directory' end if cwd then @@ -1698,40 +1698,40 @@ end ---@return boolean success true if the picker command was successful, false otherwise function M.pick(cmd, provider, options) -- Handle case where `cmd` is a table (destructuring the table fields) - if type(cmd) == "table" then + if type(cmd) == 'table' then provider = cmd.provider options = cmd.options cmd = cmd.cmd end -- Default the command to "files" if not provided - cmd = cmd or "files" + cmd = cmd or 'files' -- Determine the provider if one is not selected -- (defaults to fzf-lua if available, else telescope) -- Will use vim.g.lazyvim_picker if defined if provider == nil then - if vim.g.lazyvim_picker == "fzf" then - provider = "fzf-lua" - elseif vim.g.lazyvim_picker == "telescope" then - provider = "telescope" + if vim.g.lazyvim_picker == 'fzf' then + provider = 'fzf-lua' + elseif vim.g.lazyvim_picker == 'telescope' then + provider = 'telescope' else - local has_fzf, _ = pcall(require, "fzf-lua") + local has_fzf, _ = pcall(require, 'fzf-lua') if has_fzf then - provider = "fzf-lua" + provider = 'fzf-lua' else - provider = "telescope" + provider = 'telescope' end end end -- Handle special commands - if cmd == "config_files" then - cmd = "files" - options = { cwd = vim.fn.stdpath("config") } + if cmd == 'config_files' then + cmd = 'files' + options = { cwd = vim.fn.stdpath('config') } end - if cmd == "files" and provider == "telescope" then - cmd = "find_files" + if cmd == 'files' and provider == 'telescope' then + cmd = 'find_files' end -- Helper function to check if a picker command exists for a given provider @@ -1739,7 +1739,7 @@ function M.pick(cmd, provider, options) local success, picker = pcall(function() return require(provide)[commd] end) - return success and type(picker) == "function" + return success and type(picker) == 'function' end -- Ensure options is always a table (to avoid errors if nil is passed) @@ -1747,12 +1747,12 @@ function M.pick(cmd, provider, options) -- Define available providers in the order of fallback preference local providers = - { provider, provider == "fzf-lua" and "telescope" or "fzf-lua" } + { provider, provider == 'fzf-lua' and 'telescope' or 'fzf-lua' } -- Try running the picker for the first provider (or fallback to the second if not available) for _, current_provider in ipairs(providers) do - if current_provider == "telescope" then - current_provider = "telescope.builtin" + if current_provider == 'telescope' then + current_provider = 'telescope.builtin' end if has_picker(current_provider, cmd) then @@ -1763,25 +1763,25 @@ function M.pick(cmd, provider, options) end -- Handle special cases - if cmd == "file_browser" then - if provider == "mini" then - require("mini.files").open() + if cmd == 'file_browser' then + if provider == 'mini' then + require('mini.files').open() return true - elseif provider == "neotree" then - vim.cmd("Neotree reveal") + elseif provider == 'neotree' then + vim.cmd('Neotree reveal') return true - elseif provider == "oil" then - require("oil").open() + elseif provider == 'oil' then + require('oil').open() return true else - require("telescope").extensions.file_browser.file_browser() + require('telescope').extensions.file_browser.file_browser() return true end end -- If no provider supports the cmd, throw an error vim.notify( - "Unknown command: " .. cmd .. " for providers: fzf-lua, telescope", + 'Unknown command: ' .. cmd .. ' for providers: fzf-lua, telescope', vim.log.levels.ERROR ) return false @@ -1795,9 +1795,9 @@ end ---@return string The converted path function M.convert_path(path) -- Check if the path is a Windows path (e.g., C:\ or D:\) - if path:match("^[A-Za-z]:\\") or path:match("^[A-Za-z]:/") then + if path:match('^[A-Za-z]:\\') or path:match('^[A-Za-z]:/') then -- Convert forward slashes (/) to backslashes (\) - local converted_path = path:gsub("/", "\\") + local converted_path = path:gsub('/', '\\') return converted_path else -- Return the original path if it's not a Windows path @@ -1806,13 +1806,13 @@ function M.convert_path(path) end function M.char_on_pos(pos) - pos = pos or vim.fn.getpos(".") + pos = pos or vim.fn.getpos('.') return tostring(vim.fn.getline(pos[1])):sub(pos[2], pos[2]) end -- From: https://neovim.discourse.group/t/how-do-you-work-with-strings-with-multibyte-characters-in-lua/2437/4 function M.char_byte_count(s, i) - if not s or s == "" then + if not s or s == '' then return 1 end @@ -1831,8 +1831,8 @@ function M.char_byte_count(s, i) end function M.get_visual_range() - local sr, sc = unpack(vim.fn.getpos("v"), 2, 3) - local er, ec = unpack(vim.fn.getpos("."), 2, 3) + local sr, sc = unpack(vim.fn.getpos('v'), 2, 3) + local er, ec = unpack(vim.fn.getpos('.'), 2, 3) -- To correct work with non-single byte chars local byte_c = M.char_byte_count(M.char_on_pos({ er, ec })) @@ -1860,7 +1860,7 @@ end function M.number() local nu = vim.opt.number:get() local rnu = vim.opt.relativenumber:get() - local cur_line = vim.fn.line(".") == vim.v.lnum and vim.v.lnum or vim.v.relnum + local cur_line = vim.fn.line('.') == vim.v.lnum and vim.v.lnum or vim.v.relnum local width = vim.opt.numberwidth:get() local l_count_width = #tostring(vim.api.nvim_buf_line_count(0)) @@ -1868,28 +1868,28 @@ function M.number() local function pad_start(n) local len = width - #tostring(n) - return len < 1 and n or (" "):rep(len) .. n + return len < 1 and n or (' '):rep(len) .. n end - local v_hl = "" + local v_hl = '' - local mode = vim.fn.strtrans(vim.fn.mode()):lower():gsub("%W", "") - if mode == "v" then + local mode = vim.fn.strtrans(vim.fn.mode()):lower():gsub('%W', '') + if mode == 'v' then -- Define the custom highlight outside the function - local bg_color = M.get_bg_color("CursorLineNr") - local fg_color = M.get_bg_color("lualine_a_visual") + local bg_color = M.get_bg_color('CursorLineNr') + local fg_color = M.get_bg_color('lualine_a_visual') vim.api.nvim_set_hl( 0, - "StatusColumnVisualHighlight", + 'StatusColumnVisualHighlight', { fg = fg_color, bg = bg_color } ) local v_range = M.get_visual_range() local is_in_range = vim.v.lnum >= v_range[1] and vim.v.lnum <= v_range[3] - v_hl = is_in_range and "%#StatusColumnVisualHighlight#" or "" + v_hl = is_in_range and '%#StatusColumnVisualHighlight#' or '' end - local line_display = "" + local line_display = '' if nu and rnu then line_display = pad_start(cur_line) elseif nu then @@ -1899,36 +1899,36 @@ function M.number() end -- Include `%s` for signs, followed by the custom line number output - return "%s" .. v_hl .. line_display + return '%s' .. v_hl .. line_display end --- Function to search for the provided filetypes with pickers ---@param filetypes table A list of filetypes to search for function M.pick_filetypes(filetypes) - if not pcall(require, "telescope") then - if not pcall(require, "fzf-lua") then - vim.notify("Picker not found", vim.log.levels.ERROR) + if not pcall(require, 'telescope') then + if not pcall(require, 'fzf-lua') then + vim.notify('Picker not found', vim.log.levels.ERROR) return else - require("fzf-lua").files({ - cmd = "fd --type f " .. table.concat( + require('fzf-lua').files({ + cmd = 'fd --type f ' .. table.concat( vim.tbl_map(function(ft) - return "--extension " .. ft + return '--extension ' .. ft end, filetypes), - " " + ' ' ), }) return end else - require("telescope.builtin").find_files({ + require('telescope.builtin').find_files({ find_command = { - "fd", - "--type", - "f", + 'fd', + '--type', + 'f', unpack(vim .iter(vim.tbl_map(function(ft) - return { "--extension", ft } + return { '--extension', ft } end, filetypes)) :flatten() :totable()), @@ -1939,42 +1939,42 @@ end --- Function to search for cpp files with picker function M.search_cpp_files() - M.pick_filetypes(require("data.types").picker_sets.cpp_files) + M.pick_filetypes(require('data.types').picker_sets.cpp_files) end --- Function to search for python files with picker function M.search_python_files() - M.pick_filetypes(require("data.types").picker_sets.python_files) + M.pick_filetypes(require('data.types').picker_sets.python_files) end --- Function to search for nvim files with picker function M.search_nvim_files() - M.pick_filetypes(require("data.types").picker_sets.nvim_files) + M.pick_filetypes(require('data.types').picker_sets.nvim_files) end --- Function to search for vim files with picker function M.search_vim_files() - M.pick_filetypes(require("data.types").picker_sets.vim_files) + M.pick_filetypes(require('data.types').picker_sets.vim_files) end --- Function to search for java files with picker function M.search_java_files() - M.pick_filetypes(require("data.types").picker_sets.java_files) + M.pick_filetypes(require('data.types').picker_sets.java_files) end --- Function to search for javascript files with picker function M.search_js_files() - M.pick_filetypes(require("data.types").picker_sets.js_files) + M.pick_filetypes(require('data.types').picker_sets.js_files) end --- Function to search for rust files with picker function M.search_rust_files() - M.pick_filetypes(require("data.types").picker_sets.rust_files) + M.pick_filetypes(require('data.types').picker_sets.rust_files) end --- Function to search for HTML files with picker function M.search_html_files() - M.pick_filetypes(require("data.types").picker_sets.html_files) + M.pick_filetypes(require('data.types').picker_sets.html_files) end --- Function to apply the Caesar cipher to a given text @@ -1983,12 +1983,12 @@ end ---@return string shifted_text The transformed text function M.caesar_cipher(text, shift) shift = shift or 3 -- Default shift is 3 if not provided - local shifted_text = "" + local shifted_text = '' - for char in text:gmatch(".") do + for char in text:gmatch('.') do -- Check if the character is a letter - if char:match("%a") then - local base = char:match("%u") and 65 or 97 -- Base ASCII for uppercase or lowercase letters + if char:match('%a') then + local base = char:match('%u') and 65 or 97 -- Base ASCII for uppercase or lowercase letters local new_char = string.char(((string.byte(char) - base + shift) % 26) + base) shifted_text = shifted_text .. new_char @@ -2010,14 +2010,14 @@ end --- Function to apply the Caesar cipher to the visual selection ---@param shift number The shift value function M.caesar_cipher_visual(shift) - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local text = range:text() - local shifted_text = "" + local shifted_text = '' - for char in text:gmatch(".") do - if char:match("%a") then - local base = char:match("%u") and 65 or 97 + for char in text:gmatch('.') do + if char:match('%a') then + local base = char:match('%u') and 65 or 97 local new_char = string.char(((string.byte(char) - base + shift) % 26) + base) shifted_text = shifted_text .. new_char @@ -2032,30 +2032,30 @@ end -- Function to encrypt the entire buffer contents using GPG function M.encrypt_buffer_with_gpg() -- Get the recipient email address from env variable or user input - local recipient = os.getenv("GPG_RECIPIENT") + local recipient = os.getenv('GPG_RECIPIENT') if not recipient then - recipient = vim.fn.input("Enter recipient email: ") + recipient = vim.fn.input('Enter recipient email: ') end -- Create a temporary file to hold the plaintext buffer content local temp_filename = os.tmpname() - local temp_output_filename = os.tmpname() .. ".gpg" -- Temporary output file for encrypted content - local file = io.open(temp_filename, "w") + local temp_output_filename = os.tmpname() .. '.gpg' -- Temporary output file for encrypted content + local file = io.open(temp_filename, 'w') if file then -- Get all lines in the current buffer and write them to the temporary file local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) - local content = table.concat(lines, "\n") + local content = table.concat(lines, '\n') file:write(content) file:close() else - print("Failed to create temporary file") + print('Failed to create temporary file') return end -- Command to encrypt the file using GPG local command = string.format( - "gpg -e -a -o %s -r %s %s", + 'gpg -e -a -o %s -r %s %s', temp_output_filename, recipient, temp_filename @@ -2067,10 +2067,10 @@ function M.encrypt_buffer_with_gpg() -- Check if the GPG command was successful if exit_code == 0 then -- Read the encrypted text from the output file - local encrypted_file = io.open(temp_output_filename, "r") + local encrypted_file = io.open(temp_output_filename, 'r') if encrypted_file then - local encrypted_text = encrypted_file:read("*a") -- Read the entire content + local encrypted_text = encrypted_file:read('*a') -- Read the entire content encrypted_file:close() -- Replace the current buffer's contents with the encrypted text, split into lines @@ -2079,13 +2079,13 @@ function M.encrypt_buffer_with_gpg() 0, -1, false, - vim.split(encrypted_text, "\n") + vim.split(encrypted_text, '\n') ) else - print("Failed to read the encrypted output file.") + print('Failed to read the encrypted output file.') end else - print("GPG command failed. Check your GPG configuration.") + print('GPG command failed. Check your GPG configuration.') end -- Clean up temporary files @@ -2095,18 +2095,18 @@ end -- Function to base64 encode the current line or visual selection local function base64_encode(input) - local b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + local b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' local output = {} - local padding = "" + local padding = '' -- Add padding for any leftover bytes local len = #input if len % 3 == 1 then - input = input .. "\0\0" - padding = "==" + input = input .. '\0\0' + padding = '==' elseif len % 3 == 2 then - input = input .. "\0" - padding = "=" + input = input .. '\0' + padding = '=' end for i = 1, #input, 3 do @@ -2130,7 +2130,7 @@ local function base64_encode(input) end function M.base64_encode_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() @@ -2153,13 +2153,13 @@ end -- Function to base64 decode a string local function base64_decode(input) - local b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + local b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' local output = {} - local padding = input:sub(-2) == "==" and 2 - or (input:sub(-1) == "=" and 1 or 0) + local padding = input:sub(-2) == '==' and 2 + or (input:sub(-1) == '=' and 1 or 0) -- Remove any padding characters - input = input:gsub("=", "") + input = input:gsub('=', '') for i = 1, #input, 4 do local c1, c2, c3, c4 = @@ -2186,7 +2186,7 @@ end -- Function to decode the current visual selection function M.base64_decode_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() @@ -2217,7 +2217,7 @@ local function rot47(input_string) local ascii = string.byte(char) -- Check for newline characters - if char == "\n" then + if char == '\n' then -- Preserve newline characters without modification table.insert(result, char) elseif ascii >= 33 and ascii <= 126 then @@ -2246,7 +2246,7 @@ end --- Applies the ROT47 cipher to the visual selection while preserving newline characters. function M.rot47_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() @@ -2265,12 +2265,12 @@ local function hex_encode(input_string) local char = input_string:sub(i, i) -- Check for newline characters - if char == "\n" then + if char == '\n' then -- Preserve newline characters without modification table.insert(result, char) else -- Convert each character to its hexadecimal representation - local hex = string.format("%02X", string.byte(char)) + local hex = string.format('%02X', string.byte(char)) table.insert(result, hex) end end @@ -2289,7 +2289,7 @@ local function hex_decode(hex_string) local char = hex_string:sub(i, i) -- Check for newline characters - if char == "\n" then + if char == '\n' then -- Preserve newline characters without modification table.insert(result, char) i = i + 1 @@ -2298,7 +2298,7 @@ local function hex_decode(hex_string) local hex_pair = hex_string:sub(i, i + 1) -- Convert the hexadecimal pair to corresponding character - if hex_pair:match("^[0-9A-Fa-f][0-9A-Fa-f]$") then + if hex_pair:match('^[0-9A-Fa-f][0-9A-Fa-f]$') then local byte = tonumber(hex_pair, 16) -- Convert to number table.insert(result, string.char(byte)) -- Convert number to character i = i + 2 -- Move to the next pair @@ -2331,7 +2331,7 @@ end --- Applies the hex encoding to the visual selection while preserving newline characters. function M.hex_encode_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() @@ -2354,7 +2354,7 @@ end --- Reverses the hex encoding of the visual selection while preserving newline characters. function M.hex_decode_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() @@ -2365,26 +2365,26 @@ end --- Function to lookup selection in help docs function M.help_lookup_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() - vim.api.nvim_command("help " .. selected_text) + vim.api.nvim_command('help ' .. selected_text) end --- Function to lookup word in help docs function M.help_lookup_word() - local Range = require("u.range") - local range = Range.from_text_object("iw") + local Range = require('u.range') + local range = Range.from_text_object('iw') if range then local selected_text = range:text() - vim.api.nvim_command("help " .. selected_text) + vim.api.nvim_command('help ' .. selected_text) end end --- Function to look up a string in the help docs ---@param string string The string to be looked up function M.help_lookup_string(string) - vim.api.nvim_command("help " .. string) + vim.api.nvim_command('help ' .. string) end --- Function to add single-quotes around a string @@ -2403,8 +2403,8 @@ end --- Function to lookup the word (quoted) function M.help_lookup_quoted() - local Range = require("u.range") - local range = Range.from_text_object("iw") + local Range = require('u.range') + local range = Range.from_text_object('iw') if range then local selected_text = range:text() M.help_lookup_string(M.wrap_in_quotes(selected_text)) @@ -2413,7 +2413,7 @@ end --- Function to lookup the selection (quoted) function M.help_lookup_quoted_visual() - local Range = require("u.range") + local Range = require('u.range') local range = Range.from_vtext() local selected_text = range:text() M.help_lookup_string(M.wrap_in_quotes(selected_text)) diff --git a/lua/data/init.lua b/lua/data/init.lua index 1f11499..cd98f37 100644 --- a/lua/data/init.lua +++ b/lua/data/init.lua @@ -3,16 +3,16 @@ local data = {} -- Explicitly specify for LSP support -data.keys = require("data.keys") -data.types = require("data.types") -data.func = require("data.func") -data.cmd = require("data.cmd") -data.deps = require("data.deps") -data.dash = require("data.dash") -data.ft = require("data.ft") -data.events = require("data.events") -data.autocmd = require("data.autocmd") -data.cond = require("data.cond") +data.keys = require('data.keys') +data.types = require('data.types') +data.func = require('data.func') +data.cmd = require('data.cmd') +data.deps = require('data.deps') +data.dash = require('data.dash') +data.ft = require('data.ft') +data.events = require('data.events') +data.autocmd = require('data.autocmd') +data.cond = require('data.cond') -- Generic function to iterate over files in a specified directory and load Lua modules function data.load_modules_from_dir(directory, module_prefix) @@ -21,11 +21,11 @@ function data.load_modules_from_dir(directory, module_prefix) for _, file in ipairs(files) do -- Skip init.lua - if file ~= "init.lua" and file:match(".*%.lua$") then + if file ~= 'init.lua' and file:match('.*%.lua$') then -- Get the module name without the .lua extension local module_name = file:sub(1, -5) -- Construct the module path - local module_path = module_prefix .. "." .. module_name + local module_path = module_prefix .. '.' .. module_name -- Load the module if not already explicitly set if not _G[module_name] then _G[module_name] = require(module_path) @@ -37,9 +37,9 @@ end -- Example usage local function read_data_dir() -- Getting the root path for the current module directory - local dir_path = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h") + local dir_path = vim.fn.fnamemodify(debug.getinfo(1, 'S').source:sub(2), ':h') -- Load modules from the data directory - data.load_modules_from_dir(dir_path, "data") + data.load_modules_from_dir(dir_path, 'data') end -- Read the directory and load any additional modules diff --git a/lua/data/keys.lua b/lua/data/keys.lua index 2a39eda..113f48a 100644 --- a/lua/data/keys.lua +++ b/lua/data/keys.lua @@ -9,670 +9,670 @@ local M = {} -- Load utils -local rootiest = require("config.rootiest") +local rootiest = require('config.rootiest') M.alternate = { { -- Toggle Alternate - "A", - "Alternate", - desc = "Toggle Alternate", + 'A', + 'Alternate', + desc = 'Toggle Alternate', }, } M.capsword = { { - "", + '', function() - require("caps-word").toggle() + require('caps-word').toggle() end, - desc = "Toggle CapsWord", - mode = { "i", "n" }, + desc = 'Toggle CapsWord', + mode = { 'i', 'n' }, }, } M.chatgpt = { func = function() -- Add ChatGPT menu - require("data.func").add_keymap(M.group.chatgpt) + require('data.func').add_keymap(M.group.chatgpt) -- Add ChatGPT keys return M.chatgpt.keys end, keys = { { - "cxc", - "ChatGPT", - desc = "ChatGPT", + 'cxc', + 'ChatGPT', + desc = 'ChatGPT', }, { - "cxe", - "ChatGPTEditWithInstruction", - desc = "Edit with instruction", - mode = { "n", "v" }, + 'cxe', + 'ChatGPTEditWithInstruction', + desc = 'Edit with instruction', + mode = { 'n', 'v' }, }, { - "cxg", - "ChatGPTRun grammar_correction", - desc = "Grammar Correction", - mode = { "n", "v" }, + 'cxg', + 'ChatGPTRun grammar_correction', + desc = 'Grammar Correction', + mode = { 'n', 'v' }, }, { - "cxt", - "ChatGPTRun translate", - desc = "Translate", - mode = { "n", "v" }, + 'cxt', + 'ChatGPTRun translate', + desc = 'Translate', + mode = { 'n', 'v' }, }, { - "cxk", - "ChatGPTRun keywords", - desc = "Keywords", - mode = { "n", "v" }, + 'cxk', + 'ChatGPTRun keywords', + desc = 'Keywords', + mode = { 'n', 'v' }, }, { - "cxd", - "ChatGPTRun docstring", - desc = "Docstring", - mode = { "n", "v" }, + 'cxd', + 'ChatGPTRun docstring', + desc = 'Docstring', + mode = { 'n', 'v' }, }, { - "cxa", - "ChatGPTRun add_tests", - desc = "Add Tests", - mode = { "n", "v" }, + 'cxa', + 'ChatGPTRun add_tests', + desc = 'Add Tests', + mode = { 'n', 'v' }, }, { - "cxo", - "ChatGPTRun optimize_code", - desc = "Optimize Code", - mode = { "n", "v" }, + 'cxo', + 'ChatGPTRun optimize_code', + desc = 'Optimize Code', + mode = { 'n', 'v' }, }, { - "cxs", - "ChatGPTRun summarize", - desc = "Summarize", - mode = { "n", "v" }, + 'cxs', + 'ChatGPTRun summarize', + desc = 'Summarize', + mode = { 'n', 'v' }, }, { - "cxf", - "ChatGPTRun fix_bugs", - desc = "Fix Bugs", - mode = { "n", "v" }, + 'cxf', + 'ChatGPTRun fix_bugs', + desc = 'Fix Bugs', + mode = { 'n', 'v' }, }, { - "cxr", - "ChatGPTRun explain_code", - desc = "Explain Code", - mode = { "n", "v" }, + 'cxr', + 'ChatGPTRun explain_code', + desc = 'Explain Code', + mode = { 'n', 'v' }, }, { - "cxr", - "ChatGPTRun roxygen_edit", - desc = "Roxygen Edit", - mode = { "n", "v" }, + 'cxr', + 'ChatGPTRun roxygen_edit', + desc = 'Roxygen Edit', + mode = { 'n', 'v' }, }, { - "cxl", - "ChatGPTRun code_readability_analysis", - desc = "Code Readability Analysis", - mode = { "n", "v" }, + 'cxl', + 'ChatGPTRun code_readability_analysis', + desc = 'Code Readability Analysis', + mode = { 'n', 'v' }, }, }, } M.codesnap = { { -- Save selected code snapshot into clipboard - "cy", - "CodeSnap", - desc = "Save selected code snapshot into clipboard", - mode = "x", + 'cy', + 'CodeSnap', + desc = 'Save selected code snapshot into clipboard', + mode = 'x', }, { -- Save selected code snapshot in ~/Pictures - "cs", - "CodeSnapSave", - desc = "Save selected code snapshot in ~/Pictures", - mode = "x", + 'cs', + 'CodeSnapSave', + desc = 'Save selected code snapshot in ~/Pictures', + mode = 'x', }, { -- Highlight and snapshot selected code into clipboard - "ch", - "CodeSnapHighlight", - desc = "Highlight and snapshot selected code into clipboard", - mode = "x", + 'ch', + 'CodeSnapHighlight', + desc = 'Highlight and snapshot selected code into clipboard', + mode = 'x', }, { -- Save ASCII code snapshot into clipboard - "ci", - "CodeSnapASCII", - desc = "Save ASCII code snapshot into clipboard", - mode = "x", + 'ci', + 'CodeSnapASCII', + desc = 'Save ASCII code snapshot into clipboard', + mode = 'x', }, } M.easyalign = { { -- EasyAlign - "g\\", - "(EasyAlign)", - desc = "EasyAlign", - mode = { "n", "x" }, + 'g\\', + '(EasyAlign)', + desc = 'EasyAlign', + mode = { 'n', 'x' }, }, } M.cipher = { base64 = { { - lhs = "g?", + lhs = 'g?', rhs = function() - require("data.func").base64_encode_text() + require('data.func').base64_encode_text() end, - desc = "Base64 Encode", - mode = "n", + desc = 'Base64 Encode', + mode = 'n', }, { - lhs = "g?", + lhs = 'g?', rhs = function() - require("data.func").base64_encode_visual() + require('data.func').base64_encode_visual() end, - desc = "Base64 Encode", - mode = "v", + desc = 'Base64 Encode', + mode = 'v', }, { - lhs = "g/", + lhs = 'g/', rhs = function() - require("data.func").base64_decode_text() + require('data.func').base64_decode_text() end, - desc = "Base64 Decode", - mode = "n", + desc = 'Base64 Decode', + mode = 'n', }, { - lhs = "g/", + lhs = 'g/', rhs = function() - require("data.func").base64_decode_visual() + require('data.func').base64_decode_visual() end, - desc = "Base64 Decode", - mode = "v", + desc = 'Base64 Decode', + mode = 'v', }, }, hex = { { - lhs = "g?", + lhs = 'g?', rhs = function() - require("data.func").hex_encode_text() + require('data.func').hex_encode_text() end, - desc = "Hex Encode", - mode = "n", + desc = 'Hex Encode', + mode = 'n', }, { - lhs = "g?", + lhs = 'g?', rhs = function() - require("data.func").hex_encode_visual() + require('data.func').hex_encode_visual() end, - desc = "Hex Encode", - mode = "v", + desc = 'Hex Encode', + mode = 'v', }, { - lhs = "g/", + lhs = 'g/', rhs = function() - require("data.func").hex_decode_text() + require('data.func').hex_decode_text() end, - desc = "Hex Decode", - mode = "n", + desc = 'Hex Decode', + mode = 'n', }, { - lhs = "g/", + lhs = 'g/', rhs = function() - require("data.func").hex_decode_visual() + require('data.func').hex_decode_visual() end, - desc = "Hex Decode", - mode = "v", + desc = 'Hex Decode', + mode = 'v', }, }, rot47 = { { - lhs = "g?", + lhs = 'g?', rhs = function() - require("data.func").rot47_text() + require('data.func').rot47_text() end, - desc = "ROT47 Encode", - mode = "n", + desc = 'ROT47 Encode', + mode = 'n', }, { - lhs = "g?", + lhs = 'g?', rhs = function() - require("data.func").rot47_visual() + require('data.func').rot47_visual() end, - desc = "ROT47 Encode", - mode = "v", + desc = 'ROT47 Encode', + mode = 'v', }, }, } M.cmd_mode = function() - if not require("data.func").is_installed("which_key", { load = true }) then + if not require('data.func').is_installed('which_key', { load = true }) then -- Disable the original `q:` mapping - vim.keymap.set("n", "q:", "", { noremap = true, silent = true }) + vim.keymap.set('n', 'q:', '', { noremap = true, silent = true }) -- Remap `q:` functionality to `q:` vim.keymap.set( - "n", - "q:", - "q:", - { noremap = true, silent = false, desc = "Command Mode" } + 'n', + 'q:', + 'q:', + { noremap = true, silent = false, desc = 'Command Mode' } ) else -- Disable the original `q:` mapping and hide it from which-key - require("which-key").add({ - lhs = "q:", - rhs = "", - mode = "n", + require('which-key').add({ + lhs = 'q:', + rhs = '', + mode = 'n', hidden = true, noremap = true, silent = true, }) -- Remap `q:` functionality to `q:` - require("which-key").add({ - lhs = "q:", - rhs = "q:", - mode = "n", + require('which-key').add({ + lhs = 'q:', + rhs = 'q:', + mode = 'n', noremap = true, silent = false, - desc = "Command Mode", + desc = 'Command Mode', }) end end M.cpp_picker = { { -- Cpp Picker - "fC", + 'fC', function() - require("data.func").search_cpp_files() + require('data.func').search_cpp_files() end, - desc = "Pick C++ and H files", + desc = 'Pick C++ and H files', }, } M.flash = { { -- Flash jump to next - "", + '', function() - require("flash").jump() + require('flash').jump() end, - desc = "Flash jump", - mode = { "n", "o", "v" }, + desc = 'Flash jump', + mode = { 'n', 'o', 'v' }, }, } M.minimap = { func = function() -- Add NeoMiniMap menu - require("data.func").add_keymap(M.group.minimap) + require('data.func').add_keymap(M.group.minimap) -- Add NeoMiniMap keys return M.minimap.keys end, keys = { { -- Toggle minimap - "nt", - "Neominimap toggle", - desc = "Toggle minimap", + 'nt', + 'Neominimap toggle', + desc = 'Toggle minimap', }, { -- Enable minimap - "no", - "Neominimap on", - desc = "Enable minimap", + 'no', + 'Neominimap on', + desc = 'Enable minimap', }, { -- Disable minimap - "nc", - "Neominimap off", - desc = "Disable minimap", + 'nc', + 'Neominimap off', + desc = 'Disable minimap', }, { -- Refresh minimap - "nf", - "Neominimap focus", - desc = "Focus on minimap", + 'nf', + 'Neominimap focus', + desc = 'Focus on minimap', }, { -- Unfocus minimap - "nu", - "Neominimap unfocus", - desc = "Unfocus minimap", + 'nu', + 'Neominimap unfocus', + desc = 'Unfocus minimap', }, { -- Toggle focus - "ns", - "Neominimap toggleFocus", - desc = "Toggle focus on minimap", + 'ns', + 'Neominimap toggleFocus', + desc = 'Toggle focus on minimap', }, { -- Toggle minimap for current window - "nwt", - "Neominimap winToggle", - desc = "Toggle minimap for current window", + 'nwt', + 'Neominimap winToggle', + desc = 'Toggle minimap for current window', }, { -- Refresh minimap for current window - "nwr", - "Neominimap winRefresh", - desc = "Refresh minimap for current window", + 'nwr', + 'Neominimap winRefresh', + desc = 'Refresh minimap for current window', }, { -- Enable minimap for current window - "nwo", - "Neominimap winOn", - desc = "Enable minimap for current window", + 'nwo', + 'Neominimap winOn', + desc = 'Enable minimap for current window', }, { -- Disable minimap for current window - "nwc", - "Neominimap winOff", - desc = "Disable minimap for current window", + 'nwc', + 'Neominimap winOff', + desc = 'Disable minimap for current window', }, { -- Toggle minimap for current buffer - "nbt", - "Neominimap bufToggle", - desc = "Toggle minimap for current buffer", + 'nbt', + 'Neominimap bufToggle', + desc = 'Toggle minimap for current buffer', }, { -- Refresh minimap for current buffer - "nbr", - "Neominimap bufRefresh", - desc = "Refresh minimap for current buffer", + 'nbr', + 'Neominimap bufRefresh', + desc = 'Refresh minimap for current buffer', }, { -- Enable minimap for current buffer - "nbo", - "Neominimap bufOn", - desc = "Enable minimap for current buffer", + 'nbo', + 'Neominimap bufOn', + desc = 'Enable minimap for current buffer', }, { -- Disable minimap for current buffer - "nbc", - "Neominimap bufOff", - desc = "Disable minimap for current buffer", + 'nbc', + 'Neominimap bufOff', + desc = 'Disable minimap for current buffer', }, }, } M.neocodeium = { { -- Accept suggestion - "", + '', function() - require("neocodeium").accept() + require('neocodeium').accept() end, - desc = "Accept suggestion", - mode = "i", + desc = 'Accept suggestion', + mode = 'i', }, { -- Accept word - "", + '', function() - require("neocodeium").accept_word() + require('neocodeium').accept_word() end, - desc = "Accept word", - mode = "i", + desc = 'Accept word', + mode = 'i', }, { -- Accept line - "", + '', function() - require("neocodeium").accept_line() + require('neocodeium').accept_line() end, - desc = "Accept line", - mode = "i", + desc = 'Accept line', + mode = 'i', }, { -- Cycle or complete (previous) - "", + '', function() - require("neocodeium").cycle_or_complete(-1) + require('neocodeium').cycle_or_complete(-1) end, - desc = "Cycle or complete (previous)", - mode = "i", + desc = 'Cycle or complete (previous)', + mode = 'i', }, { -- Cycle or complete (next) - "", + '', function() - require("neocodeium").cycle_or_complete() + require('neocodeium').cycle_or_complete() end, - desc = "Cycle or complete (next)", - mode = "i", + desc = 'Cycle or complete (next)', + mode = 'i', }, { -- NeoCodeium Chat - "ch", + 'ch', function() - require("neocodeium").chat() + require('neocodeium').chat() end, - desc = "NeoCodeium Chat", + desc = 'NeoCodeium Chat', }, } M.foldnav = { { -- Goto Start - "", + '', function() - require("foldnav").goto_start() + require('foldnav').goto_start() end, }, { -- Goto Next - "", + '', function() - require("foldnav").goto_next() + require('foldnav').goto_next() end, }, { -- Goto Prev - "", + '', function() - require("foldnav").goto_prev_start() + require('foldnav').goto_prev_start() end, }, { -- Goto End - "", + '', function() - require("foldnav").goto_end() + require('foldnav').goto_end() end, }, } M.gitlinker = { { -- Yank git link - "gy", - "GitLink", - mode = { "n", "v" }, - desc = "Yank git link", + 'gy', + 'GitLink', + mode = { 'n', 'v' }, + desc = 'Yank git link', }, { -- Open git link - "gY", - "GitLink!", - mode = { "n", "v" }, - desc = "Open git link", + 'gY', + 'GitLink!', + mode = { 'n', 'v' }, + desc = 'Open git link', }, } M.gitgraph = { { -- gitgraph_toggle - "gm", + 'gm', function() - require("utils.git").gitgraph_toggle() + require('utils.git').gitgraph_toggle() end, - desc = "GitGraph - Toggle", + desc = 'GitGraph - Toggle', }, } M.gist = { func = function() -- Add gists menu - require("data.func").add_keymap(M.group.gist) + require('data.func').add_keymap(M.group.gist) -- Add gists keys return M.gist.keys end, keys = { { -- Create Gist - "gnc", - "GistCreate", - desc = "Create Gist", - mode = { "n", "x" }, + 'gnc', + 'GistCreate', + desc = 'Create Gist', + mode = { 'n', 'x' }, }, { -- Find Gists - "gnf", - "GistList", - desc = "Find Gists", + 'gnf', + 'GistList', + desc = 'Find Gists', }, }, } M.undotree = function() - require("data.func").add_keymap( - "uu", - "UndotreeToggle", - "Toggle UndoTree" + require('data.func').add_keymap( + 'uu', + 'UndotreeToggle', + 'Toggle UndoTree' ) end M.gp = { func = function() -- Use which-key directly - if pcall(require, "which-key") then - require("which-key").add(M.gp.keys) + if pcall(require, 'which-key') then + require('which-key').add(M.gp.keys) end end, keys = { -- VISUAL mode mappings -- s, x, v modes are handled the same way by which_key { - mode = { "v" }, + mode = { 'v' }, nowait = true, remap = false, { - "", + '', ":'<,'>GpChatNew tabnew", - desc = "ChatNew tabnew", + desc = 'ChatNew tabnew', }, { - "", + '', ":'<,'>GpChatNew vsplit", - desc = "ChatNew vsplit", + desc = 'ChatNew vsplit', }, { - "", + '', ":'<,'>GpChatNew split", - desc = "ChatNew split", + desc = 'ChatNew split', }, - { "a", ":'<,'>GpAppend", desc = "Visual Append (after)" }, + { 'a', ":'<,'>GpAppend", desc = 'Visual Append (after)' }, { - "b", + 'b', ":'<,'>GpPrepend", - desc = "Visual Prepend (before)", + desc = 'Visual Prepend (before)', }, - { "c", ":'<,'>GpChatNew", desc = "Visual Chat New" }, - { "g", group = "generate into new .." }, - { "ge", ":'<,'>GpEnew", desc = "Visual GpEnew" }, - { "gn", ":'<,'>GpNew", desc = "Visual GpNew" }, - { "gp", ":'<,'>GpPopup", desc = "Visual Popup" }, - { "gt", ":'<,'>GpTabnew", desc = "Visual GpTabnew" }, - { "gv", ":'<,'>GpVnew", desc = "Visual GpVnew" }, - { "i", ":'<,'>GpImplement", desc = "Implement selection" }, - { "n", "GpNextAgent", desc = "Next Agent" }, - { "p", ":'<,'>GpChatPaste", desc = "Visual Chat Paste" }, - { "r", ":'<,'>GpRewrite", desc = "Visual Rewrite" }, - { "s", "GpStop", desc = "GpStop" }, - { "t", ":'<,'>GpChatToggle", desc = "Visual Toggle Chat" }, - { "w", group = "Whisper" }, - { "wa", ":'<,'>GpWhisperAppend", desc = "Whisper Append" }, + { 'c', ":'<,'>GpChatNew", desc = 'Visual Chat New' }, + { 'g', group = 'generate into new ..' }, + { 'ge', ":'<,'>GpEnew", desc = 'Visual GpEnew' }, + { 'gn', ":'<,'>GpNew", desc = 'Visual GpNew' }, + { 'gp', ":'<,'>GpPopup", desc = 'Visual Popup' }, + { 'gt', ":'<,'>GpTabnew", desc = 'Visual GpTabnew' }, + { 'gv', ":'<,'>GpVnew", desc = 'Visual GpVnew' }, + { 'i', ":'<,'>GpImplement", desc = 'Implement selection' }, + { 'n', 'GpNextAgent', desc = 'Next Agent' }, + { 'p', ":'<,'>GpChatPaste", desc = 'Visual Chat Paste' }, + { 'r', ":'<,'>GpRewrite", desc = 'Visual Rewrite' }, + { 's', 'GpStop', desc = 'GpStop' }, + { 't', ":'<,'>GpChatToggle", desc = 'Visual Toggle Chat' }, + { 'w', group = 'Whisper' }, + { 'wa', ":'<,'>GpWhisperAppend", desc = 'Whisper Append' }, { - "wb", + 'wb', ":'<,'>GpWhisperPrepend", - desc = "Whisper Prepend", + desc = 'Whisper Prepend', }, - { "we", ":'<,'>GpWhisperEnew", desc = "Whisper Enew" }, - { "wn", ":'<,'>GpWhisperNew", desc = "Whisper New" }, - { "wp", ":'<,'>GpWhisperPopup", desc = "Whisper Popup" }, + { 'we', ":'<,'>GpWhisperEnew", desc = 'Whisper Enew' }, + { 'wn', ":'<,'>GpWhisperNew", desc = 'Whisper New' }, + { 'wp', ":'<,'>GpWhisperPopup", desc = 'Whisper Popup' }, { - "wr", + 'wr', ":'<,'>GpWhisperRewrite", - desc = "Whisper Rewrite", + desc = 'Whisper Rewrite', }, - { "wt", ":'<,'>GpWhisperTabnew", desc = "Whisper Tabnew" }, - { "wv", ":'<,'>GpWhisperVnew", desc = "Whisper Vnew" }, - { "ww", ":'<,'>GpWhisper", desc = "Whisper" }, - { "x", ":'<,'>GpContext", desc = "Visual GpContext" }, + { 'wt', ":'<,'>GpWhisperTabnew", desc = 'Whisper Tabnew' }, + { 'wv', ":'<,'>GpWhisperVnew", desc = 'Whisper Vnew' }, + { 'ww', ":'<,'>GpWhisper", desc = 'Whisper' }, + { 'x', ":'<,'>GpContext", desc = 'Visual GpContext' }, }, -- NORMAL mode mappings { - mode = { "n" }, + mode = { 'n' }, nowait = true, remap = false, - { "", "GpChatNew tabnew", desc = "New Chat tabnew" }, - { "", "GpChatNew vsplit", desc = "New Chat vsplit" }, - { "", "GpChatNew split", desc = "New Chat split" }, - { "a", "GpAppend", desc = "Append (after)" }, - { "b", "GpPrepend", desc = "Prepend (before)" }, - { "c", "GpChatNew", desc = "New Chat" }, - { "f", "GpChatFinder", desc = "Chat Finder" }, - { "g", group = "generate into new .." }, - { "ge", "GpEnew", desc = "GpEnew" }, - { "gn", "GpNew", desc = "GpNew" }, - { "gp", "GpPopup", desc = "Popup" }, - { "gt", "GpTabnew", desc = "GpTabnew" }, - { "gv", "GpVnew", desc = "GpVnew" }, - { "n", "GpNextAgent", desc = "Next Agent" }, - { "r", "GpRewrite", desc = "Inline Rewrite" }, - { "s", "GpStop", desc = "GpStop" }, - { "t", "GpChatToggle", desc = "Toggle Chat" }, - { "w", group = "Whisper" }, + { '', 'GpChatNew tabnew', desc = 'New Chat tabnew' }, + { '', 'GpChatNew vsplit', desc = 'New Chat vsplit' }, + { '', 'GpChatNew split', desc = 'New Chat split' }, + { 'a', 'GpAppend', desc = 'Append (after)' }, + { 'b', 'GpPrepend', desc = 'Prepend (before)' }, + { 'c', 'GpChatNew', desc = 'New Chat' }, + { 'f', 'GpChatFinder', desc = 'Chat Finder' }, + { 'g', group = 'generate into new ..' }, + { 'ge', 'GpEnew', desc = 'GpEnew' }, + { 'gn', 'GpNew', desc = 'GpNew' }, + { 'gp', 'GpPopup', desc = 'Popup' }, + { 'gt', 'GpTabnew', desc = 'GpTabnew' }, + { 'gv', 'GpVnew', desc = 'GpVnew' }, + { 'n', 'GpNextAgent', desc = 'Next Agent' }, + { 'r', 'GpRewrite', desc = 'Inline Rewrite' }, + { 's', 'GpStop', desc = 'GpStop' }, + { 't', 'GpChatToggle', desc = 'Toggle Chat' }, + { 'w', group = 'Whisper' }, { - "wa", - "GpWhisperAppend", - desc = "Whisper Append (after)", + 'wa', + 'GpWhisperAppend', + desc = 'Whisper Append (after)', }, { - "wb", - "GpWhisperPrepend", - desc = "Whisper Prepend (before)", + 'wb', + 'GpWhisperPrepend', + desc = 'Whisper Prepend (before)', }, - { "we", "GpWhisperEnew", desc = "Whisper Enew" }, - { "wn", "GpWhisperNew", desc = "Whisper New" }, - { "wp", "GpWhisperPopup", desc = "Whisper Popup" }, + { 'we', 'GpWhisperEnew', desc = 'Whisper Enew' }, + { 'wn', 'GpWhisperNew', desc = 'Whisper New' }, + { 'wp', 'GpWhisperPopup', desc = 'Whisper Popup' }, { - "wr", - "GpWhisperRewrite", - desc = "Whisper Inline Rewrite", + 'wr', + 'GpWhisperRewrite', + desc = 'Whisper Inline Rewrite', }, - { "wt", "GpWhisperTabnew", desc = "Whisper Tabnew" }, - { "wv", "GpWhisperVnew", desc = "Whisper Vnew" }, - { "ww", "GpWhisper", desc = "Whisper" }, - { "x", "GpContext", desc = "Toggle GpContext" }, + { 'wt', 'GpWhisperTabnew', desc = 'Whisper Tabnew' }, + { 'wv', 'GpWhisperVnew', desc = 'Whisper Vnew' }, + { 'ww', 'GpWhisper', desc = 'Whisper' }, + { 'x', 'GpContext', desc = 'Toggle GpContext' }, }, -- INSERT mode mappings { - mode = { "i" }, + mode = { 'i' }, nowait = true, remap = false, - { "", "GpChatNew tabnew", desc = "New Chat tabnew" }, - { "", "GpChatNew vsplit", desc = "New Chat vsplit" }, - { "", "GpChatNew split", desc = "New Chat split" }, - { "a", "GpAppend", desc = "Append (after)" }, - { "b", "GpPrepend", desc = "Prepend (before)" }, - { "c", "GpChatNew", desc = "New Chat" }, - { "f", "GpChatFinder", desc = "Chat Finder" }, - { "g", group = "generate into new .." }, - { "ge", "GpEnew", desc = "GpEnew" }, - { "gn", "GpNew", desc = "GpNew" }, - { "gp", "GpPopup", desc = "Popup" }, - { "gt", "GpTabnew", desc = "GpTabnew" }, - { "gv", "GpVnew", desc = "GpVnew" }, - { "n", "GpNextAgent", desc = "Next Agent" }, - { "r", "GpRewrite", desc = "Inline Rewrite" }, - { "s", "GpStop", desc = "GpStop" }, - { "t", "GpChatToggle", desc = "Toggle Chat" }, - { "w", group = "Whisper" }, + { '', 'GpChatNew tabnew', desc = 'New Chat tabnew' }, + { '', 'GpChatNew vsplit', desc = 'New Chat vsplit' }, + { '', 'GpChatNew split', desc = 'New Chat split' }, + { 'a', 'GpAppend', desc = 'Append (after)' }, + { 'b', 'GpPrepend', desc = 'Prepend (before)' }, + { 'c', 'GpChatNew', desc = 'New Chat' }, + { 'f', 'GpChatFinder', desc = 'Chat Finder' }, + { 'g', group = 'generate into new ..' }, + { 'ge', 'GpEnew', desc = 'GpEnew' }, + { 'gn', 'GpNew', desc = 'GpNew' }, + { 'gp', 'GpPopup', desc = 'Popup' }, + { 'gt', 'GpTabnew', desc = 'GpTabnew' }, + { 'gv', 'GpVnew', desc = 'GpVnew' }, + { 'n', 'GpNextAgent', desc = 'Next Agent' }, + { 'r', 'GpRewrite', desc = 'Inline Rewrite' }, + { 's', 'GpStop', desc = 'GpStop' }, + { 't', 'GpChatToggle', desc = 'Toggle Chat' }, + { 'w', group = 'Whisper' }, { - "wa", - "GpWhisperAppend", - desc = "Whisper Append (after)", + 'wa', + 'GpWhisperAppend', + desc = 'Whisper Append (after)', }, { - "wb", - "GpWhisperPrepend", - desc = "Whisper Prepend (before)", + 'wb', + 'GpWhisperPrepend', + desc = 'Whisper Prepend (before)', }, - { "we", "GpWhisperEnew", desc = "Whisper Enew" }, - { "wn", "GpWhisperNew", desc = "Whisper New" }, - { "wp", "GpWhisperPopup", desc = "Whisper Popup" }, + { 'we', 'GpWhisperEnew', desc = 'Whisper Enew' }, + { 'wn', 'GpWhisperNew', desc = 'Whisper New' }, + { 'wp', 'GpWhisperPopup', desc = 'Whisper Popup' }, { - "wr", - "GpWhisperRewrite", - desc = "Whisper Inline Rewrite", + 'wr', + 'GpWhisperRewrite', + desc = 'Whisper Inline Rewrite', }, - { "wt", "GpWhisperTabnew", desc = "Whisper Tabnew" }, - { "wv", "GpWhisperVnew", desc = "Whisper Vnew" }, - { "ww", "GpWhisper", desc = "Whisper" }, - { "x", "GpContext", desc = "Toggle GpContext" }, + { 'wt', 'GpWhisperTabnew', desc = 'Whisper Tabnew' }, + { 'wv', 'GpWhisperVnew', desc = 'Whisper Vnew' }, + { 'ww', 'GpWhisper', desc = 'Whisper' }, + { 'x', 'GpContext', desc = 'Toggle GpContext' }, }, }, } @@ -680,531 +680,533 @@ M.gp = { M.group = { avante = { { -- Avante - lhs = "a", - icon = { icon = "", color = "red" }, - group = "Avante", + lhs = 'a', + icon = { icon = '', color = 'red' }, + group = 'Avante', }, }, chatgpt = { -- ChatGPT - lhs = "cx", - group = "ChatGPT", - icon = { icon = "", color = "blue" }, + lhs = 'cx', + group = 'ChatGPT', + icon = { icon = '', color = 'blue' }, }, gist = { -- Gists menu - lhs = "gn", - group = "Gists", - icon = { icon = "", color = "orange" }, + lhs = 'gn', + group = 'Gists', + icon = { icon = '', color = 'orange' }, }, minimap = { -- MiniMap menu - lhs = "n", - group = "MiniMap", - icon = { icon = "", color = "green" }, + lhs = 'n', + group = 'MiniMap', + icon = { icon = '', color = 'green' }, }, nvimup = { { -- Neovim Updater menu - lhs = "qu", - group = "Neovim Updater", - icon = { icon = "", color = "red" }, + lhs = 'qu', + group = 'Neovim Updater', + icon = { icon = '', color = 'red' }, }, { -- Neovim Updater Commits menu - lhs = "quc", - group = "New Commits", - icon = { icon = "", color = "green" }, + lhs = 'quc', + group = 'New Commits', + icon = { icon = '', color = 'green' }, }, { -- MultiCursor - lhs = "m", - group = "MultiCursor", - icon = { icon = "󰬸", color = "green" }, + lhs = 'm', + group = 'MultiCursor', + icon = { icon = '󰬸', color = 'green' }, }, }, } M.groups = { { -- Lazy menu - lhs = "l", - group = "Lazy", - icon = { icon = "󰒲", color = "red" }, + lhs = 'l', + group = 'Lazy', + icon = { icon = '󰒲', color = 'red' }, }, } M.help = { { -- Lookup word - lhs = "h", + lhs = 'h', rhs = "execute 'help ' . expand('')", - desc = "Lookup word", + desc = 'Lookup word', }, { -- Lookup selection - lhs = "h", + lhs = 'h', rhs = function() - require("data.func").help_lookup_visual() + require('data.func').help_lookup_visual() end, - desc = "Lookup selection", - mode = "v", + desc = 'Lookup selection', + mode = 'v', }, } M.multicursor = { { - "", + '', function() - require("multicursor-nvim").addCursor("k") + require('multicursor-nvim').addCursor('k') end, - mode = { "n", "v" }, - desc = "Add Cursor Above", + mode = { 'n', 'v' }, + desc = 'Add Cursor Above', }, { - "", + '', function() - require("multicursor-nvim").addCursor("j") + require('multicursor-nvim').addCursor('j') end, - mode = { "n", "v" }, - desc = "Add Cursor Below", + mode = { 'n', 'v' }, + desc = 'Add Cursor Below', }, { - "", + '', function() - require("multicursor-nvim").addCursor("*") + require('multicursor-nvim').addCursor('*') end, - desc = "Add Cursor and Skip Word", - mode = { "n", "v" }, + desc = 'Add Cursor and Skip Word', + mode = { 'n', 'v' }, }, { - "", + '', function() - require("multicursor-nvim").skipCursor("*") + require('multicursor-nvim').skipCursor('*') end, - desc = "Skip Word", - mode = { "n", "v" }, + desc = 'Skip Word', + mode = { 'n', 'v' }, }, { - "", + '', function() - require("multicursor-nvim").nextCursor() + require('multicursor-nvim').nextCursor() end, - desc = "Next Cursor", - mode = { "n", "v" }, + desc = 'Next Cursor', + mode = { 'n', 'v' }, }, { - "", + '', function() - require("multicursor-nvim").prevCursor() + require('multicursor-nvim').prevCursor() end, - desc = "Previous Cursor", - mode = { "n", "v" }, + desc = 'Previous Cursor', + mode = { 'n', 'v' }, }, { - "mx", + 'mx', function() - require("multicursor-nvim").deleteCursor() + require('multicursor-nvim').deleteCursor() end, - desc = "Delete Cursor", - mode = { "n", "v" }, + desc = 'Delete Cursor', + mode = { 'n', 'v' }, }, { - "", + '', function() - require("multicursor-nvim").handleMouse() + require('multicursor-nvim').handleMouse() end, - desc = "Add/Remove Cursor", - mode = "n", + desc = 'Add/Remove Cursor', + mode = 'n', }, { - "", + '', function() - if require("multicursor-nvim").cursorsEnabled() then - require("multicursor-nvim").disableCursors() -- Stop other cursors from moving, allowing main cursor repositioning. + if require('multicursor-nvim').cursorsEnabled() then + require('multicursor-nvim').disableCursors() -- Stop other cursors from moving, allowing main cursor repositioning. else - require("multicursor-nvim").addCursor() -- Add a cursor if none are enabled. + require('multicursor-nvim').addCursor() -- Add a cursor if none are enabled. end end, - desc = "Add Cursor", - mode = { "n", "v" }, + desc = 'Add Cursor', + mode = { 'n', 'v' }, }, { - "", + '', function() - if not require("multicursor-nvim").cursorsEnabled() then - require("multicursor-nvim").enableCursors() -- Enable cursors. - elseif require("multicursor-nvim").hasCursors() then - require("multicursor-nvim").clearCursors() -- Clear all cursors. + if not require('multicursor-nvim').cursorsEnabled() then + require('multicursor-nvim').enableCursors() -- Enable cursors. + elseif require('multicursor-nvim').hasCursors() then + require('multicursor-nvim').clearCursors() -- Clear all cursors. else -- Default handler can be defined here if needed. end end, - desc = "Escape Handler", - mode = "n", + desc = 'Escape Handler', + mode = 'n', }, { - "ma", + 'ma', function() - require("multicursor-nvim").alignCursors() + require('multicursor-nvim').alignCursors() end, - desc = "Align Cursors", - mode = "n", + desc = 'Align Cursors', + mode = 'n', }, { - "mS", + 'mS', function() - require("multicursor-nvim").splitCursors() + require('multicursor-nvim').splitCursors() end, - desc = "Split Cursors", - mode = "v", + desc = 'Split Cursors', + mode = 'v', }, { - "mI", + 'mI', function() - require("multicursor-nvim").insertVisual() + require('multicursor-nvim').insertVisual() end, - desc = "Insert Visual", - mode = "v", + desc = 'Insert Visual', + mode = 'v', }, { - "mA", + 'mA', function() - require("multicursor-nvim").appendVisual() + require('multicursor-nvim').appendVisual() end, - desc = "Append Visual", - mode = "v", + desc = 'Append Visual', + mode = 'v', }, { - "mM", + 'mM', function() - require("multicursor-nvim").matchCursors() + require('multicursor-nvim').matchCursors() end, - desc = "Match Cursors", - mode = "v", + desc = 'Match Cursors', + mode = 'v', }, { - "mt", + 'mt', function() - require("multicursor-nvim").transposeCursors(1) + require('multicursor-nvim').transposeCursors(1) end, - desc = "Transpose Cursors  ", - mode = "v", + desc = 'Transpose Cursors  ', + mode = 'v', }, { - "mT", + 'mT', function() - require("multicursor-nvim").transposeCursors(-1) + require('multicursor-nvim').transposeCursors(-1) end, - desc = "Transpose Cursors  ", - mode = "v", + desc = 'Transpose Cursors  ', + mode = 'v', }, } M.nvimup = { { -- Update Neovim from source - "quU", - ":UpdateNeovim", - desc = "Update Neovim", + 'quU', + ':UpdateNeovim', + desc = 'Update Neovim', }, { -- Update Neovim from source in debug mode - "quD", + 'quD', function() - require("nvim_updater").update_neovim({ build_type = "Debug" }) + require('nvim_updater').update_neovim({ build_type = 'Debug' }) end, - desc = "Debug Build Neovim", + desc = 'Debug Build Neovim', }, { -- Update Neovim from source in release mode - "quR", + 'quR', function() - require("nvim_updater").update_neovim({ build_type = "Release" }) + require('nvim_updater').update_neovim({ build_type = 'Release' }) end, - desc = "Release Build Neovim", + desc = 'Release Build Neovim', }, { -- Remove Neovim Source directory - "quX", + 'quX', function() - require("nvim_updater").remove_source_dir() + require('nvim_updater').remove_source_dir() end, - desc = "Remove Neovim Source", + desc = 'Remove Neovim Source', }, { -- Show new nvim source commits in Telescope - "quct", + 'quct', function() - require("nvim_updater").show_new_commits_in_telescope() + require('nvim_updater').show_new_commits_in_telescope() end, - desc = "Show New Commits in Telescope", + desc = 'Show New Commits in Telescope', }, { -- Show new nvim source commits in DiffView - "qucd", + 'qucd', function() - require("nvim_updater").show_new_commits_in_diffview() + require('nvim_updater').show_new_commits_in_diffview() end, - desc = "Show New Commits in DiffView", + desc = 'Show New Commits in DiffView', }, { -- Show new nvim source commits in terminal - "qucc", + 'qucc', function() - require("nvim_updater").show_new_commits() + require('nvim_updater').show_new_commits() end, - desc = "Show New Commits in terminal", + desc = 'Show New Commits in terminal', }, } M.gx = { { -- Open URL/Link - "gx", - "Browse", - mode = { "n", "x" }, - desc = "Open URL/Link", + 'gx', + 'Browse', + mode = { 'n', 'x' }, + desc = 'Open URL/Link', }, } M.indentor = { { -- Indentor - "", + '', function() - require("utils.indentor").insert_previous_line_indentation() + require('utils.indentor').insert_previous_line_indentation() end, - "Insert Previous Line Indentation", - { "i", "n" }, + 'Insert Previous Line Indentation', + { 'i', 'n' }, }, } M.lazygit = { { -- LazyGit - "lg", + 'lg', function() - require("data.func").open_lazygit_popup() + require('data.func').open_lazygit_popup() end, - desc = "LazyGit", + desc = 'LazyGit', }, } ---@function Helper function to toggle mini.files explorer ---@param ... any Optional arguments to pass to mini.files.open local minifiles_toggle = function(...) - if not require("mini.files").close() then - require("mini.files").open(...) + if not require('mini.files').close() then + require('mini.files').open(...) end end --- MiniFiles keymaps M.minifiles = { { - "fm", + 'fm', function() minifiles_toggle(vim.api.nvim_buf_get_name(0), true) end, - desc = "Open mini.files", + desc = 'Open mini.files', }, { - "fM", + 'fM', function() minifiles_toggle(vim.uv.cwd(), true) end, - desc = "Open mini.files (CWD)", + desc = 'Open mini.files (CWD)', }, { -- Mini.files - ".", + '.', function() minifiles_toggle(vim.api.nvim_buf_get_name(0), true) end, - desc = "Open mini.files", + desc = 'Open mini.files', }, { -- Mini.files - "sf", + 'sf', function() minifiles_toggle(vim.api.nvim_buf_get_name(0), true) end, - desc = "Open mini.files", + desc = 'Open mini.files', }, } --- Misc keymaps M.misc = { { -- jk in insert and visual to escape - "jk", - "", - mode = { "i", "v" }, - desc = "Escape", + 'jk', + '', + mode = { 'i', 'v' }, + desc = 'Escape', }, { -- Clear search highlight - "s", - "noh", - desc = "Clear search", + 's', + 'noh', + desc = 'Clear search', }, { -- Modeline - "cM", + 'cM', function() - require("data.func").append_modeline() + require('data.func').append_modeline() end, - desc = "Add Modeline", + desc = 'Add Modeline', }, { -- Yank line (without whitespace) - lhs = "yo", + lhs = 'yo', rhs = function() rootiest.yank_line() end, - desc = "Yank Line-text", + desc = 'Yank Line-text', }, { -- Yank and trim selection - lhs = "y", + lhs = 'y', rhs = function() - require("data.func").trim_yank() + require('data.func').trim_yank() end, - desc = "Yank and trim selection", + desc = 'Yank and trim selection', }, { -- Hardmode - lhs = "uH", + lhs = 'uH', rhs = function() rootiest.toggle_hardmode() end, - desc = "Toggle Hardmode", + desc = 'Toggle Hardmode', }, { -- Reload config - lhs = "qr", + lhs = 'qr', rhs = function() - require("data.func").reload_config() + require('data.func').reload_config() end, - desc = "Reload Config", + desc = 'Reload Config', }, { -- Yank buffer - lhs = "Y", - rhs = "%y", - desc = "Yank buffer contents", + lhs = 'Y', + rhs = '%y', + desc = 'Yank buffer contents', }, { -- Select all - lhs = "", - rhs = "norm ggVG", - desc = "Select all", + lhs = '', + rhs = 'norm ggVG', + desc = 'Select all', }, { -- Neotree - lhs = "|", - rhs = "Neotree reveal toggle", - desc = "Neotree toggle", + lhs = '|', + rhs = 'Neotree reveal toggle', + desc = 'Neotree toggle', }, { -- Neotree - lhs = "\\", - rhs = "Neotree reveal toggle", - desc = "Neotree toggle", + lhs = '\\', + rhs = 'Neotree reveal toggle', + desc = 'Neotree toggle', }, { -- Telescope Find Files - lhs = "", + lhs = '', rhs = function() - require("data.func").pick() + require('data.func').pick() end, - desc = "Find Files", + desc = 'Find Files', }, { -- Grep files - lhs = "/", + lhs = '/', rhs = function() - require("data.func").pick({ cmd = "live_grep" }) + require('data.func').pick({ cmd = 'live_grep' }) end, - desc = "Grep Files", + desc = 'Grep Files', }, { -- Exit Neovim - lhs = "Q", + lhs = 'Q', rhs = "lua require('data').func.exit()", - desc = "Exit Neovim", + desc = 'Exit Neovim', }, { -- LazyVim - lhs = "lv", - rhs = "Lazy", - desc = "LazyVim", + lhs = 'lv', + rhs = 'Lazy', + desc = 'LazyVim', }, { -- LazyExtras - lhs = "lx", - rhs = "LazyExtras", - desc = "LazyExtras", + lhs = 'lx', + rhs = 'LazyExtras', + desc = 'LazyExtras', }, { -- De-map Ctrl+Shift+LeftClick to avoid conflicts with WezTerm - lhs = "", - rhs = "", - desc = "Prevent conflict with WezTerm hyperlinks", - mode = "n", + lhs = '', + rhs = '', + desc = 'Prevent conflict with WezTerm hyperlinks', + mode = 'n', hidden = true, }, { -- Visual mode: Move selected block of text up - lhs = "K", + lhs = 'K', rhs = function() - require("data.func").move_visual(true) + local count = vim.v.count1 + require('data.func').move_visual(true, count) end, - desc = "Move block of text up", - mode = "v", + desc = 'Move block of text up', + mode = 'v', }, { -- Visual mode: Move selected block of text down - lhs = "J", + lhs = 'J', rhs = function() - require("data.func").move_visual(false) + local count = vim.v.count1 + require('data.func').move_visual(false, count) end, - desc = "Move block of text down", - mode = "v", + desc = 'Move block of text down', + mode = 'v', }, { -- Test Prompt: Enter your name - lhs = "qP", + lhs = 'qP', rhs = function() - require("data.func").InputPrompt("Enter your name: ", function(input) + require('data.func').InputPrompt('Enter your name: ', function(input) if input then -- trim whitespace from end of input - input = input:gsub("%s+$", "") - print("👋😎 Hello " .. input .. "!") + input = input:gsub('%s+$', '') + print('👋😎 Hello ' .. input .. '!') else - print("Input was canceled") + print('Input was canceled') end end) end, - desc = "Test Prompt", + desc = 'Test Prompt', }, { -- Paste over text with overwrite - lhs = "cp", + lhs = 'cp', rhs = function() - require("data.func").paste_overwrite() + require('data.func').paste_overwrite() end, - desc = "Paste overwrite", - mode = "n", + desc = 'Paste overwrite', + mode = 'n', }, { -- Dump buffer contents to a table in register - lhs = "bY", + lhs = 'bY', rhs = function() - require("data.func").dump_buffer_to_table("+") + require('data.func').dump_buffer_to_table('+') end, - desc = "Yank buffer as table", - mode = "n", + desc = 'Yank buffer as table', + mode = 'n', }, { -- Yank buffer - lhs = "by", - rhs = "%y", - desc = "Yank buffer", - mode = "n", + lhs = 'by', + rhs = '%y', + desc = 'Yank buffer', + mode = 'n', }, } M.nekifoch = { { -- List Fonts - "u,l", - "Nekifoch list", - desc = "Fonts list", + 'u,l', + 'Nekifoch list', + desc = 'Fonts list', }, { -- Check Font - "u,c", - "Nekifoch check", - desc = "Check current font settings", + 'u,c', + 'Nekifoch check', + desc = 'Check current font settings', }, { -- Set Font Family - "u,f", + 'u,f', function() - require("nekifoch.nui_set_font")() + require('nekifoch.nui_set_font')() end, - desc = "Set font family", + desc = 'Set font family', }, { -- Set Font Size - "u,s", + 'u,s', function() - require("nekifoch.nui_set_size")() + require('nekifoch.nui_set_size')() end, - desc = "Set font size", + desc = 'Set font size', }, } M.precog = { { -- Toggle Precognition - "zk", + 'zk', function() - require("config.rootiest").toggle_precognition() + require('config.rootiest').toggle_precognition() end, - desc = "Toggle Precognition", + desc = 'Toggle Precognition', }, } @@ -1215,361 +1217,361 @@ M.qalc = { -- desc = "Qalc", -- }, { -- Set a key mapping to run :Qalc and enter insert mode - "qc", + 'qc', function() -- Run the Qalc command - vim.cmd("Qalc") + vim.cmd('Qalc') -- Enter insert mode directly - vim.cmd("startinsert") + vim.cmd('startinsert') end, - desc = "Qalc", + desc = 'Qalc', }, } M.ripsub = { { -- Rip Substitute - "fs", + 'fs', function() - require("rip-substitute").sub() + require('rip-substitute').sub() end, - mode = { "n", "x" }, - desc = "Rip Substitute", + mode = { 'n', 'x' }, + desc = 'Rip Substitute', }, } M.splitjoin = { - toggle = "gJ", + toggle = 'gJ', } M.splits = { resize = { { -- Resize split leftwards - "", + '', function() - require("smart-splits").resize_left() + require('smart-splits').resize_left() end, - desc = "Resize split left", + desc = 'Resize split left', }, { -- Resize split downwards - "", + '', function() - require("smart-splits").resize_down() + require('smart-splits').resize_down() end, - desc = "Resize split down", + desc = 'Resize split down', }, { -- Resize split upwards - "", + '', function() - require("smart-splits").resize_up() + require('smart-splits').resize_up() end, - desc = "Resize split up", + desc = 'Resize split up', }, { -- Resize split rightwards - "", + '', function() - require("smart-splits").resize_right() + require('smart-splits').resize_right() end, - desc = "Resize split right", + desc = 'Resize split right', }, { -- Start interactive split resizing - "", + '', function() - require("smart-splits").start_resize_mode() + require('smart-splits').start_resize_mode() end, - desc = "Resize split interactively", + desc = 'Resize split interactively', }, }, move = { { -- Move cursor to split left - "", + '', function() - require("smart-splits").move_cursor_left() + require('smart-splits').move_cursor_left() end, - desc = "Move to split left", + desc = 'Move to split left', }, { -- Move cursor to split below - "", + '', function() - require("smart-splits").move_cursor_down() + require('smart-splits').move_cursor_down() end, - desc = "Move to split below", + desc = 'Move to split below', }, { -- Move cursor to split above - "", + '', function() - require("smart-splits").move_cursor_up() + require('smart-splits').move_cursor_up() end, - desc = "Move to split above", + desc = 'Move to split above', }, { -- Move cursor to split right - "", + '', function() - require("smart-splits").move_cursor_right() + require('smart-splits').move_cursor_right() end, - desc = "Move to split right", + desc = 'Move to split right', }, { -- Move cursor to previous split - "", + '', function() - require("smart-splits").move_cursor_previous() + require('smart-splits').move_cursor_previous() end, - desc = "Move to previous split", + desc = 'Move to previous split', }, }, swap = { { -- Swap buffer with the one to the left - "", + '', function() - require("smart-splits").swap_buf_left() + require('smart-splits').swap_buf_left() end, - desc = "Swap buffer left", + desc = 'Swap buffer left', }, { -- Swap buffer with the one below - "", + '', function() - require("smart-splits").swap_buf_down() + require('smart-splits').swap_buf_down() end, - desc = "Swap buffer down", + desc = 'Swap buffer down', }, { -- Swap buffer with the one above - "", + '', function() - require("smart-splits").swap_buf_up() + require('smart-splits').swap_buf_up() end, - desc = "Swap buffer up", + desc = 'Swap buffer up', }, { -- Swap buffer with the one to the right - "", + '', function() - require("smart-splits").swap_buf_right() + require('smart-splits').swap_buf_right() end, - desc = "Swap buffer right", + desc = 'Swap buffer right', }, }, } M.substitute = { { -- Substitute operator in normal mode - "x", + 'x', function() - require("substitute").operator() + require('substitute').operator() end, - desc = "Substitute operator", + desc = 'Substitute operator', }, { -- Substitute line in normal mode - "xx", + 'xx', function() - require("substitute").line() + require('substitute').line() end, - desc = "Substitute line", + desc = 'Substitute line', }, { -- Substitute end of line in normal mode - "X", + 'X', function() - require("substitute").eol() + require('substitute').eol() end, - desc = "Substitute end of line", + desc = 'Substitute end of line', }, { -- Substitute visual selection in visual mode - "x", + 'x', function() - require("substitute").visual() + require('substitute').visual() end, - desc = "Substitute visual selection", - mode = "x", + desc = 'Substitute visual selection', + mode = 'x', }, { -- Substitute visual selection in visual mode - "m", + 'm', function() - require("substitute").visual() + require('substitute').visual() end, - desc = "Substitute", - mode = "x", + desc = 'Substitute', + mode = 'x', }, } M.overrides = { { -- De-map 's' to avoid conflicts with mini.surround - lhs = "s", - rhs = "", -- This disables the keymap - desc = "Surround", - mode = { "n", "x" }, + lhs = 's', + rhs = '', -- This disables the keymap + desc = 'Surround', + mode = { 'n', 'x' }, }, } M.telescope = { cmdline = { { - ":", + ':', function() - require("telescope").extensions.cmdline.cmdline() + require('telescope').extensions.cmdline.cmdline() end, - desc = "Cmdline", + desc = 'Cmdline', }, }, lazy = { { - "fz", + 'fz', function() - require("telescope").extensions.lazy.lazy() + require('telescope').extensions.lazy.lazy() end, - desc = "Lazy Picker", + desc = 'Lazy Picker', }, }, symbols = { { -- Telescope Symbols - "f.", + 'f.', function() - require("telescope.builtin").symbols({ + require('telescope.builtin').symbols({ sources = { - "nerd", - "emoji", - "kaomoji", - "gitmoji", - "math", - "latex", - "julia", + 'nerd', + 'emoji', + 'kaomoji', + 'gitmoji', + 'math', + 'latex', + 'julia', }, }) end, - desc = "Pick Icons", + desc = 'Pick Icons', }, { -- Pick Icon in insert mode - "", + '', function() - require("telescope.builtin").symbols({ + require('telescope.builtin').symbols({ sources = { - "nerd", - "emoji", - "kaomoji", - "gitmoji", - "math", - "latex", - "julia", + 'nerd', + 'emoji', + 'kaomoji', + 'gitmoji', + 'math', + 'latex', + 'julia', }, }) end, - desc = "Pick Icon", - mode = "i", + desc = 'Pick Icon', + mode = 'i', }, }, toggleterm = { { -- Pick ToggleTerms - "ft", + 'ft', function() - require("toggleterm-manager").open({}) + require('toggleterm-manager').open({}) end, - desc = "Pick Terminals", - mode = "n", + desc = 'Pick Terminals', + mode = 'n', }, }, filebrowser = { { - "e", + 'e', function() - require("telescope").extensions.file_browser.file_browser() + require('telescope').extensions.file_browser.file_browser() end, - desc = "Telescope File Browser", - mode = "n", + desc = 'Telescope File Browser', + mode = 'n', }, { - "sF", + 'sF', function() - require("telescope").extensions.file_browser.file_browser() + require('telescope').extensions.file_browser.file_browser() end, - desc = "Telescope File Browser", - mode = "n", + desc = 'Telescope File Browser', + mode = 'n', }, }, } M.toggleterm = { { -- Toggle Terminal - "", - "ToggleTerm", - desc = "Toggle Terminal", - mode = "n", + '', + 'ToggleTerm', + desc = 'Toggle Terminal', + mode = 'n', }, } M.transparent = { { - "wt", + 'wt', function() - require("transparent").toggle() + require('transparent').toggle() end, - desc = "Toggle Transparency", + desc = 'Toggle Transparency', }, } M.yanky = { { -- Put indent after linewise - "]p", - "(YankyPutIndentAfterLinewise)", - desc = "Put indent after linewise", + ']p', + '(YankyPutIndentAfterLinewise)', + desc = 'Put indent after linewise', }, { -- Put indent before linewise - "[p", - "(YankyPutIndentBeforeLinewise)", - desc = "Put indent before linewise", + '[p', + '(YankyPutIndentBeforeLinewise)', + desc = 'Put indent before linewise', }, { -- Put indent after linewise (uppercase) - "]P", - "(YankyPutIndentAfterLinewise)", - desc = "Put indent after linewise (uppercase)", + ']P', + '(YankyPutIndentAfterLinewise)', + desc = 'Put indent after linewise (uppercase)', }, { -- Put indent before linewise (uppercase) - "[P", - "(YankyPutIndentBeforeLinewise)", - desc = "Put indent before linewise (uppercase)", + '[P', + '(YankyPutIndentBeforeLinewise)', + desc = 'Put indent before linewise (uppercase)', }, { -- Put indent after shift right - ">p", - "(YankyPutIndentAfterShiftRight)", - desc = "Put indent after shift right", + '>p', + '(YankyPutIndentAfterShiftRight)', + desc = 'Put indent after shift right', }, { -- Put indent after shift left - "(YankyPutIndentAfterShiftLeft)", - desc = "Put indent after shift left", + '(YankyPutIndentAfterShiftLeft)', + desc = 'Put indent after shift left', }, { -- Put indent before shift right - ">P", - "(YankyPutIndentBeforeShiftRight)", - desc = "Put indent before shift right", + '>P', + '(YankyPutIndentBeforeShiftRight)', + desc = 'Put indent before shift right', }, { -- Put indent before shift left - "(YankyPutIndentBeforeShiftLeft)", - desc = "Put indent before shift left", + '(YankyPutIndentBeforeShiftLeft)', + desc = 'Put indent before shift left', }, { -- Put after filter - "=p", - "(YankyPutAfterFilter)", - desc = "Put after filter", + '=p', + '(YankyPutAfterFilter)', + desc = 'Put after filter', }, { -- Put before filter - "=P", - "(YankyPutBeforeFilter)", - desc = "Put before filter", + '=P', + '(YankyPutBeforeFilter)', + desc = 'Put before filter', }, { -- Last put in operator-pending mode - "lp", -- Left-hand side (key combination) + 'lp', -- Left-hand side (key combination) function() - require("yanky.textobj").last_put() + require('yanky.textobj').last_put() end, - desc = "Last put", - mode = { "x", "o" }, + desc = 'Last put', + mode = { 'x', 'o' }, }, } M.zen = { { -- Toggle ZenMode - "z", + 'z', function() - require("zen-mode").toggle() + require('zen-mode').toggle() end, - desc = "Toggle ZenMode", + desc = 'Toggle ZenMode', }, } diff --git a/lua/data/types.lua b/lua/data/types.lua index f49a713..26ed2a9 100644 --- a/lua/data/types.lua +++ b/lua/data/types.lua @@ -13,79 +13,79 @@ local M = {} --- the current mode. M.mode = { n = { -- Normal mode - icon = "", - name = "NORMAL", - color = "Special", + icon = '', + name = 'NORMAL', + color = 'Special', }, no = { -- Operator-pending mode - icon = "", - name = "NORMAL OPERATOR PENDING", - color = "Special", + icon = '', + name = 'NORMAL OPERATOR PENDING', + color = 'Special', }, nov = { -- Operator-pending (charwise) mode - icon = "", - name = "NORMAL OP (CHARWISE)", - color = "Special", + icon = '', + name = 'NORMAL OP (CHARWISE)', + color = 'Special', }, nt = { -- Terminal-mode within Normal mode - icon = "", - name = "NORMAL TERMINAL", - color = "Special", + icon = '', + name = 'NORMAL TERMINAL', + color = 'Special', }, i = { -- Insert mode - icon = "", - name = "INSERT", - color = "Special", + icon = '', + name = 'INSERT', + color = 'Special', }, ic = { -- Insert completion mode - icon = "", - name = "INSERT COMPLETION", - color = "Special", + icon = '', + name = 'INSERT COMPLETION', + color = 'Special', }, R = { -- Replace mode - icon = "", - name = "REPLACE", - color = "Special", + icon = '', + name = 'REPLACE', + color = 'Special', }, Rv = { -- Virtual replace mode - icon = "", - name = "REPLACE VIRT", - color = "Special", + icon = '', + name = 'REPLACE VIRT', + color = 'Special', }, v = { -- Visual mode - icon = "󰸿", - name = "VISUAL", - color = "Special", + icon = '󰸿', + name = 'VISUAL', + color = 'Special', }, V = { -- Visual Line mode - icon = "󰸽", - name = "VISUAL LINE", - color = "Special", + icon = '󰸽', + name = 'VISUAL LINE', + color = 'Special', }, - [""] = { -- Visual Block mode - icon = "󰹀", - name = "VISUAL BLOCK", - color = "Special", + [''] = { -- Visual Block mode + icon = '󰹀', + name = 'VISUAL BLOCK', + color = 'Special', }, c = { -- Command mode - icon = "󰑮", - name = "COMMAND", - color = "Special", + icon = '󰑮', + name = 'COMMAND', + color = 'Special', }, s = { -- Select mode - icon = "", - name = "SELECT", - color = "Special", + icon = '', + name = 'SELECT', + color = 'Special', }, S = { -- Select Line mode - icon = "", - name = "SELECT LINE", - color = "Special", + icon = '', + name = 'SELECT LINE', + color = 'Special', }, t = { -- Terminal mode - icon = "", - name = "INSERT TERMINAL", - color = "Special", + icon = '', + name = 'INSERT TERMINAL', + color = 'Special', }, --- A collection of functions that return icons and names for @@ -103,7 +103,7 @@ M.mode = { end -- Fallback to single-character mode if full mode isn't available local fallback_mode = current_mode:sub(1, 1) - return M.mode[fallback_mode] and M.mode[fallback_mode].icon or "" + return M.mode[fallback_mode] and M.mode[fallback_mode].icon or '' end, --- Returns the name of the current mode @@ -117,14 +117,14 @@ M.mode = { end -- Fallback to single-character mode if full mode isn't available local fallback_mode = current_mode:sub(1, 1) - return M.mode[fallback_mode] and M.mode[fallback_mode].name or "UNKNOWN" + return M.mode[fallback_mode] and M.mode[fallback_mode].name or 'UNKNOWN' end, --- Returns a string representing the current mode with icon and name --- Ex: " NORMAL" ---@return string|function icon_text The current mode icon and name icon_text = function() - return M.mode.current.icon() .. " " .. M.mode.current.name() + return M.mode.current.icon() .. ' ' .. M.mode.current.name() end, --- Returns a string representing the current mode with icon and name @@ -141,79 +141,79 @@ M.mode = { M.border = { round = function() return { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, + { '╭', 'FloatBorder' }, + { '─', 'FloatBorder' }, + { '╮', 'FloatBorder' }, + { '│', 'FloatBorder' }, + { '╯', 'FloatBorder' }, + { '─', 'FloatBorder' }, + { '╰', 'FloatBorder' }, + { '│', 'FloatBorder' }, } end, simple = function() return { - { "─", "FloatBorder" }, - { "│", "FloatBorder" }, - { "─", "FloatBorder" }, - { "│", "FloatBorder" }, - { "─", "FloatBorder" }, - { "│", "FloatBorder" }, - { "─", "FloatBorder" }, - { "│", "FloatBorder" }, + { '─', 'FloatBorder' }, + { '│', 'FloatBorder' }, + { '─', 'FloatBorder' }, + { '│', 'FloatBorder' }, + { '─', 'FloatBorder' }, + { '│', 'FloatBorder' }, + { '─', 'FloatBorder' }, + { '│', 'FloatBorder' }, } end, } -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Cursor Styles ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ M.cursors = { - smooth = "", - block = "█", - line = "⎸", - underline = "_", + smooth = '', + block = '█', + line = '⎸', + underline = '_', } -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Other Styles ━━━━━━━━━━━━━━━━━━━━━━━━━ M.script_glyphs = { superscript = { - "⁰", - "¹", - "²", - "³", - "⁴", - "⁵", - "⁶", - "⁷", - "⁸", - "⁹", + '⁰', + '¹', + '²', + '³', + '⁴', + '⁵', + '⁶', + '⁷', + '⁸', + '⁹', }, subscript = { - "₀", - "₁", - "₂", - "₃", - "₄", - "₅", - "₆", - "₇", - "₈", - "₉", + '₀', + '₁', + '₂', + '₃', + '₄', + '₅', + '₆', + '₇', + '₈', + '₉', }, } M.roman_numerals = { - "Ⅰ", - "Ⅱ", - "Ⅲ", - "Ⅳ", - "Ⅴ", - "Ⅵ", - "Ⅶ", - "Ⅷ", - "Ⅸ", - "Ⅹ", - "Ⅺ", - "Ⅻ", + 'Ⅰ', + 'Ⅱ', + 'Ⅲ', + 'Ⅳ', + 'Ⅴ', + 'Ⅵ', + 'Ⅶ', + 'Ⅷ', + 'Ⅸ', + 'Ⅹ', + 'Ⅺ', + 'Ⅻ', } -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Type tables ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -221,116 +221,116 @@ M.roman_numerals = { M.general = { -- Excluded buffer types buf = { - "help", - "alpha", - "dashboard", - "neo-tree", - "Trouble", - "trouble", - "lazy", - "mason", - "notify", - "toggleterm", - "lazyterm", + 'help', + 'alpha', + 'dashboard', + 'neo-tree', + 'Trouble', + 'trouble', + 'lazy', + 'mason', + 'notify', + 'toggleterm', + 'lazyterm', }, -- excluded filetypes ft = { - "help", - "dashboard", - "neorg", + 'help', + 'dashboard', + 'neorg', }, } --- All-modes table for keymaps M.all_modes = { - "n", - "i", - "v", - "x", - "s", - "o", - "c", - "t", + 'n', + 'i', + 'v', + 'x', + 's', + 'o', + 'c', + 't', } M.picker_sets = { pickers = { - "fzf-lua", - "telescope", + 'fzf-lua', + 'telescope', }, cpp_files = { - "cpp", - "c", - "h", - "hpp", + 'cpp', + 'c', + 'h', + 'hpp', }, python_files = { - "py", - "pyw", + 'py', + 'pyw', }, nvim_files = { - "lua", - "vim", - "vimdoc", + 'lua', + 'vim', + 'vimdoc', }, vim_files = { - "vim", - "vimdoc", + 'vim', + 'vimdoc', }, java_files = { - "java", - "properties", - "xml", - "jar", - "gradle", - "yaml", + 'java', + 'properties', + 'xml', + 'jar', + 'gradle', + 'yaml', }, js_files = { - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - "vue", - "svelte", + 'javascript', + 'javascriptreact', + 'typescript', + 'typescriptreact', + 'vue', + 'svelte', }, html_files = { - "html", - "css", - "scss", - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - "vue", - "svelte", + 'html', + 'css', + 'scss', + 'javascript', + 'javascriptreact', + 'typescript', + 'typescriptreact', + 'vue', + 'svelte', }, rust_files = { - "rust", - "toml", - "rs", - "rsx", - "rsproj", + 'rust', + 'toml', + 'rs', + 'rsx', + 'rsproj', }, } --- Filetypes for Alternate plugin M.alternate = { - "cpp", - "h", - "hpp", - "c", + 'cpp', + 'h', + 'hpp', + 'c', } --- Arrow config options M.arrow = { show_icons = true, - leader_key = ";", -- Recommended to be a single key - buffer_leader_key = "m", -- Per Buffer Mappings + leader_key = ';', -- Recommended to be a single key + buffer_leader_key = 'm', -- Per Buffer Mappings } M.avante = { - provider = "openai", - auto_suggestions_provider = "openai", + provider = 'openai', + auto_suggestions_provider = 'openai', behaviour = { auto_suggestions = false, -- Experimental stage auto_set_highlight_group = true, @@ -341,8 +341,8 @@ M.avante = { hints = { enabled = false }, highlights = { diff = { - current = "MiniDiffOverChange", - incoming = "MiniDiffOverAdd", + current = 'MiniDiffOverChange', + incoming = 'MiniDiffOverAdd', }, }, } @@ -351,15 +351,15 @@ M.avante = { M.bufferline = { enabled = function() if - require("data.func").check_global_var( - "tabline", - "bufferline", - "bufferline" + require('data.func').check_global_var( + 'tabline', + 'bufferline', + 'bufferline' ) - or require("data.func").check_global_var( - "tabline", - "barsNlines", - "bufferline" + or require('data.func').check_global_var( + 'tabline', + 'barsNlines', + 'bufferline' ) then return true @@ -371,24 +371,24 @@ M.bufferline = { themable = true, color_icons = true, numbers = function(opts) - local get_suffix = require("data.func").get_ordinal_suffix - return get_suffix(opts.ordinal) .. "⦂" + local get_suffix = require('data.func').get_ordinal_suffix + return get_suffix(opts.ordinal) .. '⦂' end, - separator_style = "slant", + separator_style = 'slant', auto_toggle_bufferline = true, - buffer_close_icon = "󱎘", - modified_icon = " ", - close_icon = "󱎘", - left_trunc_marker = " ", - right_trunc_marker = " ", + buffer_close_icon = '󱎘', + modified_icon = ' ', + close_icon = '󱎘', + left_trunc_marker = ' ', + right_trunc_marker = ' ', always_show_bufferline = false, show_close_icon = true, show_buffer_close_icon = true, diagnostics_indicator = function(_, _, diagnostics_dict, _) - local s = " " + local s = ' ' for e, n in pairs(diagnostics_dict) do - local sym = e == "error" and " " - or (e == "warning" and " " or " ") + local sym = e == 'error' and ' ' + or (e == 'warning' and ' ' or ' ') s = s .. sym .. n end return s @@ -399,12 +399,12 @@ M.bufferline = { --- CodeSnap configuration options M.codesnap = { - save_path = "~/Pictures/Screenshots/", + save_path = '~/Pictures/Screenshots/', has_breadcrumbs = true, show_workspace = true, - bg_theme = "default", - watermark = "Rootiest Snippets", - code_font_family = "Iosevka NF", + bg_theme = 'default', + watermark = 'Rootiest Snippets', + code_font_family = 'Iosevka NF', code_font_size = 12, } @@ -435,13 +435,13 @@ M.autosave = {} --- Kulala plugin types M.kulala = { - ft = { "http", "https", "ftp", "ftps" }, + ft = { 'http', 'https', 'ftp', 'ftps' }, } --- LazyVim configuration options M.lazyvim = { opts = { - colorscheme = vim.g.my_colorscheme or "catppuccin-mocha", + colorscheme = vim.g.my_colorscheme or 'catppuccin-mocha', news = { lazyvim = true, neovim = true, @@ -452,7 +452,7 @@ M.lazyvim = { M.lazy = { -- Lazy.nvim disabled_plugins = { --"gzip", - "netrwPlugin", + 'netrwPlugin', --"tarPlugin", -- "tohtml", --"tutor", @@ -462,8 +462,8 @@ M.lazy = { -- Lazy.nvim --- Nvim-cmp excluded filetypes M.cmp = { - "dashboard", - "qalc", + 'dashboard', + 'qalc', } M.neotree = { @@ -471,11 +471,11 @@ M.neotree = { default_component_configs = { git_status = { symbols = { - untracked = "󱀶", - ignored = "", - unstaged = "󰄱", - staged = "󰱒", - conflict = "", + untracked = '󱀶', + ignored = '', + unstaged = '󰄱', + staged = '󰱒', + conflict = '', }, }, }, @@ -498,42 +498,42 @@ M.minifiles = { }, }, config = function(_, opts) - require("mini.files").setup(opts) + require('mini.files').setup(opts) local show_dotfiles = true local filter_show = function(_) return true end local filter_hide = function(fs_entry) - return not vim.startswith(fs_entry.name, ".") + return not vim.startswith(fs_entry.name, '.') end local toggle_dotfiles = function() show_dotfiles = not show_dotfiles local new_filter = show_dotfiles and filter_show or filter_hide - require("mini.files").refresh({ content = { filter = new_filter } }) + require('mini.files').refresh({ content = { filter = new_filter } }) end local map_split = function(buf_id, lhs, direction, close_on_file) local rhs = function() local new_target_window - local cur_target_window = require("mini.files").get_target_window() + local cur_target_window = require('mini.files').get_target_window() if cur_target_window ~= nil then vim.api.nvim_win_call(cur_target_window, function() - vim.cmd("belowright " .. direction .. " split") + vim.cmd('belowright ' .. direction .. ' split') new_target_window = vim.api.nvim_get_current_win() end) - require("mini.files").set_target_window(new_target_window) - require("mini.files").go_in({ close_on_file = close_on_file }) + require('mini.files').set_target_window(new_target_window) + require('mini.files').go_in({ close_on_file = close_on_file }) end end - local desc = "Open in " .. direction .. " split" + local desc = 'Open in ' .. direction .. ' split' if close_on_file then - desc = desc .. " and close" + desc = desc .. ' and close' end - vim.keymap.set("n", lhs, rhs, { buffer = buf_id, desc = desc }) + vim.keymap.set('n', lhs, rhs, { buffer = buf_id, desc = desc }) end local files_set_cwd = function() @@ -545,79 +545,79 @@ M.minifiles = { end end - vim.api.nvim_create_autocmd("User", { - pattern = "MiniFilesBufferCreate", + vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesBufferCreate', callback = function(args) local buf_id = args.data.buf_id vim.keymap.set( - "n", - opts.mappings and opts.mappings.toggle_hidden or "g.", + 'n', + opts.mappings and opts.mappings.toggle_hidden or 'g.', toggle_dotfiles, - { buffer = buf_id, desc = "Toggle hidden files" } + { buffer = buf_id, desc = 'Toggle hidden files' } ) vim.keymap.set( - "n", - opts.mappings and opts.mappings.change_cwd or "gc", + 'n', + opts.mappings and opts.mappings.change_cwd or 'gc', files_set_cwd, - { buffer = args.data.buf_id, desc = "Set cwd" } + { buffer = args.data.buf_id, desc = 'Set cwd' } ) map_split( buf_id, - opts.mappings and opts.mappings.go_in_horizontal or "s", - "horizontal", + opts.mappings and opts.mappings.go_in_horizontal or 's', + 'horizontal', false ) map_split( buf_id, - opts.mappings and opts.mappings.go_in_vertical or "v", - "vertical", + opts.mappings and opts.mappings.go_in_vertical or 'v', + 'vertical', false ) map_split( buf_id, - opts.mappings and opts.mappings.go_in_horizontal_plus or "S", - "horizontal", + opts.mappings and opts.mappings.go_in_horizontal_plus or 'S', + 'horizontal', true ) map_split( buf_id, - opts.mappings and opts.mappings.go_in_vertical_plus or "V", - "vertical", + opts.mappings and opts.mappings.go_in_vertical_plus or 'V', + 'vertical', true ) end, }) - vim.api.nvim_create_autocmd("User", { - pattern = "MiniFilesActionRename", + vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesActionRename', callback = function(event) LazyVim.lsp.on_rename(event.data.from, event.data.to) end, }) - vim.api.nvim_create_autocmd("User", { - pattern = "MiniFilesActionRename", + vim.api.nvim_create_autocmd('User', { + pattern = 'MiniFilesActionRename', callback = function(event) Snacks.rename.on_rename_file(event.data.from, event.data.to) end, }) -- include git signs - require("config.minifiles") + require('config.minifiles') end, } --- Git-Blame configuration options M.gitblame = { opts = function() - if vim.g.statusline == "lualine" or vim.g.statusline == nil then + if vim.g.statusline == 'lualine' or vim.g.statusline == nil then -- Get the current lualine configuration - local config = require("lualine").get_config() - local git_blame = require("gitblame") - local funcs = require("data.func") + local config = require('lualine').get_config() + local git_blame = require('gitblame') + local funcs = require('data.func') -- Define the width limit for displaying the Git blame component local width_limit = 245 -- Adjust this value as needed -- Add Git-blame to lualine_c section @@ -627,78 +627,78 @@ M.gitblame = { return git_blame.is_blame_text_available() and funcs.is_window_wide_enough(width_limit) end, - color = { fg = funcs.get_fg_color("GitSignsCurrentLineBlame") }, + color = { fg = funcs.get_fg_color('GitSignsCurrentLineBlame') }, padding = { left = 1, right = 0 }, on_click = function() if vim.g.statusline_clickable_git ~= false then - require("config.rootiest").toggle_lazygit_float() + require('config.rootiest').toggle_lazygit_float() end end, }) -- Apply the lualine configuration - require("lualine").setup(config) + require('lualine').setup(config) end -- Return the git-blame options return M.gitblame.style end, style = { display_virtual_text = 0, -- Disable virtual text - date_format = "%r", -- Relative date format - message_when_not_committed = " Not yet committed", - message_template = "", + date_format = '%r', -- Relative date format + message_when_not_committed = ' Not yet committed', + message_template = '', }, } --- ChatGPT configuration options M.chatgpt = { openai_params = { - model = "gpt-4o-mini", + model = 'gpt-4o-mini', }, } -- GP ChatBot configuration options M.gp = function() - require("which-key").setup({ - triggers = "", + require('which-key').setup({ + triggers = '', mode = M.all_modes, }) return { hooks = { -- example of adding command which writes unit tests for the selected code UnitTests = function(gp, params) - local template = "I have the following code from {{filename}}:\n\n" - .. "```{{filetype}}\n{{selection}}\n```\n\n" - .. "Please respond by writing table driven unit tests for the code above." + local template = 'I have the following code from {{filename}}:\n\n' + .. '```{{filetype}}\n{{selection}}\n```\n\n' + .. 'Please respond by writing table driven unit tests for the code above.' local agent = gp.get_command_agent() gp.Prompt(params, gp.Target.vnew, agent, template) end, -- example of adding command which explains the selected code Explain = function(gp, params) - local template = "I have the following code from {{filename}}:\n\n" - .. "```{{filetype}}\n{{selection}}\n```\n\n" - .. "Please respond by explaining the code above." + local template = 'I have the following code from {{filename}}:\n\n' + .. '```{{filetype}}\n{{selection}}\n```\n\n' + .. 'Please respond by explaining the code above.' local agent = gp.get_chat_agent() gp.Prompt(params, gp.Target.popup, agent, template) end, -- example of usig enew as a function specifying type for the new buffer CodeReview = function(gp, params) - local template = "I have the following code from {{filename}}:\n\n" - .. "```{{filetype}}\n{{selection}}\n```\n\n" - .. "Please analyze for code smells and suggest improvements." + local template = 'I have the following code from {{filename}}:\n\n' + .. '```{{filetype}}\n{{selection}}\n```\n\n' + .. 'Please analyze for code smells and suggest improvements.' local agent = gp.get_chat_agent() - gp.Prompt(params, gp.Target.enew("markdown"), agent, template) + gp.Prompt(params, gp.Target.enew('markdown'), agent, template) end, -- example of adding command which opens new chat dedicated for translation Translator = function(gp, params) local chat_system_prompt = - "You are a Translator, please translate between English and Chinese." + 'You are a Translator, please translate between English and Chinese.' gp.cmd.ChatNew(params, chat_system_prompt) end, -- example of making :%GpChatNew a dedicated command which -- opens new chat with the entire current buffer as a context BufferChatNew = function(gp, _) -- call GpChatNew command in range mode on whole buffer - vim.api.nvim_command("%" .. gp.config.cmd_prefix .. "ChatNew") + vim.api.nvim_command('%' .. gp.config.cmd_prefix .. 'ChatNew') end, }, } @@ -710,11 +710,11 @@ M.telescope = { extensions = { cmdline = { icons = { - history = " ", - command = " ", - number = "󰴍 ", - system = "", - unknown = "", + history = ' ', + command = ' ', + number = '󰴍 ', + system = '', + unknown = '', }, picker = { layout_config = { @@ -723,12 +723,12 @@ M.telescope = { }, }, completions = { - "command", + 'command', }, mappings = { - complete = "", - run_selection = "", - run_input = "", + complete = '', + run_selection = '', + run_input = '', }, overseer = { enabled = true, @@ -746,7 +746,7 @@ M.neocodeium = { debounce = false, filetypes = { TelescopePrompt = false, - ["dap-repl"] = false, + ['dap-repl'] = false, }, }, } @@ -763,7 +763,7 @@ M.lspconfig = { opts = { setup = { clangd = function(_, opts) - opts.capabilities.offsetEncoding = { "utf-16" } + opts.capabilities.offsetEncoding = { 'utf-16' } end, }, }, @@ -772,18 +772,18 @@ M.lspconfig = { --- Which-Key configuration options M.whichkey = { opts = { - preset = "modern", + preset = 'modern', win = { wo = { winblend = 10, }, }, triggers = { - { "", mode = { "n", "x" } }, - { "", mode = { "n", "v" } }, - { "", mode = { "n", "v" } }, - { "s", mode = { "n", "x" } }, - { "g", mode = { "n", "x" } }, + { '', mode = { 'n', 'x' } }, + { '', mode = { 'n', 'v' } }, + { '', mode = { 'n', 'v' } }, + { 's', mode = { 'n', 'x' } }, + { 'g', mode = { 'n', 'x' } }, }, }, } @@ -795,61 +795,61 @@ M.gitgraph = { hooks = { -- Check diff of a commit on_select_commit = function(commit) - vim.notify("DiffviewOpen " .. commit.hash .. "^!") - vim.cmd(":DiffviewOpen " .. commit.hash .. "^!") + vim.notify('DiffviewOpen ' .. commit.hash .. '^!') + vim.cmd(':DiffviewOpen ' .. commit.hash .. '^!') end, -- Check diff from commit a -> commit b on_select_range_commit = function(from, to) - vim.notify("DiffviewOpen " .. from.hash .. "~1.." .. to.hash) - vim.cmd(":DiffviewOpen " .. from.hash .. "~1.." .. to.hash) + vim.notify('DiffviewOpen ' .. from.hash .. '~1..' .. to.hash) + vim.cmd(':DiffviewOpen ' .. from.hash .. '~1..' .. to.hash) end, }, --- Git-graph symbols check for kitty symbols = function() - if require("data.func").is_kitty() then + if require('data.func').is_kitty() then return { - merge_commit = "", - commit = "", - merge_commit_end = "", - commit_end = "", + merge_commit = '', + commit = '', + merge_commit_end = '', + commit_end = '', -- Advanced symbols - GVER = "", - GHOR = "", - GCLD = "", - GCRD = "╭", - GCLU = "", - GCRU = "", - GLRU = "", - GLRD = "", - GLUD = "", - GRUD = "", - GFORKU = "", - GFORKD = "", - GRUDCD = "", - GRUDCU = "", - GLUDCD = "", - GLUDCU = "", - GLRDCL = "", - GLRDCR = "", - GLRUCL = "", - GLRUCR = "", + GVER = '', + GHOR = '', + GCLD = '', + GCRD = '╭', + GCLU = '', + GCRU = '', + GLRU = '', + GLRD = '', + GLUD = '', + GRUD = '', + GFORKU = '', + GFORKD = '', + GRUDCD = '', + GRUDCU = '', + GLUDCD = '', + GLUDCU = '', + GLRDCL = '', + GLRDCR = '', + GLRUCL = '', + GLRUCR = '', } else -- Fallback return { - merge_commit = "", - commit = "", - merge_commit_end = "", - commit_end = "", + merge_commit = '', + commit = '', + merge_commit_end = '', + commit_end = '', } end end, format = { -- Git graph timestamp style - timestamp = "%H:%M:%S %d-%m-%Y", + timestamp = '%H:%M:%S %d-%m-%Y', -- Git graph fields to display - fields = { "hash", "timestamp", "author", "branch_name", "tag" }, + fields = { 'hash', 'timestamp', 'author', 'branch_name', 'tag' }, }, }, } @@ -865,66 +865,66 @@ M.highlights = { --- Indent characters M.ibl = { char = { - none = { " " }, - light_vert = { "" }, - scope = { "│" }, - fancy_vert = { "‖" }, - strong_vert = { "⦀" }, - zigzag = { "⦚" }, - basic = { "" }, - simple = { "" }, - arrow = { "" }, - tab = { "󰌒" }, - mini = { "" }, - light_arrow = { "⤑" }, - block = { "█" }, - block_75 = { "▓" }, - block_50 = { "▒" }, - block_25 = { "░" }, - block_0 = { " " }, - baric = { "󰇘" }, - fish = { "⤕" }, - dot = { "⋅" }, - dots = { "⋯" }, - circle = { "" }, - dot_circle = { "󱥸" }, - dot_square = { "󱗽" }, - dot_hex = { "󱗿" }, - dot_tri = { "󱗾" }, - dot_grid = { "󱗼" }, + none = { ' ' }, + light_vert = { '' }, + scope = { '│' }, + fancy_vert = { '‖' }, + strong_vert = { '⦀' }, + zigzag = { '⦚' }, + basic = { '' }, + simple = { '' }, + arrow = { '' }, + tab = { '󰌒' }, + mini = { '' }, + light_arrow = { '⤑' }, + block = { '█' }, + block_75 = { '▓' }, + block_50 = { '▒' }, + block_25 = { '░' }, + block_0 = { ' ' }, + baric = { '󰇘' }, + fish = { '⤕' }, + dot = { '⋅' }, + dots = { '⋯' }, + circle = { '' }, + dot_circle = { '󱥸' }, + dot_square = { '󱗽' }, + dot_hex = { '󱗿' }, + dot_tri = { '󱗾' }, + dot_grid = { '󱗼' }, solid = { - "▏", - "▎", - "▍", - "▌", - "▋", - "▊", - "▉", - "█", + '▏', + '▎', + '▍', + '▌', + '▋', + '▊', + '▉', + '█', }, fancy = { - "󰎤", - "󰎧", - "󰎪", - "󰎭", - "󰎱", - "󰎳", - "󰎶", - "󰎹", - "󰎼", - "󰽽", + '󰎤', + '󰎧', + '󰎪', + '󰎭', + '󰎱', + '󰎳', + '󰎶', + '󰎹', + '󰎼', + '󰽽', }, funky = { - "󰌒", - "󰌓", - "󰌔", - "󰌕", - "󰌖", - "󰌗", - "󰌘", - "󰌙", - "󰌚", - "󰌛", + '󰌒', + '󰌓', + '󰌔', + '󰌕', + '󰌖', + '󰌗', + '󰌘', + '󰌙', + '󰌚', + '󰌛', }, }, } @@ -932,7 +932,7 @@ M.ibl = { --- Mini.Indentscope configuration options M.miniindentscope = { opts = { - options = { try_as_border = true, border = "both" }, + options = { try_as_border = true, border = 'both' }, }, init = function() -- Set default scope char @@ -952,88 +952,88 @@ M.miniindentscope = { M.navic = { icons = { classic = { - File = "󰈙 ", - Module = " ", - Namespace = "󰌗 ", - Package = " ", - Class = "󰌗 ", - Method = "󰆧 ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = "󰕘", - Interface = "󰕘", - Function = "󰊕 ", - Variable = "󰆧 ", - Constant = "󰏿 ", - String = "󰀬 ", - Number = "󰎠 ", - Boolean = "◩ ", - Array = "󰅪 ", - Object = "󰅩 ", - Key = "󰌋 ", - Null = "󰟢 ", - EnumMember = " ", - Struct = "󰌗 ", - Event = " ", - Operator = "󰆕 ", - TypeParameter = "󰊄 ", + File = '󰈙 ', + Module = ' ', + Namespace = '󰌗 ', + Package = ' ', + Class = '󰌗 ', + Method = '󰆧 ', + Property = ' ', + Field = ' ', + Constructor = ' ', + Enum = '󰕘', + Interface = '󰕘', + Function = '󰊕 ', + Variable = '󰆧 ', + Constant = '󰏿 ', + String = '󰀬 ', + Number = '󰎠 ', + Boolean = '◩ ', + Array = '󰅪 ', + Object = '󰅩 ', + Key = '󰌋 ', + Null = '󰟢 ', + EnumMember = ' ', + Struct = '󰌗 ', + Event = ' ', + Operator = '󰆕 ', + TypeParameter = '󰊄 ', }, trouble = { - File = " ", - Module = " ", - Namespace = " ", - Package = " ", - Class = " ", - Method = " ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = " ", - Interface = " ", - Function = " ", - Variable = " ", - Constant = " ", - String = " ", - Number = " ", - Boolean = " ", - Array = " ", - Object = " ", - Key = " ", - Null = " ", - EnumMember = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", + File = ' ', + Module = ' ', + Namespace = ' ', + Package = ' ', + Class = ' ', + Method = ' ', + Property = ' ', + Field = ' ', + Constructor = ' ', + Enum = ' ', + Interface = ' ', + Function = ' ', + Variable = ' ', + Constant = ' ', + String = ' ', + Number = ' ', + Boolean = ' ', + Array = ' ', + Object = ' ', + Key = ' ', + Null = ' ', + EnumMember = ' ', + Struct = ' ', + Event = ' ', + Operator = ' ', + TypeParameter = ' ', }, vscode = { - File = " ", - Module = " ", - Namespace = " ", - Package = " ", - Class = " ", - Method = " ", - Property = " ", - Field = " ", - Constructor = " ", - Enum = " ", - Interface = " ", - Function = " ", - Variable = " ", - Constant = " ", - String = " ", - Number = " ", - Boolean = " ", - Array = " ", - Object = " ", - Key = " ", - Null = " ", - EnumMember = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", + File = ' ', + Module = ' ', + Namespace = ' ', + Package = ' ', + Class = ' ', + Method = ' ', + Property = ' ', + Field = ' ', + Constructor = ' ', + Enum = ' ', + Interface = ' ', + Function = ' ', + Variable = ' ', + Constant = ' ', + String = ' ', + Number = ' ', + Boolean = ' ', + Array = ' ', + Object = ' ', + Key = ' ', + Null = ' ', + EnumMember = ' ', + Struct = ' ', + Event = ' ', + Operator = ' ', + TypeParameter = ' ', }, }, } @@ -1043,8 +1043,8 @@ M.smart_splits = { --- Function to check if kitty is running --- and install Smart-Splits kittens if it is. build = function() - if require("data.func").is_kitty() then - return "./kitty/install-kittens.bash" + if require('data.func').is_kitty() then + return './kitty/install-kittens.bash' else return false end @@ -1053,13 +1053,13 @@ M.smart_splits = { -- ───────────────────────────── NeoMiniMap ────────────────────────── local extmark_handler = { - name = "Todo Comment", - mode = "icon", - namespace = vim.api.nvim_create_namespace("neominimap_todo_comment"), + name = 'Todo Comment', + mode = 'icon', + namespace = vim.api.nvim_create_namespace('neominimap_todo_comment'), init = function() end, autocmds = { { - event = { "TextChanged", "TextChangedI" }, + event = { 'TextChanged', 'TextChangedI' }, opts = { callback = function(apply, args) local bufnr = tonumber(args.buf) ---@cast bufnr integer @@ -1070,7 +1070,7 @@ local extmark_handler = { }, }, { - event = "WinScrolled", + event = 'WinScrolled', opts = { callback = function(apply) local winid = vim.api.nvim_get_current_win() @@ -1088,22 +1088,22 @@ local extmark_handler = { }, }, get_annotations = function(bufnr) - local ok, _ = pcall(require, "todo-comments") + local ok, _ = pcall(require, 'todo-comments') if not ok then return {} end - local ns_id = vim.api.nvim_get_namespaces()["todo-comments"] + local ns_id = vim.api.nvim_get_namespaces()['todo-comments'] local extmarks = vim.api.nvim_buf_get_extmarks(bufnr, ns_id, 0, -1, { details = true, }) local icons = { - FIX = " ", - TODO = " ", - HACK = " ", - WARN = " ", - PERF = " ", - NOTE = " ", - TEST = "⏲ ", + FIX = ' ', + TODO = ' ', + HACK = ' ', + WARN = ' ', + PERF = ' ', + NOTE = ' ', + TEST = '⏲ ', } local id = { FIX = 1, TODO = 2, HACK = 3, WARN = 4, PERF = 5, NOTE = 6, TEST = 7 } @@ -1116,7 +1116,7 @@ local extmark_handler = { lnum = extmark[2], end_lnum = extmark[2], id = id[kind], - highlight = "TodoFg" .. kind, --- You can customize the highlight here. + highlight = 'TodoFg' .. kind, --- You can customize the highlight here. icon = icon, priority = detail.priority, } @@ -1130,22 +1130,22 @@ M.minimap = { width = 20, -- excluded buffer types buf = { - "nofile", - "nowrite", - "quickfix", - "terminal", - "prompt", - "alpha", - "dashboard", - "qalc", + 'nofile', + 'nowrite', + 'quickfix', + 'terminal', + 'prompt', + 'alpha', + 'dashboard', + 'qalc', -- +general.buf }, -- excluded filetypes ft = { - "help", - "dashboard", - "neorg", - "qalc", + 'help', + 'dashboard', + 'neorg', + 'qalc', }, --- Function to initialize or manipulate minimap settings @@ -1153,7 +1153,7 @@ M.minimap = { M.setup() vim.g.neominimap = { auto_enable = true, - layout = "float", + layout = 'float', exclude_filetypes = M.minimap.ft, exclude_buftypes = M.minimap.buf, x_multiplier = 4, @@ -1162,28 +1162,28 @@ M.minimap = { enabled = true, }, diagnostic = { - mode = "icon", + mode = 'icon', icon = { - ERROR = "󰅚 ", - WARN = "󰀪 ", - INFO = "󰌶 ", - HINT = " ", + ERROR = '󰅚 ', + WARN = '󰀪 ', + INFO = '󰌶 ', + HINT = ' ', }, }, git = { enabled = true, - mode = "sign", + mode = 'sign', priority = 6, icon = { - add = "󰐖 ", - change = "󰏬 ", - delete = "󰍵 ", + add = '󰐖 ', + change = '󰏬 ', + delete = '󰍵 ', }, }, search = { enabled = true, - mode = "icon", - icon = "󱋞 ", + mode = 'icon', + icon = '󱋞 ', }, treesitter = { enabled = true, @@ -1191,9 +1191,9 @@ M.minimap = { }, mark = { enabled = true, - mode = "icon", + mode = 'icon', priority = 10, - key = "m", + key = 'm', show_builtins = true, }, split = { @@ -1201,7 +1201,7 @@ M.minimap = { fix_width = false, }, float = { - window_border = "none", + window_border = 'none', minimap_width = M.minimap.width, }, handlers = { @@ -1226,9 +1226,9 @@ M.minimap = { --- Llama Copilot plugin options M.llama_copilot = { - host = "localhost", - port = "11434", - model = "codellama:7b-code", + host = 'localhost', + port = '11434', + model = 'codellama:7b-code', max_completion_size = 15, -- use -1 for limitless debug = false, } @@ -1260,27 +1260,27 @@ M.trouble = { symbols = { -- Configure symbols mode focus = true, win = { - type = "split", -- split window - relative = "win", -- relative to current window - position = "right", -- right side + type = 'split', -- split window + relative = 'win', -- relative to current window + position = 'right', -- right side size = 0.3, -- 30% of the window }, }, }, icons = { indent = { - top = " ", + top = ' ', -- middle = "├╴", - middle = "", + middle = '', -- last = "└╴", -- last = "-╴", - last = "╰╴", - fold_open = " ", - fold_closed = " ", - ws = " ", + last = '╰╴', + fold_open = ' ', + fold_closed = ' ', + ws = ' ', }, - folder_closed = " ", - folder_open = " ", + folder_closed = ' ', + folder_open = ' ', kinds = M.navic.icons.vscode, }, }, @@ -1290,20 +1290,20 @@ M.trouble = { M.barsNlines = { enabled = function() if - require("data.func").check_global_var( - "statuscolumn", - "barsNlines", - "native" + require('data.func').check_global_var( + 'statuscolumn', + 'barsNlines', + 'native' ) - or require("data.func").check_global_var( - "tabline", - "barsNlines", - "bufferline" + or require('data.func').check_global_var( + 'tabline', + 'barsNlines', + 'bufferline' ) - or require("data.func").check_global_var( - "statusline", - "barsNlines", - "lualine" + or require('data.func').check_global_var( + 'statusline', + 'barsNlines', + 'lualine' ) then return true @@ -1311,77 +1311,77 @@ M.barsNlines = { return false end, config = function() - require("bars").setup({ + require('bars').setup({ exclude_filetypes = M.minimap.ft, exclude_buftypes = M.minimap.buf, statuscolumn = { - enable = require("data.func").check_global_var( - "statuscolumn", - "barsNlines", - "native" + enable = require('data.func').check_global_var( + 'statuscolumn', + 'barsNlines', + 'native' ), parts = { { - type = "fold", + type = 'fold', markers = { default = { - content = { " " }, + content = { ' ' }, }, open = { - { " ", "BarsStatuscolumnFold1" }, + { ' ', 'BarsStatuscolumnFold1' }, }, close = { - { "╴", "BarsStatuscolumnFold1" }, + { '╴', 'BarsStatuscolumnFold1' }, }, scope = { - { "│ ", "BarsStatuscolumnFold1" }, + { '│ ', 'BarsStatuscolumnFold1' }, }, divider = { - { "├╴", "BarsStatuscolumnFold1" }, + { '├╴', 'BarsStatuscolumnFold1' }, }, foldend = { - { "╰╼", "BarsStatuscolumnFold1" }, + { '╰╼', 'BarsStatuscolumnFold1' }, }, }, }, { - type = "number", - mode = "hybrid", - hl = "LineNr", - lnum_hl = "BarsStatusColumnNum", - relnum_hl = "LineNr", - virtnum_hl = "TablineSel", - wrap_hl = "TablineSel", + type = 'number', + mode = 'hybrid', + hl = 'LineNr', + lnum_hl = 'BarsStatusColumnNum', + relnum_hl = 'LineNr', + virtnum_hl = 'TablineSel', + wrap_hl = 'TablineSel', }, }, }, tabline = { - enable = require("data.func").check_global_var( - "tabline", - "barsNlines", - "bufferline" + enable = require('data.func').check_global_var( + 'tabline', + 'barsNlines', + 'bufferline' ), parts = { { -- Part name - type = "bufs", + type = 'bufs', -- Active buffer configuration active = { - corner_left = { "", "BarsTablineBufActiveSep" }, - corner_right = { "", "BarsTablineBufActiveSep" }, + corner_left = { '', 'BarsTablineBufActiveSep' }, + corner_right = { '', 'BarsTablineBufActiveSep' }, - padding_left = { " ", "BarsTablineBufActive" }, - padding_right = { " " }, + padding_left = { ' ', 'BarsTablineBufActive' }, + padding_right = { ' ' }, }, -- Inactive buffer configuration inactive = { - corner_left = { "", "BarsTablineBufInactiveSep" }, - corner_right = { "", "BarsTablineBufInactiveSep" }, + corner_left = { '', 'BarsTablineBufInactiveSep' }, + corner_right = { '', 'BarsTablineBufInactiveSep' }, - padding_left = { " ", "BarsTablineBufInactive" }, - padding_right = { " " }, + padding_left = { ' ', 'BarsTablineBufInactive' }, + padding_right = { ' ' }, }, -- List of patterns to ignore @@ -1390,10 +1390,10 @@ M.barsNlines = { }, }, statusline = { - enable = require("data.func").check_global_var( - "statusline", - "barsNlines", - "lualine" + enable = require('data.func').check_global_var( + 'statusline', + 'barsNlines', + 'lualine' ), }, }) @@ -1401,52 +1401,52 @@ M.barsNlines = { } M.duck = function() - local add_km = require("data.func").add_keymap + local add_km = require('data.func').add_keymap add_km({ - lhs = "uD", - group = "Duck", - icon = { icon = "󰇥", color = "yellow" }, + lhs = 'uD', + group = 'Duck', + icon = { icon = '󰇥', color = 'yellow' }, }) add_km({ - "uDd", + 'uDd', function() - require("duck").hatch() + require('duck').hatch() end, - desc = "Hatch", + desc = 'Hatch', }) add_km({ - "uDk", + 'uDk', function() - require("duck").cook() + require('duck').cook() end, - desc = "Cook", + desc = 'Cook', }) add_km({ - "uDa", + 'uDa', function() - require("duck").cook_all() + require('duck').cook_all() end, - desc = "Cook All", + desc = 'Cook All', }) end --- Function to setup Pigeon plugin options M.pigeon = function() - local platform = require("data.func").get_os("platform") - local lazy_installed = pcall(require, "lazy") - local packer_installed = pcall(require, "packer_plugins") + local platform = require('data.func').get_os('platform') + local lazy_installed = pcall(require, 'lazy') + local packer_installed = pcall(require, 'packer_plugins') local pigeon_enabled = true -- default - local plugman = "lazy" -- default package manager + local plugman = 'lazy' -- default package manager if lazy_installed then - plugman = "lazy" + plugman = 'lazy' elseif packer_installed then - plugman = "packer" - elseif vim.fn.exists("g:plugs") == 1 then - plugman = "vim-plug" + plugman = 'packer' + elseif vim.fn.exists('g:plugs') == 1 then + plugman = 'vim-plug' else - require("data.func").notify( - "Failed to detect package manager.\nPigeon disabled.", - "ERROR" + require('data.func').notify( + 'Failed to detect package manager.\nPigeon disabled.', + 'ERROR' ) pigeon_enabled = false return @@ -1462,7 +1462,7 @@ M.pigeon = function() -- more config options here } - require("pigeon").setup(config) + require('pigeon').setup(config) end --- Substitute plugin options @@ -1470,7 +1470,7 @@ M.substitute = { yank_substituted_text = false, preserve_cursor_position = true, on_substitute = function() - require("yanky.integration").substitute() + require('yanky.integration').substitute() end, } @@ -1481,10 +1481,10 @@ M.undotree = function() -- Set focus to the tree when it's toggled vim.g.undotree_SetFocusWhenToggle = 1 -- Set up tree shape - vim.g.undotree_TreeNodeShape = "" - vim.g.undotree_TreeVertShape = "" - vim.g.undotree_TreeSplitShape = "" - vim.g.undotree_TreeReturnShape = "" + vim.g.undotree_TreeNodeShape = '' + vim.g.undotree_TreeVertShape = '' + vim.g.undotree_TreeSplitShape = '' + vim.g.undotree_TreeReturnShape = '' -- Hide helpline vim.g.undotree_HelpLine = 0 -- Hide diff panel @@ -1494,7 +1494,7 @@ end M.yanky = { ring = { history_length = 200, - storage = "sqlite", + storage = 'sqlite', }, system_clipboard = { sync_with_ring = true, @@ -1514,7 +1514,7 @@ M.yanky = { M.comment = { opleader = { - line = "gC", + line = 'gC', }, } @@ -1524,11 +1524,11 @@ M.mason_lsp_config = { opts = { --- Hightlight-colors plugin options M.hightlight_colors = { - render = "virtual", - virtual_symbol = "", - virtual_symbol_prefix = "", - virtual_symbol_suffix = "", - virtual_symbol_position = "inline", + render = 'virtual', + virtual_symbol = '', + virtual_symbol_prefix = '', + virtual_symbol_suffix = '', + virtual_symbol_position = 'inline', ---Highlight hex colors, e.g. '#FFFFFF' more text enable_hex = true, ---Highlight short hex colors e.g. '#fff more text' @@ -1543,32 +1543,32 @@ M.hightlight_colors = { enable_named_colors = true, ---Highlight tailwind colors, e.g. 'bg-blue-500 more text' enable_tailwind = true, - exclude_filetypes = { "lazy", "lazygit" }, + exclude_filetypes = { 'lazy', 'lazygit' }, exclude_buftypes = {}, } --- Catppuccin options M.catppuccin = { background = { -- :h background - light = "latte", - dark = "mocha", + light = 'latte', + dark = 'mocha', }, integrations = { native_lsp = { enabled = true, virtual_text = { - errors = { "italic" }, - hints = { "italic" }, - warnings = { "italic" }, - information = { "italic" }, - ok = { "italic" }, + errors = { 'italic' }, + hints = { 'italic' }, + warnings = { 'italic' }, + information = { 'italic' }, + ok = { 'italic' }, }, underlines = { - errors = { "underline" }, - hints = { "underline" }, - warnings = { "underline" }, - information = { "underline" }, - ok = { "underline" }, + errors = { 'underline' }, + hints = { 'underline' }, + warnings = { 'underline' }, + information = { 'underline' }, + ok = { 'underline' }, }, inlay_hints = { background = true, @@ -1577,14 +1577,14 @@ M.catppuccin = { dadbod_ui = true, indent_blankline = { enabled = true, - scope_color = "mauve", + scope_color = 'mauve', colored_indent_levels = true, }, grug_far = true, mason = true, mini = { enabled = true, - indentscope_color = "mauve", + indentscope_color = 'mauve', }, neotree = true, noice = true, @@ -1608,22 +1608,22 @@ M.auto_dark_mode = { update_interval = 2000, --- Function that runs when dark mode is enabled set_dark_mode = function() - vim.o.background = "dark" + vim.o.background = 'dark' vim.cmd.colorscheme( - require("astral").colortheme or "catppuccin-mocha" or "tokyonight" + require('astral').colortheme or 'catppuccin-mocha' or 'tokyonight' ) end, --- Function that runs when light mode is enabled set_light_mode = function() - vim.o.background = "light" + vim.o.background = 'light' vim.cmd.colorscheme( - require("astral").colortheme or "catppuccin-latte" or "tokyonight-day" + require('astral').colortheme or 'catppuccin-latte' or 'tokyonight-day' ) end, } --- Image.nvim enabled filetypes -M.image = "markdown" +M.image = 'markdown' --- Noice configuration options M.noice = { presets = { inc_rename = true } } @@ -1633,55 +1633,55 @@ M.todo = { opts = { keywords = { FIX = { - icon = " ", -- icon used for the sign, and in search results - color = "error", -- can be a hex color, or a named color + icon = ' ', -- icon used for the sign, and in search results + color = 'error', -- can be a hex color, or a named color alt = { -- a set of other keywords that all map to this FIX keywords - "FIXME", - "BUG", - "FIXIT", - "ISSUE", + 'FIXME', + 'BUG', + 'FIXIT', + 'ISSUE', }, }, - TODO = { icon = " ", color = "info" }, - HACK = { icon = " ", color = "warning" }, - WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } }, - PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - NOTE = { icon = " ", color = "hint", alt = { "INFO" } }, + TODO = { icon = ' ', color = 'info' }, + HACK = { icon = ' ', color = 'warning' }, + WARN = { icon = ' ', color = 'warning', alt = { 'WARNING', 'XXX' } }, + PERF = { icon = ' ', alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } }, + NOTE = { icon = ' ', color = 'hint', alt = { 'INFO' } }, BUST = { - icon = "󰇷 ", - color = "broken", - alt = { "BROKEN", "UNAVAILABLE", "POOP" }, + icon = '󰇷 ', + color = 'broken', + alt = { 'BROKEN', 'UNAVAILABLE', 'POOP' }, }, JUNK = { - icon = " ", - color = "trash", - alt = { "TRASH", "WASTE", "DUMP", "GARBAGE" }, + icon = ' ', + color = 'trash', + alt = { 'TRASH', 'WASTE', 'DUMP', 'GARBAGE' }, }, TEST = { - icon = " ", - color = "test", - alt = { "TESTING", "PASSED", "FAILED" }, + icon = ' ', + color = 'test', + alt = { 'TESTING', 'PASSED', 'FAILED' }, }, }, colors = { - error = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" }, - info = { "DiagnosticInfo", "#2563EB" }, - hint = { "DiagnosticHint", "#10B981" }, - default = { "Identifier", "#7C3AED" }, - test = { "Identifier", "#FF00FF" }, - broken = { "DiagnosticError", "ErrorMsg", "#DC2626" }, - trash = { "DiagnosticUnnecessary", "Comment", "#DC2626" }, + error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' }, + warning = { 'DiagnosticWarn', 'WarningMsg', '#FBBF24' }, + info = { 'DiagnosticInfo', '#2563EB' }, + hint = { 'DiagnosticHint', '#10B981' }, + default = { 'Identifier', '#7C3AED' }, + test = { 'Identifier', '#FF00FF' }, + broken = { 'DiagnosticError', 'ErrorMsg', '#DC2626' }, + trash = { 'DiagnosticUnnecessary', 'Comment', '#DC2626' }, }, search = { - command = "rg", + command = 'rg', args = { - "--no-messages", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", + '--no-messages', + '--color=never', + '--no-heading', + '--with-filename', + '--line-number', + '--column', }, pattern = [[\b(KEYWORDS):]], -- ripgrep regex }, @@ -1690,14 +1690,14 @@ M.todo = { local config = { -- The todo-comments types to show & in what order: order = { - "TODO", - "FIX", - "WARN", - "BUST", - "JUNK", + 'TODO', + 'FIX', + 'WARN', + 'BUST', + 'JUNK', }, keywords = M.todo.opts.keywords, - when_empty = "", + when_empty = '', } return config end, @@ -1705,16 +1705,16 @@ M.todo = { --- Colorful Window Separators plugin options M.colorful_winsep = { - symbols = { "─", "│", "╭", "╮", "╰", "╯" }, + symbols = { '─', '│', '╭', '╮', '╰', '╯' }, no_exec_files = { - "packer", - "TelescopePrompt", - "mason", - "CompetiTest", - "NvimTree", - "neotree", - "lazy", - "neominimap", + 'packer', + 'TelescopePrompt', + 'mason', + 'CompetiTest', + 'NvimTree', + 'neotree', + 'lazy', + 'neominimap', }, } @@ -1764,16 +1764,16 @@ M.toggleterm = { ---@param term Terminal The terminal object ---@return number|nil The terminal size size = function(term) - if term.direction == "horizontal" then + if term.direction == 'horizontal' then return 10 - elseif term.direction == "vertical" then + elseif term.direction == 'vertical' then return vim.o.columns * 0.4 end end, --- Function that runs when terminal is opened ---@param term Terminal The ToggleTerm terminal object on_open = function(term) - vim.wo[term.window].foldmethod = "manual" + vim.wo[term.window].foldmethod = 'manual' end, open_mapping = [[]], hide_numbers = true, @@ -1784,14 +1784,14 @@ M.toggleterm = { terminal_mappings = true, persist_size = true, persist_mode = true, - direction = "horizontal", + direction = 'horizontal', close_on_exit = true, shell = vim.o.shell, auto_scroll = true, float_opts = { - border = "curved", + border = 'curved', winblend = 3, - title_pos = "center", + title_pos = 'center', }, winbar = { enabled = true, @@ -1804,7 +1804,7 @@ M.toggleterm = { }, } -M.ts = { disabled_highlights = { "text" } } +M.ts = { disabled_highlights = { 'text' } } local no_highlight = M.ts.disabled_highlights @@ -1824,37 +1824,37 @@ M.treesitter = { }, matchup = { enable = true, -- mandatory, false will disable the whole extension - disable = { "c", "ruby" }, -- optional, list of language that will be disabled + disable = { 'c', 'ruby' }, -- optional, list of language that will be disabled -- [options] }, auto_install = true, ensure_installed = { - "bash", - "c", - "css", - "diff", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "printf", - "python", - "query", - "regex", - "ssh_config", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "xml", - "yaml", + 'bash', + 'c', + 'css', + 'diff', + 'html', + 'javascript', + 'jsdoc', + 'json', + 'jsonc', + 'lua', + 'luadoc', + 'luap', + 'markdown', + 'markdown_inline', + 'printf', + 'python', + 'query', + 'regex', + 'ssh_config', + 'toml', + 'tsx', + 'typescript', + 'vim', + 'vimdoc', + 'xml', + 'yaml', }, }, } @@ -1863,8 +1863,8 @@ M.twilight = { dimming = { alpha = 0.25, -- amount of dimming -- we try to get the foreground from the highlight groups or fallback color - color = { "Normal", "#cdd6f4" }, - term_bg = "#1e1e2e", -- if guibg=NONE, this will be used to calculate text color + color = { 'Normal', '#cdd6f4' }, + term_bg = '#1e1e2e', -- if guibg=NONE, this will be used to calculate text color inactive = false, -- when true, other windows will be fully dimmed (unless they contain the same buffer) }, } @@ -1875,12 +1875,12 @@ M.zen = { width = 0.9, -- width of the Zen window height = 1, -- height of the Zen window options = { - signcolumn = "no", -- disable signcolumn + signcolumn = 'no', -- disable signcolumn -- number = false, -- disable number column relativenumber = false, -- disable relative numbers cursorline = false, -- disable cursorline cursorcolumn = false, -- disable cursor column - foldcolumn = "0", -- disable fold column + foldcolumn = '0', -- disable fold column list = false, -- disable whitespace characters }, }, @@ -1900,20 +1900,20 @@ M.zen = { tmux = { enabled = false }, -- disables the tmux statusline todo = { enabled = false }, -- if set to "true", todo-comments.nvim highlights will be disabled kitty = { - enabled = require("data.func").is_kitty(), - font = "+1", -- font size increment + enabled = require('data.func').is_kitty(), + font = '+1', -- font size increment }, alacritty = { - enabled = require("data.func").is_alacritty(), - font = "14", -- font size + enabled = require('data.func').is_alacritty(), + font = '14', -- font size }, wezterm = { - enabled = require("data.func").is_wezterm(), + enabled = require('data.func').is_wezterm(), -- can be either an absolute font size or the number of incremental steps - font = "+1", -- (10% increase per step) + font = '+1', -- (10% increase per step) }, neovide = { - enabled = require("data.func").is_neovide(), + enabled = require('data.func').is_neovide(), -- Will multiply the current scale factor by this number scale = 1.2, -- disable the Neovide animations while in Zen mode @@ -1923,7 +1923,7 @@ M.zen = { neovide_scroll_animation_length = 0, neovide_position_animation_length = 0, neovide_cursor_animation_length = 0, - neovide_cursor_vfx_mode = "", + neovide_cursor_vfx_mode = '', }, }, }, diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua index 39e1de9..a6607b3 100644 --- a/lua/plugins/ai.lua +++ b/lua/plugins/ai.lua @@ -6,57 +6,57 @@ return { { -- Neocodeium - "monkoose/neocodeium", - event = "VeryLazy", - opts = require("data.types").neocodeium.opts, - keys = require("data.keys").neocodeium, - cond = require("data.cond").neocodeium, + 'monkoose/neocodeium', + event = 'VeryLazy', + opts = require('data.types').neocodeium.opts, + keys = require('data.keys').neocodeium, + cond = require('data.cond').neocodeium, }, { -- Codeium - import = "lazyvim.plugins.extras.coding.codeium", - cond = require("data.cond").codeium, + import = 'lazyvim.plugins.extras.coding.codeium', + cond = require('data.cond').codeium, }, { -- Copilot - import = "lazyvim.plugins.extras.coding.copilot", - cond = require("data.cond").copilot, + import = 'lazyvim.plugins.extras.coding.copilot', + cond = require('data.cond').copilot, }, { -- Tabnine - import = "lazyvim.plugins.extras.coding.tabnine", - cond = require("data.cond").tabnine, + import = 'lazyvim.plugins.extras.coding.tabnine', + cond = require('data.cond').tabnine, }, { -- Minuet-AI - "milanglacier/minuet-ai.nvim", - dependencies = require("data.deps").minuet, - opts = { provider = "openai" }, - cond = require("data.cond").minuet, + 'milanglacier/minuet-ai.nvim', + dependencies = require('data.deps').minuet, + opts = { provider = 'openai' }, + cond = require('data.cond').minuet, }, { -- ChatGPT - "jackMort/ChatGPT.nvim", - event = "VeryLazy", - cond = require("data.cond").chatgpt, - keys = require("data.keys").chatgpt.func, - opts = require("data.types").chatgpt, - dependencies = require("data.deps").chatgpt, + 'jackMort/ChatGPT.nvim', + event = 'VeryLazy', + cond = require('data.cond').chatgpt, + keys = require('data.keys').chatgpt.func, + opts = require('data.types').chatgpt, + dependencies = require('data.deps').chatgpt, }, { -- GP - "robitx/gp.nvim", - cond = require("data.cond").gp, + 'robitx/gp.nvim', + cond = require('data.cond').gp, lazy = false, - opts = require("data.types").gp, - keys = require("data.keys").gp.func, + opts = require('data.types').gp, + keys = require('data.keys').gp.func, }, { -- Avante - "yetone/avante.nvim", - cond = require("data.cond").avante, - event = "VeryLazy", + 'yetone/avante.nvim', + cond = require('data.cond').avante, + event = 'VeryLazy', lazy = false, - opts = require("data.types").avante, - build = "make", - dependencies = require("data.deps").avante, + opts = require('data.types').avante, + build = 'make', + dependencies = require('data.deps').avante, keys = function() -- Add keymaps for Avante group - for _, item in ipairs(require("data.keys").group.avante) do - require("data.func").add_keymap(item) + for _, item in ipairs(require('data.keys').group.avante) do + require('data.func').add_keymap(item) end end, }, diff --git a/lua/plugins/astral.lua b/lua/plugins/astral.lua index 4b35b42..4f3e12a 100644 --- a/lua/plugins/astral.lua +++ b/lua/plugins/astral.lua @@ -3,18 +3,19 @@ -- ╭─────────────────────────────────────────────────────────╮ -- │ Astral Plugin │ -- ╰─────────────────────────────────────────────────────────╯ + return { -- Astral - "rootiest/astral.nvim", - version = "*", -- Pin to GitHub releases - enabled = require("data.func").check_global_var("use_astral", true, true), + 'rootiest/astral.nvim', + version = '*', -- Pin to GitHub releases + enabled = require('data.func').check_global_var('use_astral', true, true), opts = { fallback_themes = { - "catppuccin-macchiato", - "catppuccin-frappe", - "tokyonight", - "kanagawa", - "monochrome", - "default", + 'catppuccin-macchiato', + 'catppuccin-frappe', + 'tokyonight', + 'kanagawa', + 'monochrome', + 'default', }, }, dev = vim.g.rootiest_dev or false, -- Use local codebase diff --git a/lua/plugins/autosave.lua b/lua/plugins/autosave.lua index 09918fc..03c3dbe 100644 --- a/lua/plugins/autosave.lua +++ b/lua/plugins/autosave.lua @@ -4,10 +4,10 @@ return { { -- Auto-save - "okuuva/auto-save.nvim", - cmd = require("data.cmd").autosave, - event = { "InsertLeave", "TextChanged" }, - opts = require("data.types").autosave, - cond = require("data.cond").autosave, + 'okuuva/auto-save.nvim', + cmd = require('data.cmd').autosave, + event = { 'InsertLeave', 'TextChanged' }, + opts = require('data.types').autosave, + cond = require('data.cond').autosave, }, } diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index be2db09..ab07eb2 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -3,6 +3,7 @@ -- ╭─────────────────────────────────────────────────────────╮ -- │ Auto Completion │ -- ╰─────────────────────────────────────────────────────────╯ + local perf = vim.g.cmp_performance_enabled or false --- Function to return the cmp provider ---@param performance? boolean Whether to use the experimental cmp performance fork @@ -11,42 +12,44 @@ local function cmp_provider(performance) if performance then return { -- Experiemental cmp performance fork - url = "hrsh7th/nvim-cmp", + url = 'hrsh7th/nvim-cmp', --url = "iguanacucumber/magazine.nvim", dev = true, } else return { -- Classic cmp - url = "hrsh7th/nvim-cmp", + url = 'hrsh7th/nvim-cmp', dev = false, } end end local cmp_repo = cmp_provider(perf) + +-- Else use classic cmp return { -- cmp url = cmp_repo.url, build = cmp_repo.build, branch = cmp_repo.branch, dev = cmp_repo.dev, - event = "VeryLazy", - dependencies = require("data.deps").cmp, + event = 'VeryLazy', + dependencies = require('data.deps').cmp, config = function() - local cmp = require("cmp") - local luasnip = require("luasnip") - cmp.event:on("menu_opened", function() - if require("data.cond").neocodeium() == true then - require("neocodeium").clear() + local cmp = require('cmp') + local luasnip = require('luasnip') + cmp.event:on('menu_opened', function() + if require('data.cond').neocodeium() == true then + require('neocodeium').clear() end end) - cmp.event:on("menu_closed", function() - if require("data.cond").neocodeium() == true then - require("neocodeium.commands").enable() - require("neocodeium").cycle_or_complete() + cmp.event:on('menu_closed', function() + if require('data.cond').neocodeium() == true then + require('neocodeium.commands').enable() + require('neocodeium').cycle_or_complete() end end) local border_opts = { - border = vim.g.completion_borders or "rounded", + border = vim.g.completion_borders or 'rounded', } local window_opts = { completion = cmp.config.window.bordered(border_opts), @@ -60,7 +63,7 @@ return { -- cmp and vim.api .nvim_buf_get_lines(0, line - 1, line, true)[1] :sub(col, col) - :match("%s") + :match('%s') == nil end cmp.setup({ @@ -69,22 +72,22 @@ return { -- cmp luasnip.lsp_expand(args.body) end, }, - completion = { completeopt = "menu,menuone,noinsert" }, - window = vim.g.completion_borders == "rounded" and window_opts or {}, + completion = { completeopt = 'menu,menuone,noinsert' }, + window = vim.g.completion_borders == 'rounded' and window_opts or {}, mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_prev_item({ + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select, }), - [""] = cmp.mapping.select_next_item({ + [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select, }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.complete({}), - [""] = cmp.mapping(function(fallback) + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete({}), + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_locally_jumpable() then @@ -98,8 +101,8 @@ return { -- cmp else fallback() end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.locally_jumpable(-1) then @@ -111,42 +114,38 @@ return { -- cmp else fallback() end - end, { "i", "s" }), + end, { 'i', 's' }), }), sources = { - { name = "nvim_lsp", priority = 1000 }, - { name = "luasnip", priority = 750 }, - { name = "path", priority = 250 }, - { name = "buffer", priority = 250 }, - { name = "cmp_yanky" }, - { name = "dotenv" }, - { name = "calc" }, - { name = "conventionalcommits" }, - -- { name = "nerd", priority = 9997 }, - -- { name = "gitmoji", priority = 9998 }, - -- { name = "emoji", priority = 9999 }, - -- { name = "math", priority = 9999 }, + { name = 'nvim_lsp', priority = 1000 }, + { name = 'luasnip', priority = 750 }, + { name = 'path', priority = 250 }, + { name = 'buffer', priority = 250 }, + { name = 'cmp_yanky' }, + { name = 'dotenv' }, + { name = 'calc' }, + { name = 'conventionalcommits' }, }, formatting = { - fields = { "abbr", "kind", "menu" }, + fields = { 'abbr', 'kind', 'menu' }, expandable_indicator = true, format = function(entry, item) local custom_menu_icon = { - calc = "󰃬 Calculator", - math = " Math", - nerd = " Glyphs", - gitmoji = " Gitmoji", - emoji = "󰞅 Emoji", - conventionalcommits = " Commit Message", - path = " Path", - buffer = "󰓩 Buffer", - dotenv = " Dotenv", - cmp_yanky = " History", + calc = '󰃬 Calculator', + math = ' Math', + nerd = ' Glyphs', + gitmoji = ' Gitmoji', + emoji = '󰞅 Emoji', + conventionalcommits = ' Commit Message', + path = ' Path', + buffer = '󰓩 Buffer', + dotenv = ' Dotenv', + cmp_yanky = ' History', } local color_item = - require("nvim-highlight-colors").format(entry, { kind = item.kind }) - item = require("lspkind").cmp_format({ - require("tailwind-tools.cmp").lspkind_format, + require('nvim-highlight-colors').format(entry, { kind = item.kind }) + item = require('lspkind').cmp_format({ + require('tailwind-tools.cmp').lspkind_format, })(entry, item) if color_item.abbr_hl_group then item.kind_hl_group = color_item.abbr_hl_group @@ -161,42 +160,42 @@ return { -- cmp }, }) -- `:` cmdline setup. - cmp.setup.cmdline(":", { + cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ - { name = "path" }, + { name = 'path' }, }, { { - name = "cmdline", + name = 'cmdline', option = { - ignore_cmds = { "Man", "!" }, + ignore_cmds = { 'Man', '!' }, }, }, - }, { name = "cmp-cmdline-history" }, { - name = "cmp-cmdline-prompt", + }, { name = 'cmp-cmdline-history' }, { + name = 'cmp-cmdline-prompt', }), }) -- Additional setup for cmdline filetype - cmp.setup.filetype("cmdline", { + cmp.setup.filetype('cmdline', { sources = { - { name = "cmdline" }, -- Ensure 'cmdline' source is available - { name = "path" }, - { name = "cmp-cmdline-history" }, - { name = "cmp-cmdline-prompt" }, + { name = 'cmdline' }, -- Ensure 'cmdline' source is available + { name = 'path' }, + { name = 'cmp-cmdline-history' }, + { name = 'cmp-cmdline-prompt' }, }, }) -- Input filetype - cmp.setup.filetype("input", { + cmp.setup.filetype('input', { sources = {}, }) -- Custom filetype configuration - cmp.setup.filetype("config", { + cmp.setup.filetype('config', { sources = vim.tbl_filter(function(source) - return source.name ~= "emoji" and source.name ~= "gitmoji" + return source.name ~= 'emoji' and source.name ~= 'gitmoji' end, cmp.get_config().sources), }) -- List of filetypes to disable completion - local disabled_filetypes = require("data.types").cmp + local disabled_filetypes = require('data.types').cmp for _, filetype in ipairs(disabled_filetypes) do cmp.setup.filetype(filetype, { sources = {}, diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua index 951c2fb..e23af91 100644 --- a/lua/plugins/coding.lua +++ b/lua/plugins/coding.lua @@ -5,105 +5,106 @@ -- ╰─────────────────────────────────────────────────────────╯ return { + -- { import = "lazyvim.plugins.extras.coding.blink" }, { -- Mason-lspconfig - "williamboman/mason-lspconfig.nvim", - opts = require("data.types").mason_lsp_config.opts, + 'williamboman/mason-lspconfig.nvim', + opts = require('data.types').mason_lsp_config.opts, }, { -- luasnip - import = "lazyvim.plugins.extras.coding.luasnip", + import = 'lazyvim.plugins.extras.coding.luasnip', }, { -- nvim-treesitter - "nvim-treesitter/nvim-treesitter", - opts = require("data.types").treesitter.opts, + 'nvim-treesitter/nvim-treesitter', + opts = require('data.types').treesitter.opts, }, { -- nvim-lspconfig - "neovim/nvim-lspconfig", - opts = require("data.types").lspconfig.opts, + 'neovim/nvim-lspconfig', + opts = require('data.types').lspconfig.opts, }, { -- Yanky - import = "lazyvim.plugins.extras.coding.yanky", + import = 'lazyvim.plugins.extras.coding.yanky', }, { -- Yanky - "gbprod/yanky.nvim", - requires = { "kkharji/sqlite.lua" }, - opts = require("data.types").yanky, - keys = require("data.keys").yanky, + 'gbprod/yanky.nvim', + requires = { 'kkharji/sqlite.lua' }, + opts = require('data.types').yanky, + keys = require('data.keys').yanky, }, { -- Neogen - import = "lazyvim.plugins.extras.coding.neogen", + import = 'lazyvim.plugins.extras.coding.neogen', }, { - "folke/lazydev.nvim", + 'folke/lazydev.nvim', opts = { library = { - { path = "luvit-meta/library", words = { "vim%.uv" } }, - { path = "LazyVim", words = { "LazyVim" } }, - { path = "lazy.nvim", words = { "LazyVim" } }, + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + { path = 'LazyVim', words = { 'LazyVim' } }, + { path = 'lazy.nvim', words = { 'LazyVim' } }, -- Load the wezterm types when the `wezterm` module is required -- Needs `justinsgithub/wezterm-types` to be installed - { path = "wezterm-types", mods = { "wezterm" } }, + { path = 'wezterm-types', mods = { 'wezterm' } }, }, }, }, { -- G-code - "wilriker/gcode.vim", + 'wilriker/gcode.vim', }, { -- Alternate - "ton/vim-alternate", + 'ton/vim-alternate', lazy = true, - ft = require("data.types").alternate, - keys = require("data.keys").alternate, + ft = require('data.types').alternate, + keys = require('data.keys').alternate, }, { -- Tailwind - "luckasRanarison/tailwind-tools.nvim", + 'luckasRanarison/tailwind-tools.nvim', lazy = true, - dependencies = require("data.deps").needs_treesitter, + dependencies = require('data.deps').needs_treesitter, opts = {}, }, { -- Substitute - "gbprod/substitute.nvim", + 'gbprod/substitute.nvim', lazy = true, - opts = require("data.types").substitute, - keys = require("data.keys").substitute, + opts = require('data.types').substitute, + keys = require('data.keys').substitute, }, { -- Comment - "numToStr/Comment.nvim", - opts = require("data.types").comment, + 'numToStr/Comment.nvim', + opts = require('data.types').comment, }, { -- Fast Action - "Chaitanyabsprip/fastaction.nvim", + 'Chaitanyabsprip/fastaction.nvim', opts = {}, }, { -- Matchup - "andymass/vim-matchup", + 'andymass/vim-matchup', setup = function() -- may set any options here - vim.g.matchup_matchparen_offscreen = { method = "popup" } + vim.g.matchup_matchparen_offscreen = { method = 'popup' } end, }, { -- EasyAlign - "junegunn/vim-easy-align", - keys = require("data.keys").easyalign, + 'junegunn/vim-easy-align', + keys = require('data.keys').easyalign, }, { -- Vim-Shebang - "vitalk/vim-shebang", + 'vitalk/vim-shebang', lazy = false, }, { - "oskarrrrrrr/symbols.nvim", - cmd = { "Symbols", "SymbolsToggle", "SymbolsOpen", "SymbolsClose" }, + 'oskarrrrrrr/symbols.nvim', + cmd = { 'Symbols', 'SymbolsToggle', 'SymbolsOpen', 'SymbolsClose' }, config = function() - local r = require("symbols.recipes") - require("symbols").setup(r.DefaultFilters, r.AsciiSymbols, { + local r = require('symbols.recipes') + require('symbols').setup(r.DefaultFilters, r.AsciiSymbols, { sidebar = { auto_peek = false, show_guide_lines = true, chars = { - folded = "", - unfolded = "", - guide_vert = "", - guide_middle_item = "", - guide_last_item = "", + folded = '', + unfolded = '', + guide_vert = '', + guide_middle_item = '', + guide_last_item = '', }, preview = { show_always = true, diff --git a/lua/plugins/core.lua b/lua/plugins/core.lua index 4d5f2b4..f0a263a 100644 --- a/lua/plugins/core.lua +++ b/lua/plugins/core.lua @@ -7,18 +7,18 @@ return { -- require("config.rocks").plugin_spec, { -- LazyVim - "LazyVim/LazyVim", + 'LazyVim/LazyVim', priority = 900, - opts = require("data.types").lazyvim.opts, + opts = require('data.types').lazyvim.opts, }, { -- Bufferline - "akinsho/bufferline.nvim", - cond = require("data.types").bufferline.enabled, - opts = require("data.types").bufferline.opts, + 'akinsho/bufferline.nvim', + cond = require('data.types').bufferline.enabled, + opts = require('data.types').bufferline.opts, }, { -- Which-Key - "folke/which-key.nvim", + 'folke/which-key.nvim', lazy = true, - opts = require("data.types").whichkey.opts, + opts = require('data.types').whichkey.opts, }, } diff --git a/lua/plugins/dashboard/alpha.lua b/lua/plugins/dashboard/alpha.lua index 0c49157..2aaa061 100644 --- a/lua/plugins/dashboard/alpha.lua +++ b/lua/plugins/dashboard/alpha.lua @@ -3,51 +3,52 @@ -- ╭─────────────────────────────────────────────────────────╮ -- │ ALPHA │ -- ╰─────────────────────────────────────────────────────────╯ + return { -- Alpha - "goolord/alpha-nvim", - event = "VimEnter", - enabled = require("data.func").check_global_var( - "dashboard", - "alpha", - "alpha" + 'goolord/alpha-nvim', + event = 'VimEnter', + enabled = require('data.func').check_global_var( + 'dashboard', + 'alpha', + 'alpha' ), - opts = require("data.dash").alpha.opts, + opts = require('data.dash').alpha.opts, config = function(_, dashboard) -- close Lazy and re-open when the dashboard is ready - if vim.o.filetype == "lazy" then + if vim.o.filetype == 'lazy' then vim.cmd.close() - vim.api.nvim_create_autocmd("User", { + vim.api.nvim_create_autocmd('User', { once = true, - pattern = "AlphaReady", + pattern = 'AlphaReady', callback = function() - require("lazy").show() + require('lazy').show() end, }) end -- Setup the dashboard - require("alpha").setup(dashboard.opts) + require('alpha').setup(dashboard.opts) -- Open Alpha when Vim is started with no file arguments - vim.api.nvim_create_autocmd("User", { + vim.api.nvim_create_autocmd('User', { once = true, - pattern = "LazyVimStarted", + pattern = 'LazyVimStarted', callback = function() - local stats = require("lazy").stats() + local stats = require('lazy').stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) - dashboard.section.footer.val = "󰇥 Neovim loaded " + dashboard.section.footer.val = '󰇥 Neovim loaded ' .. stats.loaded - .. "/" + .. '/' .. stats.count - .. " plugins in " + .. ' plugins in ' .. ms - .. "ms 󱐌" + .. 'ms 󱐌' pcall(vim.cmd.AlphaRedraw) -- Handle other plugins that may conflict -- If auto-cursorline is installed, disable it - if pcall(require, "auto-cursorline") then - require("auto-cursorline").disable({ buffer = true }) + if pcall(require, 'auto-cursorline') then + require('auto-cursorline').disable({ buffer = true }) end end, }) diff --git a/lua/plugins/dashboard/drop.lua b/lua/plugins/dashboard/drop.lua index 281912a..d1f0cda 100644 --- a/lua/plugins/dashboard/drop.lua +++ b/lua/plugins/dashboard/drop.lua @@ -3,7 +3,7 @@ -- ╰─────────────────────────────────────────────────────────╯ return { - "folke/drop.nvim", + 'folke/drop.nvim', lazy = true, opts = {}, } diff --git a/lua/plugins/dashboard/nvim-dashboard.lua b/lua/plugins/dashboard/nvim-dashboard.lua index de4738e..392017c 100644 --- a/lua/plugins/dashboard/nvim-dashboard.lua +++ b/lua/plugins/dashboard/nvim-dashboard.lua @@ -6,103 +6,103 @@ return { -- -- Dashboard - "nvimdev/dashboard-nvim", - event = "UIEnter", + 'nvimdev/dashboard-nvim', + event = 'UIEnter', version = false, opts = function() ---@diagnostic disable-next-line: param-type-mismatch - local logo_path = vim.fs.joinpath(vim.fn.stdpath("config"), "logo/") + local logo_path = vim.fs.joinpath(vim.fn.stdpath('config'), 'logo/') local height, width = vim.fn.winheight(0), vim.fn.winwidth(0) local logo_file local logo_dimensions = { width = 0, height = 0 } if height >= 80 and width >= 80 then - logo_file = "rootiest.txt" + logo_file = 'rootiest.txt' elseif height >= 48 and width >= 48 then - logo_file = "xerneas.ans" + logo_file = 'xerneas.ans' elseif width >= 100 then - logo_file = "pikachu.ans" + logo_file = 'pikachu.ans' elseif width >= 80 then - logo_file = "tall.txt" + logo_file = 'tall.txt' elseif width >= 50 then - logo_file = "small.txt" + logo_file = 'small.txt' else - logo_file = "tiny.txt" + logo_file = 'tiny.txt' end - if logo_file == "snorlax.ans" then + if logo_file == 'snorlax.ans' then logo_dimensions = { width = 53, height = 25 } - elseif logo_file == "porygon-z.ans" then + elseif logo_file == 'porygon-z.ans' then logo_dimensions = { width = 28, height = 18 } - elseif logo_file == "pikachu.ans" then + elseif logo_file == 'pikachu.ans' then logo_dimensions = { width = 22, height = 11 } - elseif logo_file == "taco.ans" then + elseif logo_file == 'taco.ans' then logo_dimensions = { width = 33, height = 15 } - elseif logo_file == "nvim.ans" then + elseif logo_file == 'nvim.ans' then logo_dimensions = { width = 35, height = 20 } - elseif logo_file == "marshadow.ans" then + elseif logo_file == 'marshadow.ans' then logo_dimensions = { width = 28, height = 17 } - elseif logo_file == "eiscue.ans" then + elseif logo_file == 'eiscue.ans' then logo_dimensions = { width = 22, height = 18 } - elseif logo_file == "xerneas.ans" then + elseif logo_file == 'xerneas.ans' then logo_dimensions = { width = 39, height = 24 } - elseif logo_file == "rootiest.ans" then + elseif logo_file == 'rootiest.ans' then logo_dimensions = { width = 65, height = 27 } end local opts = { - theme = "doom", + theme = 'doom', hide = { statusline = false, tabline = true, }, -- By default, use ANSI art header preview = { - command = "bat -pp | bat -pp", + command = 'bat -pp | bat -pp', file_path = logo_path .. logo_file, file_width = logo_dimensions.width, file_height = logo_dimensions.height, }, config = { - center = require("data.dash").dashboard_nvim.choices, + center = require('data.dash').dashboard_nvim.choices, footer = function() - local stats = require("lazy").stats() + local stats = require('lazy').stats() local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) return { -- "⚡ Neovim loaded " - "󱐋 Neovim loaded " + '󱐋 Neovim loaded ' .. stats.loaded - .. "/" + .. '/' .. stats.count - .. " plugins in " + .. ' plugins in ' .. ms - .. "ms", + .. 'ms', } end, }, } -- if logo_file extension is not .ans or .png then read the content and add it to the header - if logo_file:sub(-4) ~= ".ans" and logo_file:sub(-4) ~= ".png" then + if logo_file:sub(-4) ~= '.ans' and logo_file:sub(-4) ~= '.png' then local logo_content = vim.fn.readfile(logo_path .. logo_file) - local LOGO = "\n\n" .. table.concat(logo_content, "\n") .. "\n\n" - opts.config.header = vim.split(LOGO, "\n") + local LOGO = '\n\n' .. table.concat(logo_content, '\n') .. '\n\n' + opts.config.header = vim.split(LOGO, '\n') opts.preview = nil end for _, button in ipairs(opts.config.center) do - button.desc = button.desc .. string.rep(" ", 43 - #button.desc) - button.key_format = " %s" + button.desc = button.desc .. string.rep(' ', 43 - #button.desc) + button.key_format = ' %s' end -- Open dashboard after closing lazy - if vim.o.filetype == "lazy" then - vim.api.nvim_create_autocmd("WinClosed", { + if vim.o.filetype == 'lazy' then + vim.api.nvim_create_autocmd('WinClosed', { pattern = tostring(vim.api.nvim_get_current_win()), once = true, callback = function() vim.schedule(function() - vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" }) + vim.api.nvim_exec_autocmds('UIEnter', { group = 'dashboard' }) end) end, }) @@ -110,9 +110,9 @@ return { -- return opts end, - enabled = require("data.func").check_global_var( - "dashboard", - "nvim-dashboard", - "alpha" + enabled = require('data.func').check_global_var( + 'dashboard', + 'nvim-dashboard', + 'alpha' ), } diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index a5063cd..c588cb2 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -6,25 +6,25 @@ return { { -- DAP Core - import = "lazyvim.plugins.extras.dap.core", + import = 'lazyvim.plugins.extras.dap.core', }, { -- DAP Neovim Lua Adapter - import = "lazyvim.plugins.extras.dap.nlua", + import = 'lazyvim.plugins.extras.dap.nlua', }, { -- NeoTest - import = "lazyvim.plugins.extras.test.core", + import = 'lazyvim.plugins.extras.test.core', }, { -- Neotest Plenary - "nvim-neotest/neotest-plenary", + 'nvim-neotest/neotest-plenary', }, { -- Neotest - "nvim-neotest/neotest", + 'nvim-neotest/neotest', opts = { - adapters = require("data.deps").neotest.adapters, + adapters = require('data.deps').neotest.adapters, }, - dependencies = require("data.deps").neotest.deps, + dependencies = require('data.deps').neotest.deps, }, { -- Profiling - "stevearc/profile.nvim", + 'stevearc/profile.nvim', }, } diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index a2d270b..4898239 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -6,157 +6,157 @@ return { { -- Aerial - import = "lazyvim.plugins.extras.editor.aerial", + import = 'lazyvim.plugins.extras.editor.aerial', }, { -- Dial - import = "lazyvim.plugins.extras.editor.dial", + import = 'lazyvim.plugins.extras.editor.dial', }, { -- Illuminate - import = "lazyvim.plugins.extras.editor.illuminate", + import = 'lazyvim.plugins.extras.editor.illuminate', }, { -- Outline - import = "lazyvim.plugins.extras.editor.outline", + import = 'lazyvim.plugins.extras.editor.outline', }, { -- IncRename - import = "lazyvim.plugins.extras.editor.inc-rename", + import = 'lazyvim.plugins.extras.editor.inc-rename', }, { -- Treesitter-context - import = "lazyvim.plugins.extras.ui.treesitter-context", + import = 'lazyvim.plugins.extras.ui.treesitter-context', }, { -- Navic - import = "lazyvim.plugins.extras.editor.navic", + import = 'lazyvim.plugins.extras.editor.navic', }, { -- Refactoring - import = "lazyvim.plugins.extras.editor.refactoring", + import = 'lazyvim.plugins.extras.editor.refactoring', }, { -- Trouble - "folke/trouble.nvim", - cmd = require("data.cmd").trouble, - opts = require("data.types").trouble.opts, + 'folke/trouble.nvim', + cmd = require('data.cmd').trouble, + opts = require('data.types').trouble.opts, }, { -- Flash - "folke/flash.nvim", - opts = require("data.types").flash, - keys = require("data.keys").flash, + 'folke/flash.nvim', + opts = require('data.types').flash, + keys = require('data.keys').flash, }, { -- NeoTree - "nvim-neo-tree/neo-tree.nvim", - opts = require("data.types").neotree.opts, + 'nvim-neo-tree/neo-tree.nvim', + opts = require('data.types').neotree.opts, }, { -- Arrow - "otavioschwanck/arrow.nvim", - opts = require("data.types").arrow, + 'otavioschwanck/arrow.nvim', + opts = require('data.types').arrow, }, { -- indent-blankline - "lukas-reineke/indent-blankline.nvim", + 'lukas-reineke/indent-blankline.nvim', lazy = true, }, ---@module "neominimap.config.meta" { -- NeoMiniMap - "Isrothy/neominimap.nvim", + 'Isrothy/neominimap.nvim', lazy = false, - keys = require("data.keys").minimap.func, - init = require("data.types").minimap.init(), - cond = require("data.types").minimap.cond(), + keys = require('data.keys').minimap.func, + init = require('data.types').minimap.init(), + cond = require('data.types').minimap.cond(), }, { -- Persistence - "folke/persistence.nvim", - event = "BufReadPre", + 'folke/persistence.nvim', + event = 'BufReadPre', opts = {}, }, { -- DeadColumn - "Bekaboo/deadcolumn.nvim", - event = "BufEnter", - cond = require("data.func").check_global_var("dead_column", true, true), + 'Bekaboo/deadcolumn.nvim', + event = 'BufEnter', + cond = require('data.func').check_global_var('dead_column', true, true), }, { -- Precognition - "tris203/precognition.nvim", + 'tris203/precognition.nvim', lazy = true, opts = {}, - keys = require("data.keys").precog, + keys = require('data.keys').precog, }, { -- Zen Mode - "folke/zen-mode.nvim", + 'folke/zen-mode.nvim', lazy = true, - opts = require("data.types").zen, - keys = require("data.keys").zen, + opts = require('data.types').zen, + keys = require('data.keys').zen, }, { -- SmoothCursor - "gen740/SmoothCursor.nvim", - event = "BufEnter", + 'gen740/SmoothCursor.nvim', + event = 'BufEnter', -- lazy = true, - opts = require("data.types").smoothcursor, + opts = require('data.types').smoothcursor, enabled = false, }, { -- Smart Scrolloff - "tonymajestro/smart-scrolloff.nvim", - event = "VeryLazy", - cond = require("data.func").check_global_var("smart_scrolloff", true, true), - opts = require("data.types").smartscrolloff, + 'tonymajestro/smart-scrolloff.nvim', + event = 'VeryLazy', + cond = require('data.func').check_global_var('smart_scrolloff', true, true), + opts = require('data.types').smartscrolloff, }, { -- Recorder - "chrisgrieser/nvim-recorder", - event = "VeryLazy", - dependencies = require("data.deps").recorder, + 'chrisgrieser/nvim-recorder', + event = 'VeryLazy', + dependencies = require('data.deps').recorder, opts = {}, }, { -- Comment Box - "LudoPinelli/comment-box.nvim", + 'LudoPinelli/comment-box.nvim', lazy = false, }, { -- Todo Comments - "folke/todo-comments.nvim", - opts = require("data.types").todo.opts, - cond = require("data.cond").todo, + 'folke/todo-comments.nvim', + opts = require('data.types').todo.opts, + cond = require('data.cond').todo, enabled = true, }, { -- Rainbow Delimeters - "HiPhish/rainbow-delimiters.nvim", + 'HiPhish/rainbow-delimiters.nvim', }, { -- Colorful window separators - "nvim-zh/colorful-winsep.nvim", + 'nvim-zh/colorful-winsep.nvim', enabled = false, lazy = true, - opts = require("data.types").winsep, - event = { "WinLeave" }, + opts = require('data.types').winsep, + event = { 'WinLeave' }, }, { -- Auto Cursorline - "delphinus/auto-cursorline.nvim", - cond = require("data.func").check_global_var("auto_cursorline", true, true), - opts = require("data.types").autocursorline, + 'delphinus/auto-cursorline.nvim', + cond = require('data.func').check_global_var('auto_cursorline', true, true), + opts = require('data.types').autocursorline, }, { -- Bars N Lines - "OXY2DEV/bars-N-lines.nvim", - cond = require("data.types").barsNlines.enabled, + 'OXY2DEV/bars-N-lines.nvim', + cond = require('data.types').barsNlines.enabled, lazy = false, - config = require("data.types").barsNlines.config, + config = require('data.types').barsNlines.config, }, { -- UndoTree - "mbbill/undotree", + 'mbbill/undotree', lazy = false, - config = require("data.types").undotree, - keys = require("data.keys").undotree, + config = require('data.types').undotree, + keys = require('data.keys').undotree, }, { -- Noice - "folke/noice.nvim", + 'folke/noice.nvim', optional = true, - opts = require("data.types").noice, + opts = require('data.types').noice, }, { -- Duck - "tamton-aquib/duck.nvim", - config = require("data.types").duck, + 'tamton-aquib/duck.nvim', + config = require('data.types').duck, }, { -- Volt - "rootiest/volt", + 'rootiest/volt', lazy = true, }, { -- Minty - "nvchad/minty", + 'nvchad/minty', lazy = true, }, { - "folke/twilight.nvim", - opts = require("data.types").twilight, + 'folke/twilight.nvim', + opts = require('data.types').twilight, }, -- { -- vim-footprints -- "axlebedev/vim-footprints", diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 68354d8..80952b0 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -6,57 +6,57 @@ return { { -- Octo plugin - import = "lazyvim.plugins.extras.util.octo", + import = 'lazyvim.plugins.extras.util.octo', }, { -- Gist Tools - "Rawnly/gist.nvim", + 'Rawnly/gist.nvim', lazy = true, - cmd = require("data.cmd").gist, - keys = require("data.keys").gist.func, + cmd = require('data.cmd').gist, + keys = require('data.keys').gist.func, config = true, }, { -- LazyGit - "kdheepak/lazygit.nvim", + 'kdheepak/lazygit.nvim', lazy = true, - cmd = require("data.cmd").lazygit, - keys = require("data.keys").lazygit, - dependencies = require("data.deps").lazygit, + cmd = require('data.cmd').lazygit, + keys = require('data.keys').lazygit, + dependencies = require('data.deps').lazygit, config = function() - require("telescope").load_extension("lazygit") + require('telescope').load_extension('lazygit') end, }, { -- Thanks/github-stars - "jsongerber/thanks.nvim", + 'jsongerber/thanks.nvim', lazy = true, - cmd = require("data.cmd").thanks, - opts = require("data.types").thanks.opts, + cmd = require('data.cmd').thanks, + opts = require('data.types').thanks.opts, }, { -- GitLinker - "linrongbin16/gitlinker.nvim", + 'linrongbin16/gitlinker.nvim', lazy = true, - cmd = require("data.cmd").gitlinker, + cmd = require('data.cmd').gitlinker, opts = {}, - keys = require("data.keys").gitlinker, + keys = require('data.keys').gitlinker, }, { -- Git Blame - "f-person/git-blame.nvim", - event = "VeryLazy", - opts = require("data.types").gitblame.opts, + 'f-person/git-blame.nvim', + event = 'VeryLazy', + opts = require('data.types').gitblame.opts, }, { -- Git Graph - "isakbm/gitgraph.nvim", - opts = require("data.types").gitgraph.opts, - keys = require("data.keys").gitgraph, + 'isakbm/gitgraph.nvim', + opts = require('data.types').gitgraph.opts, + keys = require('data.keys').gitgraph, }, { -- Diffview - "sindrets/diffview.nvim", + 'sindrets/diffview.nvim', lazy = false, opts = {}, }, { -- Neogit - "NeogitOrg/neogit", + 'NeogitOrg/neogit', opts = { - graph_style = "kitty", + graph_style = 'kitty', }, }, } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 61a44db..0250ce8 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -18,22 +18,22 @@ local plugins = {} -- Check if lazy.nvim is installed -if pcall(require, "lazy") then +if pcall(require, 'lazy') then -- If lazy.nvim is installed, return an empty table and do nothing return plugins else -- If lazy.nvim is not installed and vim.g.ignore_no_lazy is not set, display a warning if not vim.g.ignore_no_lazy then - require("data").func.notify("lazy.nvim is not installed", "WARNING") + require('data').func.notify('lazy.nvim is not installed', 'WARNING') end -- Try to require plugins manually if we are not using lazy.nvim local function read_plugins_dir() -- Getting the root path for the current module directory local dir_path = - vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h") + vim.fn.fnamemodify(debug.getinfo(1, 'S').source:sub(2), ':h') -- Load modules from the data directory - require("data").load_modules_from_dir(dir_path, "plugins") + require('data').load_modules_from_dir(dir_path, 'plugins') end -- Read the directory and load any additional modules diff --git a/lua/plugins/languages.lua b/lua/plugins/languages.lua index 449fd4a..e36111c 100644 --- a/lua/plugins/languages.lua +++ b/lua/plugins/languages.lua @@ -3,66 +3,67 @@ -- ╭─────────────────────────────────────────────────────────╮ -- │ Languages │ -- ╰─────────────────────────────────────────────────────────╯ + return { { -- none-ls - import = "lazyvim.plugins.extras.lsp.none-ls", + import = 'lazyvim.plugins.extras.lsp.none-ls', }, { -- JSON - import = "lazyvim.plugins.extras.lang.json", + import = 'lazyvim.plugins.extras.lang.json', }, { -- Markdown - import = "lazyvim.plugins.extras.lang.markdown", + import = 'lazyvim.plugins.extras.lang.markdown', }, { -- Toml - import = "lazyvim.plugins.extras.lang.toml", + import = 'lazyvim.plugins.extras.lang.toml', }, { -- Git - import = "lazyvim.plugins.extras.lang.git", + import = 'lazyvim.plugins.extras.lang.git', }, { -- Python - import = "lazyvim.plugins.extras.lang.python", + import = 'lazyvim.plugins.extras.lang.python', }, { -- Yaml - import = "lazyvim.plugins.extras.lang.yaml", + import = 'lazyvim.plugins.extras.lang.yaml', }, { -- clangd - import = "lazyvim.plugins.extras.lang.clangd", + import = 'lazyvim.plugins.extras.lang.clangd', }, { -- cmake - import = "lazyvim.plugins.extras.lang.cmake", + import = 'lazyvim.plugins.extras.lang.cmake', }, { -- Docker - import = "lazyvim.plugins.extras.lang.docker", + import = 'lazyvim.plugins.extras.lang.docker', }, { -- Java - import = "lazyvim.plugins.extras.lang.java", + import = 'lazyvim.plugins.extras.lang.java', }, { -- Sql - import = "lazyvim.plugins.extras.lang.sql", + import = 'lazyvim.plugins.extras.lang.sql', }, { -- Jinja - "armyers/Vim-Jinja2-Syntax", + 'armyers/Vim-Jinja2-Syntax', }, { -- Render-markdown - "MeanderingProgrammer/render-markdown.nvim", + 'MeanderingProgrammer/render-markdown.nvim', enabled = false, opts = { heading = { -- Determins if a border is added above and below headings border = true, - above = "▂", + above = '▂', -- Used below heading for border - below = "🮂", + below = '🮂', }, - file_types = { "markdown", "Avante" }, + file_types = { 'markdown', 'Avante' }, }, - ft = { "markdown", "Avante" }, + ft = { 'markdown', 'Avante' }, }, { - "OXY2DEV/markview.nvim", - ft = { "markdown", "Avante" }, + 'OXY2DEV/markview.nvim', + ft = { 'markdown', 'Avante' }, opts = function() - local presets = require("markview.presets") + local presets = require('markview.presets') return { checkboxes = presets.checkboxes.nerd, headings = presets.headings.simple, @@ -70,23 +71,23 @@ return { end, }, { -- Markdown Preview - "iamcco/markdown-preview.nvim", - cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, - ft = { "markdown" }, + 'iamcco/markdown-preview.nvim', + cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, + ft = { 'markdown' }, build = function() - vim.fn["mkdp#util#install"]() + vim.fn['mkdp#util#install']() end, }, { -- WezTerm Types - "gonstoll/wezterm-types", + 'gonstoll/wezterm-types', dev = true, }, { - "akinsho/flutter-tools.nvim", + 'akinsho/flutter-tools.nvim', lazy = false, dependencies = { - "nvim-lua/plenary.nvim", - "stevearc/dressing.nvim", -- optional for vim.ui.select + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', -- optional for vim.ui.select }, opts = {}, }, diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index 65391a5..2810d99 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -6,62 +6,62 @@ return { { -- mini.animate - import = "lazyvim.plugins.extras.ui.mini-animate", + import = 'lazyvim.plugins.extras.ui.mini-animate', }, { - "echasnovski/mini.move", - event = "VeryLazy", + 'echasnovski/mini.move', + event = 'VeryLazy', opts = {}, }, { -- Mini.Indentscope - import = "lazyvim.plugins.extras.ui.mini-indentscope", + import = 'lazyvim.plugins.extras.ui.mini-indentscope', }, { -- Mini Indentscope - "echasnovski/mini.indentscope", - opts = require("data.types").miniindentscope.opts, - init = require("data.types").miniindentscope.init, + 'echasnovski/mini.indentscope', + opts = require('data.types').miniindentscope.opts, + init = require('data.types').miniindentscope.init, }, { -- mini.align - "echasnovski/mini.align", - event = "InsertEnter", + 'echasnovski/mini.align', + event = 'InsertEnter', config = function() - require("mini.align").setup() + require('mini.align').setup() end, }, { -- mini.splitjoin - "echasnovski/mini.splitjoin", - event = "InsertEnter", + 'echasnovski/mini.splitjoin', + event = 'InsertEnter', opts = { - mappings = require("data.keys").splitjoin, + mappings = require('data.keys').splitjoin, }, }, { -- mini.surround - "echasnovski/mini.surround", + 'echasnovski/mini.surround', opts = {}, }, { -- mini.files - "echasnovski/mini.files", - opts = require("data.types").minifiles.opts, - keys = require("data.keys").minifiles, - config = require("data.types").minifiles.config, + 'echasnovski/mini.files', + opts = require('data.types').minifiles.opts, + keys = require('data.keys').minifiles, + config = require('data.types').minifiles.config, }, { -- mini.icons - "echasnovski/mini.icons", + 'echasnovski/mini.icons', lazy = true, opts = { file = { - [".keep"] = { glyph = "󰊢", hl = "MiniIconsGrey" }, - ["devcontainer.json"] = { glyph = "", hl = "MiniIconsAzure" }, + ['.keep'] = { glyph = '󰊢', hl = 'MiniIconsGrey' }, + ['devcontainer.json'] = { glyph = '', hl = 'MiniIconsAzure' }, }, filetype = { - dotenv = { glyph = "", hl = "MiniIconsYellow" }, + dotenv = { glyph = '', hl = 'MiniIconsYellow' }, }, }, init = function() ---@diagnostic disable-next-line: duplicate-set-field - package.preload["nvim-web-devicons"] = function() - require("mini.icons").mock_nvim_web_devicons() - return package.loaded["nvim-web-devicons"] + package.preload['nvim-web-devicons'] = function() + require('mini.icons').mock_nvim_web_devicons() + return package.loaded['nvim-web-devicons'] end end, }, diff --git a/lua/plugins/nvim_updater.lua b/lua/plugins/nvim_updater.lua index 23b003e..b9b57eb 100644 --- a/lua/plugins/nvim_updater.lua +++ b/lua/plugins/nvim_updater.lua @@ -3,12 +3,12 @@ -- ╰─────────────────────────────────────────────────────────╯ return { -- Neovim Updater - "rootiest/nvim-updater.nvim", - version = "*", -- Pin to GitHub releases + 'rootiest/nvim-updater.nvim', + version = '*', -- Pin to GitHub releases lazy = false, opts = { - build_type = "RelWithDebInfo", - branch = "master", + build_type = 'RelWithDebInfo', + branch = 'master', verbose = false, check_for_updates = true, update_interval = (60 * 60) * 6, -- 6 hours @@ -16,10 +16,13 @@ return { -- Neovim Updater default_keymaps = false, }, keys = function() + -- Load Neovim Updater Debugging Functions + require('config.nvim_updater') -- Debugging Functions + -- Add Neovim Updater menu - require("data.func").add_keymap(require("data.keys").group.nvimup) + require('data.func').add_keymap(require('data.keys').group.nvimup) -- Add Neovim Updater keys - return require("data.keys").nvimup + return require('data.keys').nvimup end, dev = vim.g.rootiest_dev or false, } diff --git a/lua/plugins/override.lua b/lua/plugins/override.lua index ebabdfc..fe53f6f 100644 --- a/lua/plugins/override.lua +++ b/lua/plugins/override.lua @@ -10,22 +10,22 @@ -- Load plugin overrides return { { -- Override build for markdown-preview - "iamcco/markdown-preview.nvim", + 'iamcco/markdown-preview.nvim', priority = 1001, - build = "cd app && yarn install", + build = 'cd app && yarn install', }, { -- Prioritize dadbod - "kristijanhusak/vim-dadbod-completion", + 'kristijanhusak/vim-dadbod-completion', priority = 1001, - dependencies = "vim-dadbod", + dependencies = 'vim-dadbod', }, { -- Prioritize dadbod - "kristijanhusak/vim-dadbod-ui", + 'kristijanhusak/vim-dadbod-ui', priority = 1001, - dependencies = "vim-dadbod", + dependencies = 'vim-dadbod', }, { -- Prioritize dadbod - "tpope/vim-dadbod", + 'tpope/vim-dadbod', priority = 1002, }, } diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua index 10994c0..cb27411 100644 --- a/lua/plugins/snacks.lua +++ b/lua/plugins/snacks.lua @@ -4,7 +4,7 @@ return { { - "folke/snacks.nvim", + 'folke/snacks.nvim', priority = 1010, lazy = false, opts = { @@ -24,102 +24,102 @@ return { }, keys = { { - "un", + 'un', function() Snacks.notifier.hide() end, - desc = "Dismiss All Notifications", + desc = 'Dismiss All Notifications', }, { - "bd", + 'bd', function() Snacks.bufdelete() end, - desc = "Delete Buffer", + desc = 'Delete Buffer', }, { - "gg", + 'gg', function() Snacks.lazygit() end, - desc = "Lazygit", + desc = 'Lazygit', }, { - "gb", + 'gb', function() Snacks.git.blame_line() end, - desc = "Git Blame Line", + desc = 'Git Blame Line', }, { - "gB", + 'gB', function() Snacks.gitbrowse() end, - desc = "Git Browse", + desc = 'Git Browse', }, { - "gf", + 'gf', function() Snacks.lazygit.log_file() end, - desc = "Lazygit Current File History", + desc = 'Lazygit Current File History', }, { - "gl", + 'gl', function() Snacks.lazygit.log() end, - desc = "Lazygit Log (cwd)", + desc = 'Lazygit Log (cwd)', }, { - "cR", + 'cR', function() Snacks.rename() end, - desc = "Rename File", + desc = 'Rename File', }, { - "", + '', function() Snacks.terminal() end, - desc = "Toggle Terminal", + desc = 'Toggle Terminal', }, { - "", + '', function() Snacks.terminal() end, - desc = "which_key_ignore", + desc = 'which_key_ignore', }, { - "]]", + ']]', function() Snacks.words.jump(vim.v.count1) end, - desc = "Next Reference", + desc = 'Next Reference', }, { - "[[", + '[[', function() Snacks.words.jump(-vim.v.count1) end, - desc = "Prev Reference", + desc = 'Prev Reference', }, { - "N", - desc = "Neovim News", + 'N', + desc = 'Neovim News', function() Snacks.win({ - file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], + file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1], width = 0.6, height = 0.6, wo = { spell = false, wrap = false, - signcolumn = "yes", - statuscolumn = " ", + signcolumn = 'yes', + statuscolumn = ' ', conceallevel = 3, }, }) @@ -128,8 +128,8 @@ return { }, init = function() Snacks = Snacks -- Define the global so it will shutup - vim.api.nvim_create_autocmd("User", { - pattern = "VeryLazy", + vim.api.nvim_create_autocmd('User', { + pattern = 'VeryLazy', callback = function() -- Setup some globals for debugging (lazy-loaded) _G.dd = function(...) @@ -141,27 +141,27 @@ return { vim.print = _G.dd -- Override print to use snacks for `:=` command -- Create some toggle mappings - Snacks.toggle.option("spell", { name = "Spelling" }):map("us") - Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.option('spell', { name = 'Spelling' }):map('us') + Snacks.toggle.option('wrap', { name = 'Wrap' }):map('uw') Snacks.toggle - .option("relativenumber", { name = "Relative Number" }) - :map("uL") - Snacks.toggle.diagnostics():map("ud") - Snacks.toggle.line_number():map("ul") + .option('relativenumber', { name = 'Relative Number' }) + :map('uL') + Snacks.toggle.diagnostics():map('ud') + Snacks.toggle.line_number():map('ul') Snacks.toggle - .option("conceallevel", { + .option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2, }) - :map("uc") - Snacks.toggle.treesitter():map("uT") + :map('uc') + Snacks.toggle.treesitter():map('uT') Snacks.toggle .option( - "background", - { off = "light", on = "dark", name = "Dark Background" } + 'background', + { off = 'light', on = 'dark', name = 'Dark Background' } ) - :map("ub") - Snacks.toggle.inlay_hints():map("uh") + :map('ub') + Snacks.toggle.inlay_hints():map('uh') end, }) end, diff --git a/lua/plugins/statusline/basic.lua b/lua/plugins/statusline/basic.lua index f952fac..2626fd4 100644 --- a/lua/plugins/statusline/basic.lua +++ b/lua/plugins/statusline/basic.lua @@ -8,7 +8,7 @@ -- ╰─────────────────────────────────────────────────────────╯ -- If basic statusline is not enabled, return an empty table -if vim.g.statusline ~= "basic" then +if vim.g.statusline ~= 'basic' then return {} end diff --git a/lua/plugins/statusline/heirline.lua b/lua/plugins/statusline/heirline.lua index 59ab7e8..d0fe025 100644 --- a/lua/plugins/statusline/heirline.lua +++ b/lua/plugins/statusline/heirline.lua @@ -9,13 +9,13 @@ return { { - "rebelot/heirline.nvim", - cond = require("data.func").check_global_var( - "statusline", - "heirline", - "lualine" + 'rebelot/heirline.nvim', + cond = require('data.func').check_global_var( + 'statusline', + 'heirline', + 'lualine' ), - event = "UIEnter", + event = 'UIEnter', opts = {}, }, } diff --git a/lua/plugins/statusline/lualine.lua b/lua/plugins/statusline/lualine.lua index 597e74f..5802545 100644 --- a/lua/plugins/statusline/lualine.lua +++ b/lua/plugins/statusline/lualine.lua @@ -7,12 +7,12 @@ -- │ Lualine │ -- ╰─────────────────────────────────────────────────────────╯ -local wakatime_stats = require("utils.wakatime_stats") -local music_stats = require("utils.music_stats") +local wakatime_stats = require('utils.wakatime_stats') +local music_stats = require('utils.music_stats') -- Setup NeoMiniMap extension -- local minimap_extension = require("neominimap.statusline").lualine_default -local neominimap = require("neominimap.statusline") +local neominimap = require('neominimap.statusline') local minimap_extension = { sections = { lualine_a = { @@ -20,8 +20,8 @@ local minimap_extension = { }, lualine_b = { { -- Branch - "branch", - separator = "", + 'branch', + separator = '', padding = { left = 1, right = 0 }, }, }, @@ -30,89 +30,89 @@ local minimap_extension = { }, lualine_y = { { -- Progress - "progress", - separator = "", + 'progress', + separator = '', padding = { left = 0, right = 1 }, - icon = "", + icon = '', }, neominimap.position, }, lualine_z = { { -- Time - "datetime", - style = "%a %R", - icon = " ", + 'datetime', + style = '%a %R', + icon = ' ', padding = { left = 0, right = 1 }, on_click = function() - vim.cmd("Telescope oldfiles") + vim.cmd('Telescope oldfiles') end, }, }, }, - filetypes = { "neominimap" }, + filetypes = { 'neominimap' }, } -- Use lualine by default if vim.g.statusline == nil then - vim.g.statusline = "lualine" + vim.g.statusline = 'lualine' end -- function to process get_status() and set buffer variable to that data. -local neocodeium = require("neocodeium") +local neocodeium = require('neocodeium') local function get_neocodeium_status(ev) local status, server_status = neocodeium.get_status() -- process this data, convert it to custom string/icon etc and set buffer variable -- Tables to map serverstatus and status to corresponding symbols local server_status_symbols = { - [0] = "󰣺 ", -- Connected - [1] = "󱤚 ", -- Connecting - [2] = "󰣽 ", -- Disconnected + [0] = '󰣺 ', -- Connected + [1] = '󱤚 ', -- Connecting + [2] = '󰣽 ', -- Disconnected } local status_symbols = { - [0] = "󰚩 ", -- Enabled - [1] = "󱚧 ", -- Disabled Globally - [3] = "󱚢 ", -- Disabled for Buffer filetype - [5] = "󱚠 ", -- Disabled for Buffer encoding - [2] = "󱙻 ", -- Disabled for Buffer (catch-all) + [0] = '󰚩 ', -- Enabled + [1] = '󱚧 ', -- Disabled Globally + [3] = '󱚢 ', -- Disabled for Buffer filetype + [5] = '󱚠 ', -- Disabled for Buffer encoding + [2] = '󱙻 ', -- Disabled for Buffer (catch-all) } -- Handle serverstatus and status fallback (safeguard against any unexpected value) - local luacodeium = server_status_symbols[server_status] or "󰣼 " - luacodeium = luacodeium .. (status_symbols[status] or "󱙻 ") - vim.api.nvim_buf_set_var(ev.buf, "neocodeium_status", luacodeium) + local luacodeium = server_status_symbols[server_status] or '󰣼 ' + luacodeium = luacodeium .. (status_symbols[status] or '󱙻 ') + vim.api.nvim_buf_set_var(ev.buf, 'neocodeium_status', luacodeium) end -- Then only some of event fired we invoked this function -vim.api.nvim_create_autocmd("User", { +vim.api.nvim_create_autocmd('User', { group = ..., -- set some augroup here pattern = { - "NeoCodeiumServerConnecting", - "NeoCodeiumServerConnected", - "NeoCodeiumServerStopped", - "NeoCodeiumEnabled", - "NeoCodeiumDisabled", - "NeoCodeiumBufEnabled", - "NeoCodeiumBufDisabled", + 'NeoCodeiumServerConnecting', + 'NeoCodeiumServerConnected', + 'NeoCodeiumServerStopped', + 'NeoCodeiumEnabled', + 'NeoCodeiumDisabled', + 'NeoCodeiumBufEnabled', + 'NeoCodeiumBufDisabled', }, callback = get_neocodeium_status, }) return { -- Lualine - "nvim-lualine/lualine.nvim", - cond = require("data.func").check_global_var( - "statusline", - "lualine", - "lualine" + 'nvim-lualine/lualine.nvim', + cond = require('data.func').check_global_var( + 'statusline', + 'lualine', + 'lualine' ), - dependencies = require("data.deps").lualine, + dependencies = require('data.deps').lualine, init = function() vim.g.lualine_laststatus = vim.o.laststatus if vim.fn.argc(-1) > 0 then -- set an empty statusline till lualine loads - vim.o.statusline = " " + vim.o.statusline = ' ' else -- hide the statusline on the starter page vim.o.laststatus = 0 @@ -127,84 +127,84 @@ return { -- Lualine -- Define todo-comments component -- Attempt to require the plugin and handle the case where it's not available - local status, todos = pcall(require, "todos-lualine") + local status, todos = pcall(require, 'todos-lualine') local todos_component if not status then todos_component = nil -- Set to nil if the plugin is not loaded else - todos_component = todos.component(require("data.types").todo.lualine()) + todos_component = todos.component(require('data.types').todo.lualine()) end local opts = { options = { -- General options - theme = "auto", + theme = 'auto', globalstatus = vim.o.laststatus == 3, disabled_filetypes = { - statusline = { "dashboard", "alpha", "ministarter" }, + statusline = { 'dashboard', 'alpha', 'ministarter' }, }, - section_separators = { left = "", right = "" }, - component_separators = { left = "", right = "" }, + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, }, sections = { -- Sections lualine_a = { { -- Mode function() - return require("data.types").mode.current.lualine() + return require('data.types').mode.current.lualine() end, padding = { left = 1, right = 0 }, - separator = { left = "", right = "" }, + separator = { left = '', right = '' }, }, { -- MultiCursors function() - return require("data.func").mc_statusline().count - .. require("data.func").mc_statusline().icon + return require('data.func').mc_statusline().count + .. require('data.func').mc_statusline().icon end, cond = function() - return require("data.func").mc_statusline().cursors > 1 + return require('data.func').mc_statusline().cursors > 1 end, color = function() - return require("data.func").mc_statusline().color + return require('data.func').mc_statusline().color end, padding = { left = 1, right = 0 }, - separator = { left = "", right = "" }, + separator = { left = '', right = '' }, }, }, lualine_b = { { -- Branch - "branch", - separator = "", + 'branch', + separator = '', padding = { left = 1, right = 0 }, }, { -- Todo todos_component, cond = function() - return require("data.func").is_window_wide_enough(100) + return require('data.func').is_window_wide_enough(100) end, padding = { left = 1, right = 0 }, on_click = function() - vim.cmd("TodoTelescope") + vim.cmd('TodoTelescope') end, }, { -- Arrow function() - return require("arrow.statusline").text_for_statusline_with_icons() + return require('arrow.statusline').text_for_statusline_with_icons() end, cond = function() - return require("data.func").is_window_wide_enough(100) - and pcall(require, "arrow") + return require('data.func').is_window_wide_enough(100) + and pcall(require, 'arrow') end, padding = { left = 1, right = 0 }, on_click = function() - vim.cmd("Arrow open") + vim.cmd('Arrow open') end, }, }, lualine_c = { LazyVim.lualine.root_dir(), { -- Diagnostics - "diagnostics", + 'diagnostics', symbols = { error = icons.diagnostics.Error, warn = icons.diagnostics.Warn, @@ -214,35 +214,35 @@ return { -- Lualine padding = { left = 0, right = 0 }, }, { -- Filetype - "filetype", + 'filetype', icon_only = true, - separator = "", + separator = '', padding = { left = 1, right = 0 }, }, { -- PrettyPath LazyVim.lualine.pretty_path(), padding = { left = 0, right = 0 }, cond = function() - return not string.find(vim.bo.filetype, "neovim_updater_term") + return not string.find(vim.bo.filetype, 'neovim_updater_term') end, }, { -- Neovim Updater function() local ft = vim.bo.filetype - if ft == "neovim_updater_term.updating" then - return "Neovim Updating.." - elseif ft == "neovim_updater_term.cloning" then - return "Neovim Source Cloning.." - elseif ft == "neovim_updater_term.changes" then - return "Neovim Source Changelog" + if ft == 'neovim_updater_term.updating' then + return 'Neovim Updating..' + elseif ft == 'neovim_updater_term.cloning' then + return 'Neovim Source Cloning..' + elseif ft == 'neovim_updater_term.changes' then + return 'Neovim Source Changelog' end end, - icon = "󰅢 ", - color = "lualine_a_terminal", - separator = { left = "", right = "" }, + icon = '󰅢 ', + color = 'lualine_a_terminal', + separator = { left = '', right = '' }, padding = { left = 0, right = 0 }, cond = function() - return string.find(vim.bo.filetype, "neovim_updater_term") ~= nil + return string.find(vim.bo.filetype, 'neovim_updater_term') ~= nil end, }, }, @@ -268,7 +268,7 @@ return { -- Lualine color = function() return LazyVim.ui.fg("Special") end, }, { -- Diff - "diff", + 'diff', symbols = { added = icons.git.added, modified = icons.git.modified, @@ -276,7 +276,7 @@ return { -- Lualine padding = { left = 0, right = 0 }, on_click = function() if vim.g.statusline_clickable_git ~= false then - require("config.rootiest").toggle_lazygit_float() + require('config.rootiest').toggle_lazygit_float() end end, }, @@ -292,12 +292,12 @@ return { -- Lualine end end, cond = function() - return require("data.func").is_window_wide_enough(200) + return require('data.func').is_window_wide_enough(200) end, padding = { left = 0, right = 0 }, on_click = function() if vim.g.statusline_clickable_git ~= false then - require("config.rootiest").toggle_lazygit_float() + require('config.rootiest').toggle_lazygit_float() end end, }, @@ -310,7 +310,7 @@ return { -- Lualine return wakatime_stats.get_color() end, cond = function() - return require("data.func").is_window_wide_enough(100) + return require('data.func').is_window_wide_enough(100) end, padding = { left = 0, right = 1 }, }, @@ -319,36 +319,36 @@ return { -- Lualine return music_stats.get_icon_with_text() end, cond = function() - return require("data.func").is_window_wide_enough(100) + return require('data.func').is_window_wide_enough(100) end, padding = { left = 0, right = 1 }, }, { -- Neovim Updater Status function() - return require("nvim_updater").get_statusline().icon_text + return require('nvim_updater').get_statusline().icon_text end, color = function() - return require("nvim_updater").get_statusline().color + return require('nvim_updater').get_statusline().color end, on_click = function() - require("nvim_updater").show_new_commits({ + require('nvim_updater').show_new_commits({ isupdate = true, short = false, }) end, padding = { left = 1, right = 1 }, cond = function() - if not pcall(require, "nvim_updater") then + if not pcall(require, 'nvim_updater') then return false end - return not string.find(vim.bo.filetype, "neovim_updater_term") + return not string.find(vim.bo.filetype, 'neovim_updater_term') end, }, }, lualine_y = { { -- NeoCodeium Status function() - return vim.b.neocodeium_status or "󰣽 " + return vim.b.neocodeium_status or '󰣽 ' end, padding = { left = 0, right = 1 }, }, @@ -356,125 +356,125 @@ return { -- Lualine function() return vim.fn.wordcount().words end, - icon = " ", + icon = ' ', cond = function() - return require("data.func").is_window_wide_enough(80) + return require('data.func').is_window_wide_enough(80) end, padding = { left = 0, right = 1 }, on_click = function() - vim.cmd("Telescope current_buffer_fuzzy_find") + vim.cmd('Telescope current_buffer_fuzzy_find') end, }, { -- Progress - "progress", - separator = "", + 'progress', + separator = '', padding = { left = 0, right = 1 }, cond = function() - return require("data.func").is_window_wide_enough(60) + return require('data.func').is_window_wide_enough(60) end, - icon = "", + icon = '', on_click = function() - vim.cmd("Telescope grep_string") + vim.cmd('Telescope grep_string') end, }, { -- Location - "location", + 'location', padding = { left = 0, right = 1 }, cond = function() - return require("data.func").is_window_wide_enough(40) + return require('data.func').is_window_wide_enough(40) end, on_click = function() - vim.cmd("Telescope grep_string") + vim.cmd('Telescope grep_string') end, }, { -- Selection - "selection_count", + 'selection_count', cond = function() - return require("data.func").is_window_wide_enough(120) + return require('data.func').is_window_wide_enough(120) end, padding = { left = 0, right = 1 }, }, { -- Filesize - "filesize", + 'filesize', cond = function() - return require("data.func").is_window_wide_enough(100) + return require('data.func').is_window_wide_enough(100) end, padding = { left = 0, right = 1 }, - icon = "", + icon = '', on_click = function() - vim.cmd("Neotree reveal toggle") + vim.cmd('Neotree reveal toggle') end, - separator = { left = "", right = "" }, + separator = { left = '', right = '' }, }, { -- Encoding - "encoding", + 'encoding', show_bomb = true, padding = { left = 0, right = 1 }, - separator = "", - icon = "󱁻", + separator = '', + icon = '󱁻', on_click = function() - vim.cmd("Telescope oldfiles") + vim.cmd('Telescope oldfiles') end, }, }, lualine_z = { { -- Recording - require("recorder").recordingStatus, + require('recorder').recordingStatus, cond = function() - return pcall(require, "recorder") + return pcall(require, 'recorder') end, - color = "CurSearch", - separator = { left = "", right = "" }, + color = 'CurSearch', + separator = { left = '', right = '' }, }, { -- Search - "searchcount", - color = "CurSearch", - separator = { left = "", right = "" }, - icon = "󰍉 ", + 'searchcount', + color = 'CurSearch', + separator = { left = '', right = '' }, + icon = '󰍉 ', on_click = function() - vim.cmd("Telescope current_buffer_fuzzy_find") + vim.cmd('Telescope current_buffer_fuzzy_find') end, }, { -- Time - "datetime", - style = "%a %R", - icon = " ", + 'datetime', + style = '%a %R', + icon = ' ', padding = { left = 0, right = 1 }, on_click = function() - vim.cmd("Telescope buffers") + vim.cmd('Telescope buffers') end, - separator = { left = "", right = "" }, + separator = { left = '', right = '' }, }, }, }, extensions = { - "neo-tree", - "lazy", - "aerial", - "fugitive", - "fzf", - "mason", - "overseer", - "toggleterm", - "nvim-dap-ui", - "quickfix", - "symbols-outline", - "trouble", + 'neo-tree', + 'lazy', + 'aerial', + 'fugitive', + 'fzf', + 'mason', + 'overseer', + 'toggleterm', + 'nvim-dap-ui', + 'quickfix', + 'symbols-outline', + 'trouble', minimap_extension, }, } -- do not add trouble symbols if aerial is enabled -- And allow it to be overriden for some buffer types (see autocmds) - if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then - local trouble = require("trouble") + if vim.g.trouble_lualine and LazyVim.has('trouble.nvim') then + local trouble = require('trouble') local symbols = trouble.statusline({ - mode = "symbols", + mode = 'symbols', groups = {}, title = false, filter = { range = true }, - format = "{kind_icon}{symbol.name:Normal}", - hl_group = "lualine_c_normal", + format = '{kind_icon}{symbol.name:Normal}', + hl_group = 'lualine_c_normal', }) table.insert(opts.sections.lualine_c, { symbols and symbols.get, diff --git a/lua/plugins/statusline/none.lua b/lua/plugins/statusline/none.lua index aa8f539..cbfaf88 100644 --- a/lua/plugins/statusline/none.lua +++ b/lua/plugins/statusline/none.lua @@ -7,7 +7,7 @@ -- │ No Statusline │ -- ╰─────────────────────────────────────────────────────────╯ -if vim.g.statusline ~= "none" then +if vim.g.statusline ~= 'none' then return {} end diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index f2d4f70..f22f5b9 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -6,81 +6,81 @@ local P = { -- Define Telescope Plugins Specs { -- Telescope All Recent - "prochri/telescope-all-recent.nvim", + 'prochri/telescope-all-recent.nvim', dependencies = { - "nvim-telescope/telescope.nvim", - "kkharji/sqlite.lua", + 'nvim-telescope/telescope.nvim', + 'kkharji/sqlite.lua', -- optional, if using telescope for vim.ui.select - "stevearc/dressing.nvim", + 'stevearc/dressing.nvim', }, opts = { default = { disable = true, -- disable any unkown pickers (recommended) use_cwd = true, -- differentiate scoring for each picker based on cwd - sorting = "frecency", -- sorting: options: 'recent' and 'frecency' + sorting = 'frecency', -- sorting: options: 'recent' and 'frecency' }, }, }, { -- Telescope Heading - "crispgm/telescope-heading.nvim", + 'crispgm/telescope-heading.nvim', dependencies = { - "nvim-telescope/telescope.nvim", + 'nvim-telescope/telescope.nvim', }, config = function() - require("telescope").setup({ + require('telescope').setup({ extensions = { heading = { treesitter = true, }, }, }) - require("telescope").load_extension("heading") + require('telescope').load_extension('heading') end, }, { -- Telescope Spell checker - "matkrin/telescope-spell-errors.nvim", + 'matkrin/telescope-spell-errors.nvim', lazy = true, - cmd = require("data.cmd").spell_errors, + cmd = require('data.cmd').spell_errors, config = function() - require("telescope").load_extension("spell_errors") + require('telescope').load_extension('spell_errors') end, - dependencies = require("data.deps").needs_telescope, + dependencies = require('data.deps').needs_telescope, }, { -- Telescope Toggleterm - "ryanmsnyder/toggleterm-manager.nvim", + 'ryanmsnyder/toggleterm-manager.nvim', dependencies = { - "akinsho/nvim-toggleterm.lua", - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim", -- only needed because it's a dependency of telescope + 'akinsho/nvim-toggleterm.lua', + 'nvim-telescope/telescope.nvim', + 'nvim-lua/plenary.nvim', -- only needed because it's a dependency of telescope }, config = true, - keys = require("data.keys").telescope.toggleterm, + keys = require('data.keys').telescope.toggleterm, }, { -- Telescope Lazy - "nvim-telescope/telescope.nvim", - dependencies = "tsakirist/telescope-lazy.nvim", - keys = require("data.keys").telescope.lazy, + 'nvim-telescope/telescope.nvim', + dependencies = 'tsakirist/telescope-lazy.nvim', + keys = require('data.keys').telescope.lazy, }, { -- Telescope Luasnip - "benfowler/telescope-luasnip.nvim", - module = "telescope._extensions.luasnip", -- if you wish to lazy-load + 'benfowler/telescope-luasnip.nvim', + module = 'telescope._extensions.luasnip', -- if you wish to lazy-load config = function() - require("telescope").load_extension("luasnip") + require('telescope').load_extension('luasnip') end, }, { -- Telescope Git Worktree - "ThePrimeagen/git-worktree.nvim", + 'ThePrimeagen/git-worktree.nvim', }, { -- UndoTree Telescope extension - "nvim-telescope/telescope.nvim", + 'nvim-telescope/telescope.nvim', dependencies = { - "nvim-lua/plenary.nvim", - "debugloop/telescope-undo.nvim", - "jonarrien/telescope-cmdline.nvim", + 'nvim-lua/plenary.nvim', + 'debugloop/telescope-undo.nvim', + 'jonarrien/telescope-cmdline.nvim', }, opts = function() - require("telescope").load_extension("undo") - vim.keymap.set("n", "uU", "Telescope undo") + require('telescope').load_extension('undo') + vim.keymap.set('n', 'uU', 'Telescope undo') return { extensions = { undo = {}, @@ -89,108 +89,108 @@ local P = { -- Define Telescope Plugins Specs end, }, { -- Telescope Software Licenses - "chip/telescope-software-licenses.nvim", + 'chip/telescope-software-licenses.nvim', dependencies = { - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim", + 'nvim-telescope/telescope.nvim', + 'nvim-lua/plenary.nvim', }, config = function() - require("telescope").load_extension("software-licenses") + require('telescope').load_extension('software-licenses') end, }, { -- Telescope Conventional Commits - "olacin/telescope-cc.nvim", + 'olacin/telescope-cc.nvim', config = function() - require("telescope").load_extension("conventional_commits") + require('telescope').load_extension('conventional_commits') end, }, { -- Telescope File Browser - "nvim-telescope/telescope-file-browser.nvim", - dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }, + 'nvim-telescope/telescope-file-browser.nvim', + dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, config = function() - require("telescope").load_extension("file_browser") + require('telescope').load_extension('file_browser') end, - keys = require("data.keys").telescope.filebrowser, + keys = require('data.keys').telescope.filebrowser, }, { -- Cheatsheet - "doctorfree/cheatsheet.nvim", - event = "VeryLazy", + 'doctorfree/cheatsheet.nvim', + event = 'VeryLazy', dependencies = { - { "nvim-telescope/telescope.nvim" }, - { "nvim-lua/popup.nvim" }, - { "nvim-lua/plenary.nvim" }, + { 'nvim-telescope/telescope.nvim' }, + { 'nvim-lua/popup.nvim' }, + { 'nvim-lua/plenary.nvim' }, }, - cmd = "Cheatsheet", + cmd = 'Cheatsheet', config = function() - local ctactions = require("cheatsheet.telescope.actions") - require("cheatsheet").setup({ + local ctactions = require('cheatsheet.telescope.actions') + require('cheatsheet').setup({ bundled_cheetsheets = { enabled = { - "default", - "lua", - "markdown", - "regex", - "netrw", - "unicode", + 'default', + 'lua', + 'markdown', + 'regex', + 'netrw', + 'unicode', }, - disabled = { "nerd-fonts" }, + disabled = { 'nerd-fonts' }, }, bundled_plugin_cheatsheets = { enabled = { - "auto-session", - "goto-preview", - "octo.nvim", - "telescope.nvim", - "vim-easy-align", - "vim-sandwich", + 'auto-session', + 'goto-preview', + 'octo.nvim', + 'telescope.nvim', + 'vim-easy-align', + 'vim-sandwich', }, - disabled = { "gitsigns" }, + disabled = { 'gitsigns' }, }, include_only_installed_plugins = true, telescope_mappings = { - [""] = ctactions.select_or_fill_commandline, - [""] = ctactions.select_or_execute, - [""] = ctactions.copy_cheat_value, - [""] = ctactions.edit_user_cheatsheet, + [''] = ctactions.select_or_fill_commandline, + [''] = ctactions.select_or_execute, + [''] = ctactions.copy_cheat_value, + [''] = ctactions.edit_user_cheatsheet, }, }) - require("telescope").load_extension("cheatsheet") + require('telescope').load_extension('cheatsheet') end, }, { -- Telescope Git Diffs - "paopaol/telescope-git-diffs.nvim", + 'paopaol/telescope-git-diffs.nvim', requires = { - "nvim-lua/plenary.nvim", - "sindrets/diffview.nvim", + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', }, }, { -- Fzf Lua - "ibhagwan/fzf-lua", - opts = { "telescope", fzf_colors = true }, + 'ibhagwan/fzf-lua', + opts = { 'telescope', fzf_colors = true }, }, { - "danielfalk/smart-open.nvim", - branch = "0.2.x", + 'danielfalk/smart-open.nvim', + branch = '0.2.x', config = function() - require("telescope").load_extension("smart_open") + require('telescope').load_extension('smart_open') end, dependencies = { - "kkharji/sqlite.lua", + 'kkharji/sqlite.lua', -- Only required if using match_algorithm fzf - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, -- Optional. If installed, native fzy will be used when match_algorithm is fzy - { "nvim-telescope/telescope-fzy-native.nvim" }, + { 'nvim-telescope/telescope-fzy-native.nvim' }, }, }, } -if require("data.func").check_global_var("use_telescope", false, true) then - P = { { import = "lazyvim.plugins.extras.editor.fzf" } } +if require('data.func').check_global_var('use_telescope', false, true) then + P = { { import = 'lazyvim.plugins.extras.editor.fzf' } } end -if require("data.func").check_global_var("use_fzf_lua", true, false) then - table.insert(P, 1, { import = "lazyvim.plugins.extras.editor.fzf" }) - table.insert(P, 2, { "ibhagwan/fzf-lua", lazy = false, opts = {} }) +if require('data.func').check_global_var('use_fzf_lua', true, false) then + table.insert(P, 1, { import = 'lazyvim.plugins.extras.editor.fzf' }) + table.insert(P, 2, { 'ibhagwan/fzf-lua', lazy = false, opts = {} }) end return P diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua index de4c47c..d928e8e 100644 --- a/lua/plugins/terminal.lua +++ b/lua/plugins/terminal.lua @@ -6,32 +6,32 @@ return { { -- Smart-Splits - "mrjones2014/smart-splits.nvim", + 'mrjones2014/smart-splits.nvim', lazy = false, - build = require("data.types").smart_splits.build(), + build = require('data.types').smart_splits.build(), }, { -- Image Renderer - "3rd/image.nvim", - ft = require("data.types").image, + '3rd/image.nvim', + ft = require('data.types').image, config = function() - require("image").setup({ - backend = "kitty", -- Kitty will provide the best experience, but you need a compatible terminal - processor = "magick_cli", - kitty_method = "normal", + require('image').setup({ + backend = 'kitty', -- Kitty will provide the best experience, but you need a compatible terminal + processor = 'magick_cli', + kitty_method = 'normal', integrations = { markdown = { enabled = true, clear_in_insert_mode = false, download_remote_images = true, only_render_image_at_cursor = false, - filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here + filetypes = { 'markdown', 'vimwiki' }, -- markdown extensions (ie. quarto) can go here }, neorg = { enabled = true, clear_in_insert_mode = false, download_remote_images = true, only_render_image_at_cursor = false, - filetypes = { "norg" }, + filetypes = { 'norg' }, }, html = { enabled = false, @@ -46,20 +46,20 @@ return { max_width_window_percentage = math.huge, window_overlap_clear_enabled = false, window_overlap_clear_ft_ignore = { - "cmp_menu", - "cmp_docs", - "neotree", - "neominimap", - "minimap", - "", + 'cmp_menu', + 'cmp_docs', + 'neotree', + 'neominimap', + 'minimap', + '', }, hijack_file_patterns = { - "*.png", - "*.jpg", - "*.jpeg", - "*.gif", - "*.webp", - "*.avif", + '*.png', + '*.jpg', + '*.jpeg', + '*.gif', + '*.webp', + '*.avif', }, -- render image files as images when opened }) end, @@ -73,51 +73,51 @@ return { end, }, { -- ToggleTerm - "akinsho/toggleterm.nvim", - event = "VeryLazy", - keys = require("data.keys").toggleterm, + 'akinsho/toggleterm.nvim', + event = 'VeryLazy', + keys = require('data.keys').toggleterm, config = function() - require("toggleterm").setup(require("data.types").toggleterm) + require('toggleterm').setup(require('data.types').toggleterm) end, }, { -- Kitty-Runner - "jghauser/kitty-runner.nvim", - cond = require("data.func").is_kitty(), + 'jghauser/kitty-runner.nvim', + cond = require('data.func').is_kitty(), }, { -- Kitty-Scrollback - "mikesmithgh/kitty-scrollback.nvim", + 'mikesmithgh/kitty-scrollback.nvim', enabled = true, lazy = true, - cmd = require("data.cmd").kitty_scrollback, - event = { "User KittyScrollbackLaunch" }, - version = "*", + cmd = require('data.cmd').kitty_scrollback, + event = { 'User KittyScrollbackLaunch' }, + version = '*', config = function() -- Using Kitty-Scrollback - if require("data.func").is_kitty_scrollback() then - require("kitty-scrollback").setup() + if require('data.func').is_kitty_scrollback() then + require('kitty-scrollback').setup() end end, - cond = require("data.func").is_kitty_scrollback(), + cond = require('data.func').is_kitty_scrollback(), }, { -- Nekifoch - "NeViRAIDE/nekifoch.nvim", + 'NeViRAIDE/nekifoch.nvim', lazy = true, - cmd = require("data.cmd").nekifoch, + cmd = require('data.cmd').nekifoch, opts = { - kitty_conf_path = vim.env.HOME .. "/.kittyoverrides", + kitty_conf_path = vim.env.HOME .. '/.kittyoverrides', }, - keys = require("data.keys").nekifoch, - cond = require("data.func").is_kitty(), + keys = require('data.keys').nekifoch, + cond = require('data.func').is_kitty(), }, { -- WezTerm - "willothy/wezterm.nvim", + 'willothy/wezterm.nvim', config = true, - cond = require("data.func").is_wezterm(), + cond = require('data.func').is_wezterm(), }, { -- Tmux - "aserowy/tmux.nvim", + 'aserowy/tmux.nvim', config = function() - return require("tmux").setup() + return require('tmux').setup() end, - cond = require("data.func").is_tmux(), + cond = require('data.func').is_tmux(), }, } diff --git a/lua/plugins/themes.lua b/lua/plugins/themes.lua index 475e2ad..ed3f09f 100644 --- a/lua/plugins/themes.lua +++ b/lua/plugins/themes.lua @@ -6,117 +6,117 @@ return { { -- Tokyonight - "folke/tokyonight.nvim", + 'folke/tokyonight.nvim', lazy = true, -- Override - name = "tokyonight", + name = 'tokyonight', opts = { - style = "night", + style = 'night', }, }, { -- Catppuccin - "catppuccin/nvim", + 'catppuccin/nvim', lazy = false, -- Override priority = 1000, - name = "catppuccin", - opts = require("data.types").catppuccin, + name = 'catppuccin', + opts = require('data.types').catppuccin, }, { -- Ayu - "Shatur/neovim-ayu", + 'Shatur/neovim-ayu', lazy = true, - name = "ayu", + name = 'ayu', }, { -- Dracula - "Mofiqul/dracula.nvim", + 'Mofiqul/dracula.nvim', lazy = true, - name = "dracula", + name = 'dracula', }, { -- Eldritch - "eldritch-theme/eldritch.nvim", + 'eldritch-theme/eldritch.nvim', lazy = true, - name = "eldritch", + name = 'eldritch', }, { -- Flow - "0xstepit/flow.nvim", + '0xstepit/flow.nvim', lazy = true, - name = "flow", + name = 'flow', }, { -- Github-theme - "projekt0n/github-nvim-theme", + 'projekt0n/github-nvim-theme', lazy = true, - name = "github-nvim-theme", + name = 'github-nvim-theme', }, { -- Gruvbox - "ellisonleao/gruvbox.nvim", + 'ellisonleao/gruvbox.nvim', lazy = true, - name = "gruvbox", + name = 'gruvbox', }, { -- Kanagawa - "rebelot/kanagawa.nvim", + 'rebelot/kanagawa.nvim', lazy = true, - name = "kanagawa", + name = 'kanagawa', }, { -- Monochrome - "kdheepak/monochrome.nvim", + 'kdheepak/monochrome.nvim', lazy = true, - name = "monochrome", + name = 'monochrome', }, { -- NeoFusion - "diegoulloao/neofusion.nvim", + 'diegoulloao/neofusion.nvim', lazy = true, - name = "neofusion", + name = 'neofusion', }, { -- Nord - "shaunsingh/nord.nvim", + 'shaunsingh/nord.nvim', lazy = true, - name = "nord", + name = 'nord', }, { -- One Dark Pro - "olimorris/onedarkpro.nvim", + 'olimorris/onedarkpro.nvim', lazy = true, - name = "onedarkpro", + name = 'onedarkpro', }, { -- Oxocarbon - "nyoom-engineering/oxocarbon.nvim", + 'nyoom-engineering/oxocarbon.nvim', lazy = true, - name = "oxocarbon", + name = 'oxocarbon', }, { -- Paper - "https://gitlab.com/yorickpeterse/vim-paper.git", + 'https://gitlab.com/yorickpeterse/vim-paper.git', lazy = true, - name = "vim-paper", + name = 'vim-paper', }, { -- Rose-Pine - "rose-pine/neovim", - name = "rose-pine", + 'rose-pine/neovim', + name = 'rose-pine', lazy = true, }, { -- Umbra - "LZDQ/umbra.nvim", + 'LZDQ/umbra.nvim', lazy = true, - name = "umbra", + name = 'umbra', }, { -- Zenbones - "zenbones-theme/zenbones.nvim", - name = "zenbones", + 'zenbones-theme/zenbones.nvim', + name = 'zenbones', lazy = true, - dependencies = require("data.deps").zenbones, + dependencies = require('data.deps').zenbones, }, -- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ UTILITIES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ { -- Transparent - "xiyaowong/transparent.nvim", + 'xiyaowong/transparent.nvim', lazy = true, - keys = require("data.keys").transparent, - cmd = require("data.cmd").transparent, + keys = require('data.keys').transparent, + cmd = require('data.cmd').transparent, }, { -- Auto Dark Mode - "f-person/auto-dark-mode.nvim", + 'f-person/auto-dark-mode.nvim', lazy = true, - opts = require("data.types").auto_dark_mode, - cond = require("data.cond").auto_dark_mode, + opts = require('data.types').auto_dark_mode, + cond = require('data.cond').auto_dark_mode, }, { -- Highlight colors - "brenoprata10/nvim-highlight-colors", - event = "BufReadPre", - opts = require("data.types").hightlight_colors, + 'brenoprata10/nvim-highlight-colors', + event = 'BufReadPre', + opts = require('data.types').hightlight_colors, }, } diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua index 49f620b..d9caad8 100644 --- a/lua/plugins/util.lua +++ b/lua/plugins/util.lua @@ -6,19 +6,19 @@ return { { -- Chezmoi - import = "lazyvim.plugins.extras.util.chezmoi", + import = 'lazyvim.plugins.extras.util.chezmoi', }, { -- Dotfiles plugins - import = "lazyvim.plugins.extras.util.dot", + import = 'lazyvim.plugins.extras.util.dot', }, { -- Env file no diagnostics - "nvim-treesitter/nvim-treesitter", + 'nvim-treesitter/nvim-treesitter', opts = function(_) - vim.api.nvim_create_augroup("EnvFileDiagnostics", { clear = true }) + vim.api.nvim_create_augroup('EnvFileDiagnostics', { clear = true }) - vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - group = "EnvFileDiagnostics", - pattern = { "*.env", "*.env.*" }, + vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + group = 'EnvFileDiagnostics', + pattern = { '*.env', '*.env.*' }, callback = function() vim.diagnostic.enable(false) end, @@ -26,75 +26,76 @@ return { end, }, { -- Wakatime - "wakatime/vim-wakatime", + 'wakatime/vim-wakatime', cond = vim.g.usewakatime, }, { -- Link following - "chrishrb/gx.nvim", + 'chrishrb/gx.nvim', lazy = true, - cmd = require("data.cmd").gx, - keys = require("data.keys").gx, + cmd = require('data.cmd').gx, + keys = require('data.keys').gx, init = function() vim.g.netrw_nogx = 1 end, - dependencies = require("data.deps").gx, + dependencies = require('data.deps').gx, config = true, }, { -- Ripgrep substitute - "chrisgrieser/nvim-rip-substitute", - event = "InsertEnter", - cmd = require("data.cmd").ripsub, - keys = require("data.keys").ripsub, + 'chrisgrieser/nvim-rip-substitute', + event = 'InsertEnter', + cmd = require('data.cmd').ripsub, + keys = require('data.keys').ripsub, }, { -- Unception - "samjwill/nvim-unception", + 'samjwill/nvim-unception', init = function() vim.g.unception_block_while_host_edits = true end, }, { -- Codesnap - "mistricky/codesnap.nvim", - cond = require("data.func").check_global_var("codesnap", true, true), + 'mistricky/codesnap.nvim', + cond = require('data.func').check_global_var('codesnap', true, true), lazy = true, - build = "make", - opts = require("data.types").codesnap, - cmd = require("data.cmd").codesnap, - keys = require("data.keys").codesnap, + build = 'make', + opts = require('data.types').codesnap, + cmd = require('data.cmd').codesnap, + keys = require('data.keys').codesnap, }, { -- Kulala - "mistweaverco/kulala.nvim", - ft = require("data.types").kulala.ft, + 'mistweaverco/kulala.nvim', + ft = require('data.types').kulala.ft, opts = {}, }, { -- Hardtime - "m4xshen/hardtime.nvim", - dependencies = require("data.deps").hardtime, + 'm4xshen/hardtime.nvim', + lazy = false, + dependencies = require('data.deps').hardtime, opts = function() return { enabled = vim.g.usehardtime } end, }, { -- CapsWord - "dmtrKovalenko/caps-word.nvim", + 'dmtrKovalenko/caps-word.nvim', lazy = true, opts = {}, - keys = require("data.keys").capsword, + keys = require('data.keys').capsword, }, { -- Music Controls - "AntonVanAssche/music-controls.nvim", - cond = require("data.func").check_global_var("usemusic", true, true), - dependencies = require("data.deps").musiccontrols, + 'AntonVanAssche/music-controls.nvim', + cond = require('data.func').check_global_var('usemusic', true, true), + dependencies = require('data.deps').musiccontrols, opts = { - default_player = "YoutubeMusic", + default_player = 'YoutubeMusic', }, }, { -- Qalc - "Apeiros-46B/qalc.nvim", - cmd = require("data.cmd").qalc, - keys = require("data.keys").qalc, + 'Apeiros-46B/qalc.nvim', + cmd = require('data.cmd').qalc, + keys = require('data.keys').qalc, opts = { - bufname = "qalc", - set_ft = "qalc", - yank_default_register = "+", + bufname = 'qalc', + set_ft = 'qalc', + yank_default_register = '+', diagnostics = { underline = true, virtual_text = true, @@ -105,54 +106,54 @@ return { }, }, { -- Remote-nvim - "amitds1997/remote-nvim.nvim", + 'amitds1997/remote-nvim.nvim', lazy = true, - version = "*", -- Pin to GitHub releases - dependencies = require("data.deps").remotenvim, + version = '*', -- Pin to GitHub releases + dependencies = require('data.deps').remotenvim, config = true, }, { -- Encourage - "r-cha/encourage.nvim", - cond = require("data.func").check_global_var("encourage", true, true), + 'r-cha/encourage.nvim', + cond = require('data.func').check_global_var('encourage', true, true), config = true, }, { -- Helpview - "OXY2DEV/helpview.nvim", - ft = "help", - dependencies = require("data.deps").needs_treesitter, + 'OXY2DEV/helpview.nvim', + ft = 'help', + dependencies = require('data.deps').needs_treesitter, }, { -- Suda - "lambdalisue/vim-suda", - cmd = require("data.cmd").suda, - config = require("data.types").suda, + 'lambdalisue/vim-suda', + cmd = require('data.cmd').suda, + config = require('data.types').suda, }, -- { -- Pigeon -- "Pheon-Dev/pigeon", -- config = require('data.types').pigeon, -- }, { -- Discord Presence - "IogaMaster/neocord", - event = "VeryLazy", - cond = require("data.func").check_global_var("usediscord", true, true), + 'IogaMaster/neocord', + event = 'VeryLazy', + cond = require('data.func').check_global_var('usediscord', true, true), opts = { - logo = "https://raw.githubusercontent.com/rootiest/rootiest-nvim/b949af32e72db9fc35c18e14e2088710dc36dd15/logo/icon.png", - main_image = "logo", - blacklist = { "bin: No such file or directory" }, + logo = 'https://raw.githubusercontent.com/rootiest/rootiest-nvim/b949af32e72db9fc35c18e14e2088710dc36dd15/logo/icon.png', + main_image = 'logo', + blacklist = { 'bin: No such file or directory' }, file_assets = {}, }, }, { -- Floating Help - "Tyler-Barham/floating-help.nvim", + 'Tyler-Barham/floating-help.nvim', opts = { width = 0.8, -- Whole numbers are columns/rows height = 0.9, -- Decimals are a percentage of the editor - position = "C", -- NW,N,NW,W,C,E,SW,S,SE (C==center) - border = "rounded", -- rounded,double,single + position = 'C', -- NW,N,NW,W,C,E,SW,S,SE (C==center) + border = 'rounded', -- rounded,double,single }, cmd = { - "FloatingHelp", - "FloatingHelpClose", - "FloatingHelpToggle", + 'FloatingHelp', + 'FloatingHelpClose', + 'FloatingHelpToggle', }, init = function() vim.g.floating_help = true @@ -161,7 +162,7 @@ return { ---@param abbrev string The abbreviation to replace ---@param expansion string The expansion to replace it with local function cmd_abbrev(abbrev, expansion) - local cmd = "cabbr " + local cmd = 'cabbr ' .. abbrev .. ' =(getcmdpos() == 1 && getcmdtype() == ":" ? "' .. expansion @@ -171,18 +172,18 @@ return { vim.cmd(cmd) end -- Replace native help commands with floating help - cmd_abbrev("h", "FloatingHelp") - cmd_abbrev("help", "FloatingHelp") - cmd_abbrev("helpc", "FloatingHelpClose") - cmd_abbrev("helpclose", "FloatingHelpClose") + cmd_abbrev('h', 'FloatingHelp') + cmd_abbrev('help', 'FloatingHelp') + cmd_abbrev('helpc', 'FloatingHelpClose') + cmd_abbrev('helpclose', 'FloatingHelpClose') end, }, { -- Timer - "alex-popov-tech/timer.nvim", + 'alex-popov-tech/timer.nvim', }, { -- Image-Clip - "HakonHarnes/img-clip.nvim", - event = "VeryLazy", + 'HakonHarnes/img-clip.nvim', + event = 'VeryLazy', opts = { default = { embed_image_as_base64 = false, @@ -196,10 +197,10 @@ return { }, }, { -- Multicursor - "jake-stewart/multicursor.nvim", - branch = "1.0", + 'jake-stewart/multicursor.nvim', + branch = '1.0', config = function() - local mc = require("multicursor-nvim") + local mc = require('multicursor-nvim') mc.setup({ -- set to true if you want multicursor undo history @@ -207,37 +208,37 @@ return { shallowUndo = false, -- set to empty table to disable signs - signs = { "⎸", "󰇀", "⎹" }, + signs = { '⎸', '󰇀', '⎹' }, }) end, }, { - "itsvinayak/nvim-notes.nvim", + 'itsvinayak/nvim-notes.nvim', dependencies = { - "nvim-telescope/telescope.nvim", -- Add Telescope as a dependency - "folke/which-key.nvim", -- Add WhichKey as a dependency + 'nvim-telescope/telescope.nvim', -- Add Telescope as a dependency + 'folke/which-key.nvim', -- Add WhichKey as a dependency }, config = function() - require("notes").setup({ + require('notes').setup({ -- Optional configurations - path = "~/.my_notes", -- Custom path for notes + path = '~/.my_notes', -- Custom path for notes log_enabled = true, -- Enable logging - log_level = "INFO", -- Set log level to INFO + log_level = 'INFO', -- Set log level to INFO }) end, }, { -- FloatTerm - "voldikss/vim-floaterm", + 'voldikss/vim-floaterm', }, { -- bufferlist - "EL-MASTOR/bufferlist.nvim", + 'EL-MASTOR/bufferlist.nvim', lazy = true, - keys = { { "bl", desc = "Open bufferlist" } }, -- keymap to load the plugin, it should be the same as keymap.open_buflist + keys = { { 'bl', desc = 'Open bufferlist' } }, -- keymap to load the plugin, it should be the same as keymap.open_buflist opts = {}, }, { -- showkeys - "nvchad/showkeys", - cmd = "ShowkeysToggle", + 'nvchad/showkeys', + cmd = 'ShowkeysToggle', opts = { timeout = 1, maxkeys = 5, @@ -245,13 +246,20 @@ return { }, }, { - "stevearc/oil.nvim", + 'stevearc/oil.nvim', ---@module 'oil' ---@type oil.SetupOpts opts = {}, -- Optional dependencies - dependencies = { { "echasnovski/mini.icons", opts = {} } }, + dependencies = { { 'echasnovski/mini.icons', opts = {} } }, -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons }, - { "https://codeberg.org/jrop/u.nvim/", lazy = true }, + { -- Utlitities Framework + 'jrop/u.nvim', + lazy = true, + }, + { -- Co-op (Neovim Co-routines Framework) + 'gregorias/coop.nvim', + lazy = false, + }, } diff --git a/stylua.toml b/stylua.toml index 54a814e..ca7ff71 100644 --- a/stylua.toml +++ b/stylua.toml @@ -2,4 +2,4 @@ column_width = 80 indent_type = "Spaces" indent_width = 2 line_endings = "Unix" -quote_style = "AutoPreferDouble" +quote_style = "AutoPreferSingle"