diff --git a/tools/nvim/lua/plugins/appearance.lua b/tools/nvim/lua/plugins/appearance.lua index 2a761dd..74b2ee6 100644 --- a/tools/nvim/lua/plugins/appearance.lua +++ b/tools/nvim/lua/plugins/appearance.lua @@ -21,8 +21,8 @@ return { variant = "dawn", }, }, - { "olimorris/onedarkpro.nvim" }, - { "rebelot/kanagawa.nvim" }, + { "olimorris/onedarkpro.nvim", cmd = "Telescope colorscheme" }, + { "rebelot/kanagawa.nvim", cmd = "Telescope colorscheme" }, -- Highlight objects under the cursor { "RRethy/vim-illuminate" }, { -- Modern Status Line diff --git a/tools/nvim/lua/plugins/completion.lua b/tools/nvim/lua/plugins/completion.lua index 6212e5b..eae382d 100644 --- a/tools/nvim/lua/plugins/completion.lua +++ b/tools/nvim/lua/plugins/completion.lua @@ -6,6 +6,7 @@ return { { "L3MON4D3/LuaSnip", build = "make install_jsregexp", + event = "InsertEnter", config = function() require("luasnip.loaders.from_vscode").lazy_load({ paths = "~/.config/lsp-snippets" }) -- require("luasnip.loaders.from_vscode").lazy_load() diff --git a/tools/nvim/lua/plugins/lsp.lua b/tools/nvim/lua/plugins/lsp.lua index afdd4e2..17ea00a 100644 --- a/tools/nvim/lua/plugins/lsp.lua +++ b/tools/nvim/lua/plugins/lsp.lua @@ -7,7 +7,8 @@ return { -- { import = "plugins.mod.markview" }, { "lervag/vimtex", - lazy = false, -- we don't want to lazy load VimTeX + ft = { "tex", "bib" }, + -- lazy = false, -- we don't want to lazy load VimTeX -- tag = "v2.15", -- uncomment to pin to a specific release init = function() -- VimTeX configuration goes here, e.g. @@ -45,13 +46,13 @@ return { }, { "akinsho/org-bullets.nvim", + ft = { "org" }, config = function() require("org-bullets").setup() end, }, { "nvim-orgmode/orgmode", - event = "VeryLazy", ft = { "org" }, config = function() -- Setup orgmode @@ -80,6 +81,14 @@ return { { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", + cmd = { + "TSInstall", + "TSUpdate", + "TSUpdateSync", + }, + event = { + "VeryLazy", + }, opts = { ensure_installed = { "markdown", "markdown_inline", "latex", "python" }, highlight = { enable = true }, diff --git a/tools/nvim/lua/plugins/misc.lua b/tools/nvim/lua/plugins/misc.lua index 2e9153c..db52927 100644 --- a/tools/nvim/lua/plugins/misc.lua +++ b/tools/nvim/lua/plugins/misc.lua @@ -25,6 +25,10 @@ return { { "kawre/leetcode.nvim", build = ":TSUpdate html", -- if you have `nvim-treesitter` installed + cmd = { + "Leet", + }, + event = "VeryLazy", dependencies = { "nvim-telescope/telescope.nvim", -- "ibhagwan/fzf-lua", diff --git a/tools/nvim/lua/plugins/mod/avante-nvim.lua b/tools/nvim/lua/plugins/mod/avante-nvim.lua index 1aceef1..8911077 100644 --- a/tools/nvim/lua/plugins/mod/avante-nvim.lua +++ b/tools/nvim/lua/plugins/mod/avante-nvim.lua @@ -1,7 +1,7 @@ return { "yetone/avante.nvim", - event = "VeryLazy", - lazy = false, + event = "BufRead", + -- lazy = false, version = false, -- Set this to "*" to always pull the latest release version, or set it to false to update to the latest code changes. opts = { -- add any opts here diff --git a/tools/nvim/lua/plugins/mod/image-nvim.lua b/tools/nvim/lua/plugins/mod/image-nvim.lua index 2c49010..b7255dc 100644 --- a/tools/nvim/lua/plugins/mod/image-nvim.lua +++ b/tools/nvim/lua/plugins/mod/image-nvim.lua @@ -9,6 +9,7 @@ elseif vim.env.TERM_PROGRAM == "alacritty" then else return { "3rd/image.nvim", - opts = {} + opts = {}, + event = "BufReadPre", } end diff --git a/tools/nvim/lua/plugins/mod/nvim-cmp.lua b/tools/nvim/lua/plugins/mod/nvim-cmp.lua index a86995c..e217f49 100644 --- a/tools/nvim/lua/plugins/mod/nvim-cmp.lua +++ b/tools/nvim/lua/plugins/mod/nvim-cmp.lua @@ -8,7 +8,8 @@ end return { "hrsh7th/nvim-cmp", - lazy = false, + -- lazy = false, + event = "InsertEnter", dependencies = { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", @@ -58,15 +59,32 @@ return { }) -- 配置 cmdline 模式 - cmp.setup.cmdline(":", { + -- cmp.setup.cmdline(":", { + -- mapping = cmp.mapping.preset.cmdline(), + -- sources = { + -- { name = "cmdline" }, + -- }, + -- }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ "/", "?" }, { mapping = cmp.mapping.preset.cmdline(), sources = { - { name = "cmdline" }, - -- path completion is slow under WSL - -- Since WSL loads Windows Environment Variables + { name = "buffer" }, }, }) + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + -- 配置 LSP for _, server in ipairs(servers) do local config = vim.tbl_deep_extend("force", default_server_config, servers_config[server] or {}) diff --git a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua index 600e3b2..edbd861 100644 --- a/tools/nvim/lua/plugins/mod/obsidian-nvim.lua +++ b/tools/nvim/lua/plugins/mod/obsidian-nvim.lua @@ -1,8 +1,35 @@ return { "epwalsh/obsidian.nvim", version = "*", -- recommended, use latest release instead of latest commit - lazy = false, + -- lazy = false, ft = "markdown", + + cmd = { + "ObsidianNewFromTemplate", + "ObsidianToggleCheckbox", + "ObsidianQuickSwitch", + "ObsidianExtractNote", + "ObsidianFollowLink", + "ObsidianBacklinks", + "ObsidianWorkspace", + "ObsidianYesterday", + "ObsidianPasteImg", + "ObsidianTomorrow", + "ObsidianTemplate", + "ObsidianDailies", + "ObsidianLinkNew", + "ObsidianRename", + "ObsidianSearch", + "ObsidianCheck", + "ObsidianLinks", + "ObsidianToday", + "ObsidianDebug", + "ObsidianOpen", + "ObsidianTags", + "ObsidianLink", + "ObsidianNew", + "ObsidianTOC", + }, -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: -- event = { -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. @@ -32,5 +59,11 @@ return { enable = false, }, -- see below for full list of options 👇 + attachments = { + img_folder = "_Global/Assets", + img_name_func = function() + return string.format("%s-", os.time()) + end, + }, }, }