Migrate nvim to lazy

This commit is contained in:
Shockwave 2024-01-27 21:00:10 +08:00
parent d12500995f
commit 9c247820ef
3 changed files with 358 additions and 83 deletions

View File

@ -8,7 +8,8 @@
require('neo.option')
-- packer plugin manager
-- NOTE: 建议将自己的配置文件保存在 lua 的子目录中,避免配置模块名和插件名同名时加载失败
require('neo.pkg')
require('neo.lazy')
-- require('neo.pkg')
require('neo.lspconf')
require('neo.lspmason')
require('neo.lspsaga')

View File

@ -1,87 +1,88 @@
local status_ok, indent_blankline = pcall(require, "indent_blankline")
local status_ok, indent_blankline = pcall(require, "ibl")
if not status_ok then
return
end
vim.g.indent_blankline_buftype_exclude = {
"terminal",
"nofile",
"quickfix",
"prompt",
}
vim.g.indent_blankline_filetype = {
'python',
'lua',
}
-- vim.g.indent_blankline_filetype_exclude = {
-- "alpha",
-- "dashboard",
-- "help",
-- "man",
-- "neogitstatus",
-- 'nerdtree',
-- 'vista',
-- "startify",
-- "packer",
-- "NvimTree",
-- "Trouble",
-- vim.g.indent_blankline_buftype_exclude = {
-- "terminal",
-- "nofile",
-- "quickfix",
-- "prompt",
-- }
vim.g.indentLine_enabled = 1
-- vim.g.indent_blankline_char = "│"
vim.g.indent_blankline_char = ""
-- vim.g.indent_blankline_char = "▎"
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = true
vim.g.indent_blankline_use_treesitter = true
vim.g.indent_blankline_show_current_context = true
vim.g.indent_blankline_context_patterns = {
"class",
"return",
"function",
"method",
"^if",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type",
}
-- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
vim.wo.colorcolumn = "99999"
-- vim.cmd [[highlight IndentBlanklineIndent1 fg=#E06C75 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent2 fg=#E5C07B gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent3 fg=#98C379 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent4 fg=#56B6C2 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent5 fg=#61AFEF gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent6 fg=#C678DD gui=nocombine]]
-- vim.opt.list = true
-- vim.opt.listchars:append "space:⋅"
-- vim.opt.listchars:append "space:"
-- vim.opt.listchars:append "eol:↴"
indent_blankline.setup({
-- show_end_of_line = true,
-- space_char_blankline = " ",
show_current_context = true,
-- show_current_context_start = true,
-- char_highlight_list = {
-- "IndentBlanklineIndent1",
-- "IndentBlanklineIndent2",
-- "IndentBlanklineIndent3",
-- },
show_trailing_blankline_indent = false,
})
--
-- vim.g.indent_blankline_filetype = {
-- 'python',
-- 'lua',
-- }
--
-- -- vim.g.indent_blankline_filetype_exclude = {
-- -- "alpha",
-- -- "dashboard",
-- -- "help",
-- -- "man",
-- -- "neogitstatus",
-- -- 'nerdtree',
-- -- 'vista',
-- -- "startify",
-- -- "packer",
-- -- "NvimTree",
-- -- "Trouble",
-- -- }
--
-- vim.g.indentLine_enabled = 1
-- -- vim.g.indent_blankline_char = "│"
-- vim.g.indent_blankline_char = "▏"
-- -- vim.g.indent_blankline_char = "▎"
-- vim.g.indent_blankline_show_trailing_blankline_indent = false
-- vim.g.indent_blankline_show_first_indent_level = true
-- vim.g.indent_blankline_use_treesitter = true
-- vim.g.indent_blankline_show_current_context = true
-- vim.g.indent_blankline_context_patterns = {
-- "class",
-- "return",
-- "function",
-- "method",
-- "^if",
-- "^while",
-- "jsx_element",
-- "^for",
-- "^object",
-- "^table",
-- "block",
-- "arguments",
-- "if_statement",
-- "else_clause",
-- "jsx_element",
-- "jsx_self_closing_element",
-- "try_statement",
-- "catch_clause",
-- "import_statement",
-- "operation_type",
-- }
-- -- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
-- vim.wo.colorcolumn = "99999"
--
-- -- vim.cmd [[highlight IndentBlanklineIndent1 fg=#E06C75 gui=nocombine]]
-- -- vim.cmd [[highlight IndentBlanklineIndent2 fg=#E5C07B gui=nocombine]]
-- -- vim.cmd [[highlight IndentBlanklineIndent3 fg=#98C379 gui=nocombine]]
-- -- vim.cmd [[highlight IndentBlanklineIndent4 fg=#56B6C2 gui=nocombine]]
-- -- vim.cmd [[highlight IndentBlanklineIndent5 fg=#61AFEF gui=nocombine]]
-- -- vim.cmd [[highlight IndentBlanklineIndent6 fg=#C678DD gui=nocombine]]
-- -- vim.opt.list = true
-- -- vim.opt.listchars:append "space:⋅"
-- -- vim.opt.listchars:append "space:"
-- -- vim.opt.listchars:append "eol:↴"
--
-- indent_blankline.setup({
-- -- show_end_of_line = true,
-- -- space_char_blankline = " ",
-- show_current_context = true,
-- -- show_current_context_start = true,
-- -- char_highlight_list = {
-- -- "IndentBlanklineIndent1",
-- -- "IndentBlanklineIndent2",
-- -- "IndentBlanklineIndent3",
-- -- },
-- show_trailing_blankline_indent = false,
-- })
--

View File

@ -0,0 +1,273 @@
-- 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", "https://mirror.ghproxy.com/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,
},
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import any extras modules here
-- { import = "lazyvim.plugins.extras.lang.typescript" },
-- { import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
-- import/override with your plugins
{ import = "plugins" },
},
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 = "https://mirror.ghproxy.com/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 plugins = {
{
"hrsh7th/nvim-cmp",
-- load cmp on InsertEnter
event = "InsertEnter",
-- 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",
},
},
{
"nvim-lua/plenary.nvim",
lazy = false,
},
{
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
lazy = false,
},
{
"nvim-treesitter/nvim-treesitter",
lazy = false,
},
{
"williamboman/mason.nvim",
lazy = false,
},
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
},
{
"nvimdev/lspsaga.nvim",
lazy = false,
},
{
"neovim/nvim-lspconfig",
lazy = false,
},
{
"nvim-lualine/lualine.nvim",
lazy = false,
},
{
"akinsho/bufferline.nvim",
lazy = false,
},
{
"kyazdani42/nvim-tree.lua",
lazy = false,
},
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {},
lazy = false,
},
{
"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,
},
{
"ray-x/go.nvim",
},
{
"simrat39/rust-tools.nvim",
ft = "rust",
lazy = true,
},
{
"HiPhish/nvim-ts-rainbow2",
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
},
-- {
-- "HiPhish/rainbow-delimiters.nvim",
-- lazy = false,
-- dependencies = {
-- "nvim-treesitter/nvim-treesitter",
-- },
-- },
{
'numToStr/Comment.nvim',
opts = {
-- add any options here
},
lazy = false,
},
{
"f-person/git-blame.nvim",
},
{
"lewis6991/gitsigns.nvim",
config = function()
require('gitsigns').setup()
end
},
{
"goolord/alpha-nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
},
{
"rafamadriz/friendly-snippets",
},
{
"L3MON4D3/LuaSnip",
-- follow latest release.
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp",
dependencies = {
"rafamadriz/friendly-snippets",
}
},
{
"hrsh7th/nvim-cmp",
},
{
"hrsh7th/cmp-path",
},
{
"hrsh7th/cmp-buffer",
},
-- {
-- "saadparwaiz1/cmp_luasnip",
-- },
{
"hrsh7th/cmp-nvim-lsp",
},
{
"hrsh7th/cmp-nvim-lua",
},
}
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",
-- },
-- },
-- },
--
-- })