351 lines
7.2 KiB
Lua
351 lines
7.2 KiB
Lua
-- editor.option 模块没有返回值,所以 require 之后返回 true,但可以引用模块中的全局变量
|
||
local ok, op = pcall(require, "editor.option")
|
||
if not ok then
|
||
print("editor.option load error")
|
||
end
|
||
|
||
local ghproxy = ""
|
||
if op then
|
||
ghproxy = op.ghproxy
|
||
end
|
||
-- stdpath('config') returns $HOME/.config/nvim
|
||
-- stdpath('data') returns $HOME/.local/share/nvim
|
||
|
||
-- Default lazypath
|
||
-- local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||
local config_path = vim.fn.stdpath('config')
|
||
local lazyroot = config_path .. '/nvim'
|
||
local lazypath = config_path .. '/lazy/lazy.nvim'
|
||
if not vim.loop.fs_stat(lazypath) then
|
||
-- bootstrap lazy.nvim
|
||
-- stylua: ignore
|
||
vim.fn.system({ "git", "clone", "--filter=blob:none", ghproxy .. "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||
end
|
||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||
|
||
local lazyopts = {
|
||
defaults = {
|
||
lazy = false,
|
||
},
|
||
|
||
git = {
|
||
-- defaults for the `Lazy log` command
|
||
-- log = { "-10" }, -- show the last 10 commits
|
||
log = { "-8" }, -- show commits from the last 3 days
|
||
timeout = 120, -- kill processes that take more than 2 minutes
|
||
url_format = ghproxy .. "https://github.com/%s.git",
|
||
-- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version,
|
||
-- then set the below to false. This should work, but is NOT supported and will
|
||
-- increase downloads a lot.
|
||
filter = true,
|
||
},
|
||
}
|
||
|
||
local function luasnip_build()
|
||
if vim.fn.has("win32") then
|
||
return "make install_jsregexp CC=clang.exe SHELL=C:\\Program Files\\Git\\usr\\bin\\bash.exe .SHELLFLAGS=-c"
|
||
end
|
||
return "make install_jsregexp"
|
||
end
|
||
|
||
local plugins = {
|
||
{
|
||
"nvim-lua/plenary.nvim",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"ahmedkhalf/project.nvim",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"nvim-telescope/telescope.nvim",
|
||
dependencies = {
|
||
"nvim-lua/plenary.nvim",
|
||
},
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"nvim-treesitter/nvim-treesitter",
|
||
event = "VeryLazy",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"nvim-treesitter/nvim-treesitter-context",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"williamboman/mason.nvim",
|
||
event = "VeryLazy",
|
||
lazy = true,
|
||
},
|
||
|
||
{
|
||
"williamboman/mason-lspconfig.nvim",
|
||
event = "VeryLazy",
|
||
lazy = true,
|
||
},
|
||
|
||
{
|
||
"OXY2DEV/markview.nvim",
|
||
lazy = false, -- Recommended
|
||
-- ft = "markdown" -- If you decide to lazy-load anyway
|
||
dependencies = {
|
||
"nvim-treesitter/nvim-treesitter",
|
||
"nvim-tree/nvim-web-devicons",
|
||
},
|
||
},
|
||
|
||
{
|
||
"nvimdev/lspsaga.nvim",
|
||
event = "VeryLazy",
|
||
lazy = true,
|
||
},
|
||
|
||
{
|
||
"neovim/nvim-lspconfig",
|
||
lazy = true,
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"nvim-lualine/lualine.nvim",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"akinsho/bufferline.nvim",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"kyazdani42/nvim-tree.lua",
|
||
event = "VeryLazy",
|
||
lazy = true,
|
||
},
|
||
|
||
{
|
||
"lukas-reineke/indent-blankline.nvim",
|
||
event = "VeryLazy",
|
||
main = "ibl",
|
||
opts = {},
|
||
lazy = true,
|
||
},
|
||
|
||
{
|
||
"mistweaverco/kulala.nvim",
|
||
opts = {}
|
||
},
|
||
|
||
{
|
||
"windwp/nvim-autopairs",
|
||
event = "InsertEnter",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"kylechui/nvim-surround",
|
||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||
event = "VeryLazy",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"phaazon/hop.nvim",
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"folke/trouble.nvim",
|
||
dependencies = {
|
||
"nvim-tree/nvim-web-devicons",
|
||
},
|
||
lazy = false,
|
||
},
|
||
|
||
-- {
|
||
-- "ishan9299/nvim-solarized-lua",
|
||
-- lazy = false,
|
||
-- },
|
||
{
|
||
"Tsuzat/NeoSolarized.nvim",
|
||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||
priority = 1000, -- make sure to load this before all the other start plugins
|
||
config = function()
|
||
-- vim.cmd [[ colorscheme NeoSolarized ]]
|
||
end
|
||
},
|
||
|
||
{
|
||
"folke/tokyonight.nvim",
|
||
lazy = false,
|
||
priority = 1000,
|
||
opts = {},
|
||
},
|
||
|
||
{
|
||
"folke/todo-comments.nvim",
|
||
dependencies = { "nvim-lua/plenary.nvim" },
|
||
opts = {
|
||
-- your configuration comes here
|
||
-- or leave it empty to use the default settings
|
||
-- refer to the configuration section below
|
||
}
|
||
},
|
||
{
|
||
"ray-x/go.nvim",
|
||
event = {"CmdlineEnter"},
|
||
ft = {"go", "gomod"},
|
||
lazy = true,
|
||
},
|
||
|
||
-- {
|
||
-- 'mrcjkb/rustaceanvim',
|
||
-- version = '^5', -- Recommended
|
||
-- lazy = false, -- This plugin is already lazy
|
||
-- },
|
||
|
||
{
|
||
"HiPhish/rainbow-delimiters.nvim",
|
||
event = "VeryLazy",
|
||
lazy = true,
|
||
dependencies = {
|
||
"nvim-treesitter/nvim-treesitter",
|
||
},
|
||
},
|
||
|
||
{
|
||
"numToStr/Comment.nvim",
|
||
event = "VeryLazy",
|
||
opts = {
|
||
-- add any options here
|
||
},
|
||
lazy = false,
|
||
},
|
||
|
||
{
|
||
"f-person/git-blame.nvim",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"lewis6991/gitsigns.nvim",
|
||
event = "VeryLazy",
|
||
config = function()
|
||
require('gitsigns').setup()
|
||
end
|
||
},
|
||
|
||
{
|
||
"goolord/alpha-nvim",
|
||
dependencies = {
|
||
"nvim-tree/nvim-web-devicons",
|
||
},
|
||
},
|
||
|
||
{
|
||
"rafamadriz/friendly-snippets",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"L3MON4D3/LuaSnip",
|
||
event = "VeryLazy",
|
||
-- follow latest release.
|
||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||
-- install jsregexp (optional!).
|
||
build = luasnip_build(),
|
||
dependencies = {
|
||
"rafamadriz/friendly-snippets",
|
||
}
|
||
},
|
||
|
||
{
|
||
"Vonr/align.nvim",
|
||
event = "VeryLazy",
|
||
branch = "v2",
|
||
lazy = true,
|
||
init = function()
|
||
-- Create your mappings here
|
||
end
|
||
},
|
||
|
||
{
|
||
"hrsh7th/cmp-nvim-lsp",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"hrsh7th/cmp-buffer",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"hrsh7th/cmp-path",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"hrsh7th/cmp-cmdline",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"hrsh7th/cmp-nvim-lua",
|
||
event = "VeryLazy",
|
||
},
|
||
|
||
{
|
||
"hrsh7th/nvim-cmp",
|
||
-- load cmp on InsertEnter
|
||
-- event = "InsertEnter",
|
||
event = "VeryLazy",
|
||
lazy = true,
|
||
-- these dependencies will only be loaded when cmp loads
|
||
-- dependencies are always lazy-loaded unless specified otherwise
|
||
dependencies = {
|
||
"hrsh7th/cmp-nvim-lsp",
|
||
"hrsh7th/cmp-buffer",
|
||
},
|
||
},
|
||
|
||
}
|
||
|
||
|
||
require("lazy").setup(plugins, lazyopts)
|
||
-- require("lazy").setup({
|
||
-- defaults = {
|
||
-- -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||
-- -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||
-- lazy = false,
|
||
-- -- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||
-- -- have outdated releases, which may break your Neovim install.
|
||
-- version = false, -- always use the latest git commit
|
||
-- -- version = "*", -- try installing the latest stable version for plugins that support semver
|
||
-- },
|
||
--
|
||
-- install = { colorscheme = { "tokyonight", "habamax" } },
|
||
-- checker = { enabled = true }, -- automatically check for plugin updates
|
||
-- performance = {
|
||
-- rtp = {
|
||
-- -- disable some rtp plugins
|
||
-- disabled_plugins = {
|
||
-- "gzip",
|
||
-- -- "matchit",
|
||
-- -- "matchparen",
|
||
-- -- "netrwPlugin",
|
||
-- "tarPlugin",
|
||
-- "tohtml",
|
||
-- "tutor",
|
||
-- "zipPlugin",
|
||
-- },
|
||
-- },
|
||
-- },
|
||
--
|
||
-- })
|
||
|