perf(nvim): Apply lazy load for all plugins

This commit is contained in:
js0ny 2025-03-26 14:28:52 +00:00
parent 1716712787
commit 48331347fd
23 changed files with 274 additions and 203 deletions

View file

@ -143,7 +143,7 @@ readline:
[linux]
bash:
{{LN}} {{DOTFILES}}/tools/bash {{XDG_CONFIG_HOME}}/bash
sudo cp $DOTFILES/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh
sudo cp {{DOTFILES}}/tools/bash/xdg-compat.sh /etc/profile.d/xdg-compat.sh
[linux]
keyd:
@ -159,6 +159,16 @@ build_keyd:
git clone https://github.com/rvaiya/keyd $HOME/.local/build/keyd
cd $HOME/.local/build/keyd && make && sudo make install
[unix]
kitty:
which kitty
{{LN}} {{DOTFILES}}/tools/kitty {{XDG_CONFIG_HOME}}/kitty
[unix]
zotero:
curl -L https://github.com/syt2/zotero-addons/releases/download/V1.8.1/zotero-addons.xpi -o "$HOME/Downloads/zotero-addons.xpi"
[linux]
flatpak:
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

View file

@ -0,0 +1,10 @@
# Force to use English for directory names
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

View file

@ -8,9 +8,9 @@
# Set XDG Base Directory Path
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="~/.cache"
export XDG_DATA_HOME="~/.local/share"
export XDG_STATE_HOME="~/.local/state"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
# Source user's XDG-compliant Bash configs

View file

@ -5,24 +5,16 @@ local M = {}
-- Ensure that the following servers are installed and set
-- Use :Mason to list all available servers
M.servers = {
"ast_grep",
"bashls", -- Bash
"clangd", -- C/C++
"cssls", -- CSS
"denols", -- Deno
"eslint", -- JavaScript
"gopls", -- Go
"html", -- HTML
"jsonls", -- JSON
"lua_ls", -- Lua
"markdown_oxide", -- Markdown
"omnisharp", -- C# & F#
"powershell_es", -- PowerShell
-- "markdown_oxide", -- Markdown
"pyright", -- Python
"rust_analyzer", -- Rust
"svelte", -- Svelte
"svlangserver", -- SystemVerilog
"tailwindcss", -- TailwindCSS
"taplo", -- TOML
"ts_ls", -- TypeScript
"vimls", -- vimscript

View file

@ -90,7 +90,7 @@ local leader_mappings = {
{ keys = "s", cmd = ":write<CR>", opts = { desc = "Save File" } },
{ keys = "S", cmd = ":wall<CR>", opts = { desc = "Save All Files" } },
{ keys = "D", cmd = "!trash-rm %<CR>", opts = { desc = "Delete current file" } },
{ keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
-- { keys = "t", cmd = ":NvimTreeFindFileToggle<CR>", opts = { desc = "Toggle File Tree" } },
{ keys = "o", cmd = ":!open %<CR>", opts = { desc = "Open file in default program" } },
{ keys = "R", cmd = renameCurrentBuffer, opts = { desc = "Rename current file" } },
{ keys = "x", cmd = ":Lazy<CR>", opts = { desc = "Open extension view" } },

View file

@ -1,5 +1,7 @@
local M = {}
M.event = "BufEnter"
M.global = {
{ mode = "n", keys = "<leader>E", cmd = ":NvimTreeToggle<CR>" },
{ mode = "n", keys = "<A-0>", cmd = ":NvimTreeFindFileToggle<CR>" },

View file

@ -1,8 +1,19 @@
-- https://stackoverflow.com/a/73365602
vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("highlight_yank", {}),
desc = "Hightlight selection on yank",
pattern = "*",
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 500 })
end,
})
return {
-- Colorschemes
{
"catppuccin/nvim",
name = "catppuccin",
lazy = true,
opts = {
flavor = "auto",
background = {
@ -10,6 +21,7 @@ return {
dark = "mocha",
},
integrations = {
-- lualine = true,
"lualine",
},
},
@ -20,6 +32,7 @@ return {
opts = {
variant = "dawn",
},
cmd = "Telescope colorscheme",
},
-- { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" },
{ "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" },
@ -28,20 +41,22 @@ return {
{ -- Modern Status Line
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
event = "VeryLazy",
config = function()
require("plugins.mod.lualine")
end,
},
{ -- Highlight yanked text
"gbprod/yanky.nvim",
opts = {
highlight = {
on_put = true,
on_yank = true,
timer = 500,
},
},
},
-- { -- Highlight yanked text
-- "gbprod/yanky.nvim",
-- event = "LazyFile",
-- opts = {
-- highlight = {
-- on_put = true,
-- on_yank = true,
-- timer = 500,
-- },
-- },
-- },
-- { import = "plugins.mod.alpha-nvim" }, -- Dashboard
{ -- Breadcrumb
"Bekaboo/dropbar.nvim",
@ -88,6 +103,8 @@ return {
},
{ -- Highlight and navigate between TODOs
"folke/todo-comments.nvim",
cmd = { "TodoTelescope" },
event = "BufRead",
opts = {},
dependencies = { "nvim-lua/plenary.nvim" },
},

View file

@ -10,14 +10,10 @@ return {
event = "InsertEnter",
config = function()
require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" })
-- require("luasnip.loaders.from_vscode").lazy_load()
end,
},
{
"zbirenbaum/copilot-cmp",
opts = {},
-- config = function()
-- require("copilot_cmp").setup()
-- end,
},
-- {
-- "zbirenbaum/copilot-cmp",
-- opts = {},
-- },
}

View file

@ -2,6 +2,7 @@
return {
{
"mfussenegger/nvim-dap",
event = "BufReadPre",
config = function()
local dap = require("dap")
dap.adapters.codelldb = {
@ -28,10 +29,13 @@ return {
"rcarriga/nvim-dap-ui",
opts = {},
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
cmd = "DapNew",
},
{ "theHamsta/nvim-dap-virtual-text", opts = {} },
{ "theHamsta/nvim-dap-virtual-text", opts = {}, cmd = "DapNew" },
{
"mfussenegger/nvim-dap-python",
event = "BufReadPost",
ft = "python",
config = function()
require("dap-python").setup("uv")
end,

View file

@ -1,7 +1,7 @@
return {
{
"folke/flash.nvim",
event = "VeryLazy",
event = "BufEnter",
opts = {},
-- stylua: ignore
keys = {
@ -63,7 +63,7 @@ return {
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
event = "BufEnter",
opts = {},
},
{

View file

@ -1,17 +1,18 @@
return {
{
"rmagatti/auto-session",
lazy = false,
event = "BufReadPre",
opts = {
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
},
},
{ import = "plugins.mod.nvim-tree" },
-- { import = "plugins.mod.nvim-tree" },
{ import = "plugins.mod.telescope" },
-- { import = "plugins.mod.fzf" },
{
"ahmedkhalf/project.nvim",
event = "VeryLazy",
opts = {
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "Makefile", "package.json" },
@ -46,5 +47,14 @@ return {
-- },
{
"NeogitOrg/neogit",
-- dependencies = {
-- "nvim-lua/plenary.nvim", -- required
-- "nvim-telescope/telescope.nvim", -- optional
-- },
config = true,
-- event = "VeryLazy",
cmd = {
"Neogit",
},
},
}

View file

@ -12,6 +12,7 @@ return {
},
{
"js0ny/luasnip-latex-snippets.nvim",
ft = { "tex", "markdown" },
-- vimtex isn't required if using treesitter
requires = { "L3MON4D3/LuaSnip", "lervag/vimtex" },
config = function()
@ -20,10 +21,18 @@ return {
require("luasnip").config.setup({ enable_autosnippets = true })
end,
},
{ "williamboman/mason.nvim", config = true },
{
"williamboman/mason.nvim",
cmd = "Mason",
build = ":MasonUpdate",
opts_extend = { "ensure_installed" },
opts = {
ensure_installed = require("config.servers").servers,
},
},
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
event = "BufReadPre",
dependencies = {
{ "williamboman/mason.nvim" },
{ "neovim/nvim-lspconfig" },
@ -34,7 +43,7 @@ return {
},
},
{ import = "plugins.mod.conform-nvim" },
{ "nvim-treesitter/nvim-treesitter-context" },
{ "nvim-treesitter/nvim-treesitter-context", lazy = true },
{
"NoahTheDuke/vim-just",
ft = { "just" },
@ -58,9 +67,9 @@ return {
highlight = { enable = true },
indent = { enable = true },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
-- config = function(_, opts)
-- require("nvim-treesitter.configs").setup(opts)
-- end,
},
{
"folke/lazydev.nvim",

View file

@ -1,23 +1,24 @@
return {
{ "nvim-lua/plenary.nvim", lazy = true },
{ "wakatime/vim-wakatime", lazy = false },
{ import = "plugins.mod.toggleterm" },
{
"CRAG666/code_runner.nvim",
config = true,
keys = {
{ "<leader>cr", "<cmd>RunCode<CR>", desc = "Run code" },
},
dependencies = {
{
"CRAG666/betterTerm.nvim",
opts = {
position = "bot",
size = 15,
},
},
},
},
-- {
-- "CRAG666/code_runner.nvim",
-- config = true,
-- keys = {
-- { "<leader>cr", "<cmd>RunCode<CR>", desc = "Run code" },
-- },
-- dependencies = {
--
-- {
-- "CRAG666/betterTerm.nvim",
-- opts = {
-- position = "bot",
-- size = 15,
-- },
-- },
-- },
-- },
{ import = "plugins.mod.which-keys-nvim" },
{ import = "plugins.mod.copilot-lua" },
{ import = "plugins.mod.avante-nvim" },
@ -27,7 +28,8 @@ return {
cmd = {
"Leet",
},
event = "VeryLazy",
lazy = true,
-- event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope.nvim",
-- "ibhagwan/fzf-lua",

View file

@ -33,6 +33,8 @@ return {
-- support for image pasting
"HakonHarnes/img-clip.nvim",
event = "VeryLazy",
ft = { "avante", "markdown", "typst", "org", "tex" },
cmd = "PasteImage",
opts = {
-- recommended settings
default = {

View file

@ -1,10 +1,11 @@
return {
"saghen/blink.cmp",
-- optional: provides snippets for the snippet source
dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" },
-- dependencies = { "L3MON4D3/LuaSnip", version = "v2.*" },
-- use a release tag to download pre-built binaries
version = "*",
event = "InsertEnter",
---@module 'blink.cmp'
---@type blink.cmp.Config

View file

@ -10,7 +10,7 @@ return {
"akinsho/bufferline.nvim",
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
after = "catppuccin",
lazy = false,
event = "VeryLazy",
keys = {
{ "<leader>b1", "<cmd>BufferLineGotoBuffer 1<CR>", desc = "Switch to Buffer #1" },
{ "<leader>b2", "<cmd>BufferLineGotoBuffer 2<CR>", desc = "Switch to Buffer #2" },

View file

@ -2,5 +2,5 @@ return {
{ import = "plugins.mod.lang.markdown.render-markdown" },
-- { import = "plugins.mod.lang.markdown.markview" },
{ import = "plugins.mod.lang.markdown.obsidian-nvim" },
{ "bullets-vim/bullets.vim" },
{ "bullets-vim/bullets.vim", ft = "markdown" },
}

View file

@ -1,7 +1,7 @@
return {
{
"MeanderingProgrammer/render-markdown.nvim",
lazy = false,
event = "BufRead",
ft = { "markdown", "Avante" },
opts = {
file_types = { "markdown", "Avante" },

View file

@ -1,23 +1,23 @@
return {
{
-- "js0ny/nvim-orgmode",
name = "orgmode",
"nvim-orgmode/orgmode",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-orgmode/telescope-orgmode.nvim",
"nvim-orgmode/org-bullets.nvim",
"Saghen/blink.cmp",
},
branch = "feat-image-match-latex",
cmd = {
"Org",
},
ft = {
"org",
"orgagenda",
},
keys = {
{ "<leader>A", "<cmd>Org agenda<CR>", desc = "Org Agenda" },
},
dir = "~/Source/Forks/nvim-orgmode",
dev = true,
event = "VeryLazy",
event = "BufEnter *.org",
config = function()
require("orgmode").setup({
org_agenda_files = "~/OrgFiles/tasks/*",

View file

@ -14,7 +14,7 @@ Remote | Git Branch | Diagnostics | Command | | MID | | Line:Column | Indent | E
local config = {
options = {
disabled_filetypes = {
statusline = { "NvimTree", "alpha", "grug-far" },
statusline = { "NvimTree", "alpha", "grug-far", "snacks_dashboard" },
},
-- Disable sections and component separators
component_separators = { left = "", right = "" },

View file

@ -1,6 +1,11 @@
return {
"neovim/nvim-lspconfig",
dependencies = { "saghen/blink.cmp" },
event = {
"BufReadPost",
"BufWritePost",
"BufNewFile",
},
-- example using `opts` for defining servers
opts = {

View file

@ -7,17 +7,27 @@ return {
---@type snacks.Config
opts = {
-- bigfile = { enabled = true },
-- dashboard = { enabled = true },
-- explorer = { enabled = true },
-- indent = { enabled = true },
dashboard = { enabled = true },
explorer = { enabled = true },
indent = { enabled = true },
-- input = { enabled = true },
-- picker = { enabled = true },
-- notifier = { enabled = true },
-- quickfile = { enabled = true },
-- scope = { enabled = true },
-- scroll = { enabled = true },
-- statuscolumn = { enabled = true },
statuscolumn = { enabled = true },
-- words = { enabled = true },
image = { enabled = true },
},
keys = {
{
"<leader>ft",
function()
require("snacks").explorer()
end
,
desc = "Toggle File Explorer"
},
}
}

View file

@ -1,5 +1,6 @@
return {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
opts = {
defaults = {
prompt_prefix = require("config.icons").telescope,