refactor: centralize configuration data to require data module
This commit is contained in:
+1
-42
@@ -11,48 +11,7 @@ return {
|
||||
silent = true,
|
||||
debounce = false,
|
||||
},
|
||||
keys = {
|
||||
{ -- Accept suggestion
|
||||
"<c-y>",
|
||||
function()
|
||||
require("neocodeium").accept()
|
||||
end,
|
||||
desc = "Accept suggestion",
|
||||
mode = "i",
|
||||
},
|
||||
{ -- Accept word
|
||||
"<c-w>",
|
||||
function()
|
||||
require("neocodeium").accept_word()
|
||||
end,
|
||||
desc = "Accept word",
|
||||
mode = "i",
|
||||
},
|
||||
{ -- Accept line
|
||||
"<c-l>",
|
||||
function()
|
||||
require("neocodeium").accept_line()
|
||||
end,
|
||||
desc = "Accept line",
|
||||
mode = "i",
|
||||
},
|
||||
{ -- Cycle or complete (previous)
|
||||
"<c-p>",
|
||||
function()
|
||||
require("neocodeium").cycle_or_complete(-1)
|
||||
end,
|
||||
desc = "Cycle or complete (previous)",
|
||||
mode = "i",
|
||||
},
|
||||
{ -- Cycle or complete (next)
|
||||
"<c-n>",
|
||||
function()
|
||||
require("neocodeium").cycle_or_complete()
|
||||
end,
|
||||
desc = "Cycle or complete (next)",
|
||||
mode = "i",
|
||||
},
|
||||
},
|
||||
keys = require("data.keys").neocodeium,
|
||||
},
|
||||
{ -- Copilot
|
||||
import = "lazyvim.plugins.extras.coding.copilot",
|
||||
|
||||
+1
-2
@@ -59,7 +59,6 @@ return {
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
local neocodeium = require("neocodeium")
|
||||
local commands = require("neocodeium.commands")
|
||||
|
||||
@@ -154,7 +153,7 @@ return {
|
||||
})
|
||||
|
||||
-- List of filetypes to disable completion
|
||||
local disabled_filetypes = { "dashboard", "qalc" }
|
||||
local disabled_filetypes = require("data.types").cmp
|
||||
for _, filetype in ipairs(disabled_filetypes) do
|
||||
cmp.setup.filetype(filetype, {
|
||||
sources = {},
|
||||
|
||||
@@ -18,9 +18,7 @@ return {
|
||||
{ -- Bufferline
|
||||
"akinsho/bufferline.nvim",
|
||||
opts = {
|
||||
options = {
|
||||
separator_style = "slant",
|
||||
},
|
||||
options = require("data.types").bufferline,
|
||||
},
|
||||
},
|
||||
{ -- Which-Key
|
||||
|
||||
+29
-118
@@ -9,46 +9,23 @@ return {
|
||||
{ -- Octo plugin
|
||||
import = "lazyvim.plugins.extras.util.octo",
|
||||
},
|
||||
{ -- DiffView
|
||||
"sindrets/diffview.nvim",
|
||||
lazy = true,
|
||||
cmd = require("data.cmd").diffview,
|
||||
},
|
||||
{ -- Gist Tools
|
||||
"Rawnly/gist.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"GistCreate",
|
||||
"GistCreateFromFile",
|
||||
"GistsList",
|
||||
},
|
||||
keys = {
|
||||
{ -- Create Gist
|
||||
"<leader>gnc",
|
||||
"<cmd>GistCreate<cr>",
|
||||
desc = "Create Gist",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
{ -- Find Gists
|
||||
"<leader>gnf",
|
||||
"<cmd>GistList<cr>",
|
||||
desc = "Find Gists",
|
||||
},
|
||||
},
|
||||
cmd = require("data.cmd").gist,
|
||||
keys = require("data.keys").gist,
|
||||
config = true,
|
||||
},
|
||||
{ -- LazyGit
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
keys = {
|
||||
{ -- LazyGit
|
||||
"<leader>lg",
|
||||
"<cmd>LazyGit<cr>",
|
||||
desc = "LazyGit",
|
||||
},
|
||||
},
|
||||
cmd = require("data.cmd").lazygit,
|
||||
keys = require("data.keys").lazygit,
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
@@ -60,12 +37,7 @@ return {
|
||||
{ -- Thanks/github-stars
|
||||
"jsongerber/thanks.nvim",
|
||||
lazy = true,
|
||||
cmd = {
|
||||
"ThanksAll",
|
||||
"ThanksGithubAuth",
|
||||
"ThanksGithubLogout",
|
||||
"ThanksClearCache",
|
||||
},
|
||||
cmd = require("data.cmd").thanks,
|
||||
opts = {
|
||||
star_on_install = false,
|
||||
},
|
||||
@@ -73,22 +45,9 @@ return {
|
||||
{ -- GitLinker
|
||||
"linrongbin16/gitlinker.nvim",
|
||||
lazy = true,
|
||||
cmd = "GitLink",
|
||||
cmd = require("data.cmd").gitlinker,
|
||||
opts = {},
|
||||
keys = {
|
||||
{ -- Yank git link
|
||||
"<leader>gy",
|
||||
"<cmd>GitLink<cr>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Yank git link",
|
||||
},
|
||||
{ -- Open git link
|
||||
"<leader>gY",
|
||||
"<cmd>GitLink!<cr>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Open git link",
|
||||
},
|
||||
},
|
||||
keys = require("data.keys").gitlinker,
|
||||
},
|
||||
{ -- Git Blame
|
||||
"f-person/git-blame.nvim",
|
||||
@@ -97,84 +56,46 @@ return {
|
||||
-- Get the current lualine configuration
|
||||
local config = require("lualine").get_config()
|
||||
local git_blame = require("gitblame")
|
||||
local rootilities = require("utils.rootiest")
|
||||
local utils = require("utils.rootiest")
|
||||
-- Define the width limit for displaying the Git blame component
|
||||
local width_limit = 180 -- Adjust this value as needed
|
||||
-- Add Git-blame to lualine_c section
|
||||
table.insert(config.sections.lualine_c, {
|
||||
git_blame.get_current_blame_text,
|
||||
cond = function() -- Only show the component if the text is available
|
||||
cond = function() -- Only show if text is available
|
||||
return git_blame.is_blame_text_available()
|
||||
and rootilities.is_window_wide_enough(width_limit)
|
||||
and utils.is_window_wide_enough(width_limit)
|
||||
end,
|
||||
color = { fg = rootilities.get_fg_color("GitSignsCurrentLineBlame") },
|
||||
color = { fg = utils.get_fg_color("GitSignsCurrentLineBlame") },
|
||||
})
|
||||
-- Apply the lualine configuration
|
||||
require("lualine").setup(config)
|
||||
-- Define git-blame options
|
||||
local git_ops = {
|
||||
display_virtual_text = 0, -- Disable virtual text
|
||||
date_format = "%r", -- Relative date format
|
||||
message_when_not_committed = " Not yet committed",
|
||||
message_template = "<author> • <date> • <summary>",
|
||||
}
|
||||
-- Return the git-blame options
|
||||
return git_ops
|
||||
return require("data.types").gitblame
|
||||
end,
|
||||
},
|
||||
{ -- Git Graph
|
||||
"isakbm/gitgraph.nvim",
|
||||
opts = {
|
||||
symbols = {
|
||||
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 = "",
|
||||
},
|
||||
symbols = require("data.types").gitgraph.symbols(),
|
||||
format = {
|
||||
timestamp = "%H:%M:%S %d-%m-%Y",
|
||||
fields = { "hash", "timestamp", "author", "branch_name", "tag" },
|
||||
timestamp = require("data.types").gitgraph.timestamp,
|
||||
fields = require("data.types").gitgraph.fields,
|
||||
},
|
||||
hooks = {
|
||||
-- Check diff of a commit
|
||||
on_select_commit = function(commit)
|
||||
print("selected commit:", 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)
|
||||
print("selected range:", from.hash, to.hash)
|
||||
vim.notify("DiffviewOpen " .. from.hash .. "~1.." .. to.hash)
|
||||
vim.cmd(":DiffviewOpen " .. from.hash .. "~1.." .. to.hash)
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ -- gitgraph_toggle
|
||||
"<leader>gm",
|
||||
function()
|
||||
require("utils.git").gitgraph_toggle()
|
||||
end,
|
||||
desc = "GitGraph - Toggle",
|
||||
},
|
||||
},
|
||||
keys = require("data.keys").gitgraph,
|
||||
},
|
||||
{ -- FuGit
|
||||
"SuperBo/fugit2.nvim",
|
||||
@@ -189,17 +110,7 @@ return {
|
||||
dependencies = { "stevearc/dressing.nvim" },
|
||||
},
|
||||
},
|
||||
cmd = {
|
||||
"Fugit2",
|
||||
"Fugit2Diff",
|
||||
"Fugit2Graph",
|
||||
},
|
||||
keys = {
|
||||
{ -- Open Fugit
|
||||
"<leader>F",
|
||||
mode = "n",
|
||||
"<cmd>Fugit2<cr>",
|
||||
},
|
||||
},
|
||||
cmd = require("data.cmd").fugit,
|
||||
keys = require("data.keys").fugit,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ return {
|
||||
},
|
||||
{ -- Image Renderer
|
||||
"3rd/image.nvim",
|
||||
ft = "markdown",
|
||||
ft = require("data.types").image,
|
||||
config = function()
|
||||
require("image").setup()
|
||||
end,
|
||||
@@ -27,64 +27,20 @@ return {
|
||||
{ -- ToggleTerm
|
||||
"akinsho/toggleterm.nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ -- Toggle Terminal
|
||||
"<c-/>",
|
||||
"<cmd>ToggleTerm<cr>",
|
||||
desc = "Toggle Terminal",
|
||||
mode = "n",
|
||||
},
|
||||
},
|
||||
keys = require("data.keys").toggleterm,
|
||||
config = function()
|
||||
require("toggleterm").setup({
|
||||
-- size can be a number or function which is passed the current terminal
|
||||
size = function(term)
|
||||
if term.direction == "horizontal" then
|
||||
return 10
|
||||
elseif term.direction == "vertical" then
|
||||
return vim.o.columns * 0.4
|
||||
end
|
||||
end,
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
autochdir = true,
|
||||
shade_terminals = false,
|
||||
start_in_insert = true,
|
||||
insert_mappings = true,
|
||||
terminal_mappings = true,
|
||||
persist_size = true,
|
||||
persist_mode = true,
|
||||
direction = "horizontal",
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
auto_scroll = true,
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
winblend = 3,
|
||||
title_pos = "center",
|
||||
},
|
||||
winbar = {
|
||||
enabled = true,
|
||||
name_formatter = function(term) -- term: Terminal
|
||||
return term.name
|
||||
end,
|
||||
},
|
||||
})
|
||||
require("toggleterm").setup(require("data.types").toggleterm)
|
||||
end,
|
||||
},
|
||||
{ -- Kitty-Runner
|
||||
"jghauser/kitty-runner.nvim",
|
||||
cond = function() -- Using Kitty
|
||||
local term = os.getenv("TERM") or ""
|
||||
local kit = string.find(term, "kitty")
|
||||
return kit ~= nil
|
||||
end,
|
||||
cond = require("data.func").is_kitty(),
|
||||
},
|
||||
{ -- Kitty-Scrollback
|
||||
"mikesmithgh/kitty-scrollback.nvim",
|
||||
enabled = true,
|
||||
lazy = true,
|
||||
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
|
||||
cmd = require("data.cmd").kitty_scrollback,
|
||||
event = { "User KittyScrollbackLaunch" },
|
||||
version = "*",
|
||||
config = function() -- Using Kitty-Scrollback
|
||||
@@ -96,41 +52,12 @@ return {
|
||||
{ -- Nekifoch
|
||||
"NeViRAIDE/nekifoch.nvim",
|
||||
lazy = true,
|
||||
cmd = "Nekifoch",
|
||||
cmd = require("data.cmd").nekifoch,
|
||||
opts = {
|
||||
kitty_conf_path = vim.env.HOME .. "/.kittyoverrides",
|
||||
},
|
||||
keys = {
|
||||
{ -- List Fonts
|
||||
"<leader>u,l",
|
||||
"<cmd>Nekifoch list<cr>",
|
||||
desc = "Fonts list",
|
||||
},
|
||||
{ -- Check Font
|
||||
"<leader>u,c",
|
||||
"<cmd>Nekifoch check<cr>",
|
||||
desc = "Check current font settings",
|
||||
},
|
||||
{ -- Set Font Family
|
||||
"<leader>u,f",
|
||||
function()
|
||||
require("nekifoch.nui_set_font")()
|
||||
end,
|
||||
desc = "Set font family",
|
||||
},
|
||||
{ -- Set Font Size
|
||||
"<leader>u,s",
|
||||
function()
|
||||
require("nekifoch.nui_set_size")()
|
||||
end,
|
||||
desc = "Set font size",
|
||||
},
|
||||
},
|
||||
cond = function() -- Using Kitty
|
||||
local term = os.getenv("TERM") or ""
|
||||
local kit = string.find(term, "kitty")
|
||||
return kit ~= nil
|
||||
end,
|
||||
keys = require("data.keys").nekifoch,
|
||||
cond = require("data.func").is_kitty(),
|
||||
},
|
||||
{ -- WezTerm
|
||||
"willothy/wezterm.nvim",
|
||||
@@ -145,17 +72,6 @@ return {
|
||||
config = function()
|
||||
return require("tmux").setup()
|
||||
end,
|
||||
cond = function() -- Using Tmux
|
||||
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
|
||||
return true
|
||||
end
|
||||
end
|
||||
end,
|
||||
cond = require("data.func").is_tmux(),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ return {
|
||||
"xiyaowong/transparent.nvim",
|
||||
lazy = true,
|
||||
config = true,
|
||||
|
||||
keys = {
|
||||
{
|
||||
"<leader>wt",
|
||||
@@ -158,9 +159,6 @@ return {
|
||||
)
|
||||
end,
|
||||
},
|
||||
cond = function() -- Not Using SSH
|
||||
local ssh = os.getenv("SSH_TTY") or false
|
||||
return not ssh
|
||||
end,
|
||||
cond = not require("data.func").is_ssh(),
|
||||
},
|
||||
}
|
||||
|
||||
+11
-89
@@ -16,15 +16,8 @@ return {
|
||||
{ -- Link following
|
||||
"chrishrb/gx.nvim",
|
||||
lazy = true,
|
||||
cmd = { "Browse" },
|
||||
keys = {
|
||||
{ -- Open URL/Link
|
||||
"gx",
|
||||
"<cmd>Browse<cr>",
|
||||
mode = { "n", "x" },
|
||||
desc = "Open URL/Link",
|
||||
},
|
||||
},
|
||||
cmd = require("data.cmd").gx,
|
||||
keys = require("data.keys").gx,
|
||||
init = function()
|
||||
vim.g.netrw_nogx = 1
|
||||
end,
|
||||
@@ -33,7 +26,7 @@ return {
|
||||
},
|
||||
{ -- Auto-save
|
||||
"okuuva/auto-save.nvim",
|
||||
cmd = "ASToggle",
|
||||
cmd = require("data.cmd").autosave,
|
||||
event = { "InsertLeave", "TextChanged" },
|
||||
opts = {
|
||||
execution_message = {
|
||||
@@ -44,17 +37,8 @@ return {
|
||||
{ -- Ripgrep substitute
|
||||
"chrisgrieser/nvim-rip-substitute",
|
||||
event = "InsertEnter",
|
||||
cmd = "RipSubstitute",
|
||||
keys = {
|
||||
{ -- Rip Substitute
|
||||
"<leader>fs",
|
||||
function()
|
||||
require("rip-substitute").sub()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Rip Substitute",
|
||||
},
|
||||
},
|
||||
cmd = require("data.cmd").ripsub,
|
||||
keys = require("data.keys").ripsub,
|
||||
},
|
||||
{ -- Unception
|
||||
"samjwill/nvim-unception",
|
||||
@@ -68,24 +52,7 @@ return {
|
||||
config = function()
|
||||
require("icon-picker").setup({ disable_legacy_commands = true })
|
||||
end,
|
||||
keys = {
|
||||
{ -- Pick Icon
|
||||
"<leader>Ii",
|
||||
"<cmd>IconPickerNormal<cr>",
|
||||
desc = "Pick Icon",
|
||||
},
|
||||
{ -- Yank Icon
|
||||
"<leader>Iy",
|
||||
"<cmd>IconPickerYank<cr>",
|
||||
desc = "Yank Icon",
|
||||
},
|
||||
{ -- Insert Icon in insert mode
|
||||
"<C-.>",
|
||||
"<cmd>IconPickerInsert<cr>",
|
||||
desc = "Insert Icon",
|
||||
mode = "i",
|
||||
},
|
||||
},
|
||||
keys = require("data.keys").iconpicker,
|
||||
},
|
||||
{ -- Codesnap
|
||||
"mistricky/codesnap.nvim",
|
||||
@@ -100,38 +67,8 @@ return {
|
||||
code_font_family = "Iosevka NF",
|
||||
code_font_size = 12,
|
||||
},
|
||||
cmd = {
|
||||
"CodeSnap",
|
||||
"CodeSnapSave",
|
||||
"CodeSnapHighlight",
|
||||
"CodeSnapASCII",
|
||||
},
|
||||
keys = {
|
||||
{ -- Save selected code snapshot into clipboard
|
||||
"<leader>cy",
|
||||
"<cmd>CodeSnap<cr>",
|
||||
desc = "Save selected code snapshot into clipboard",
|
||||
mode = "x",
|
||||
},
|
||||
{ -- Save selected code snapshot in ~/Pictures
|
||||
"<leader>cs",
|
||||
"<cmd>CodeSnapSave<cr>",
|
||||
desc = "Save selected code snapshot in ~/Pictures",
|
||||
mode = "x",
|
||||
},
|
||||
{ -- Highlight and snapshot selected code into clipboard
|
||||
"<leader>ch",
|
||||
"<cmd>CodeSnapHighlight<cr>",
|
||||
desc = "Highlight and snapshot selected code into clipboard",
|
||||
mode = "x",
|
||||
},
|
||||
{ -- Save ASCII code snapshot into clipboard
|
||||
"<leader>ci",
|
||||
"<cmd>CodeSnapASCII<cr>",
|
||||
desc = "Save ASCII code snapshot into clipboard",
|
||||
mode = "x",
|
||||
},
|
||||
},
|
||||
cmd = require("data.cmd").codesnap,
|
||||
keys = require("data.keys").codesnap,
|
||||
},
|
||||
{ -- Kulala
|
||||
"mistweaverco/kulala.nvim",
|
||||
@@ -151,16 +88,7 @@ return {
|
||||
"dmtrKovalenko/caps-word.nvim",
|
||||
lazy = true,
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<C-s>",
|
||||
function()
|
||||
require("caps-word").toggle()
|
||||
end,
|
||||
desc = "Toggle CapsWord",
|
||||
mode = { "i", "n" },
|
||||
},
|
||||
},
|
||||
keys = require("data.keys").capsword,
|
||||
},
|
||||
{ -- Music Controls
|
||||
"AntonVanAssche/music-controls.nvim",
|
||||
@@ -171,14 +99,8 @@ return {
|
||||
},
|
||||
{ -- Qalc
|
||||
"Apeiros-46B/qalc.nvim",
|
||||
cmd = {
|
||||
"Qalc",
|
||||
"QalcAttach",
|
||||
"QalcYank",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>qc", "<cmd>Qalc<cr>", desc = "Qalc" },
|
||||
},
|
||||
cmd = require("data.cmd").qalc,
|
||||
keys = require("data.keys").qalc,
|
||||
opts = {
|
||||
set_ft = "qalc",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user