123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- -- 自动安装 Packer.nvim
- -- 插件安装目录
- -- ~/.local/share/nvim/site/pack/packer/
- local fn = vim.fn
- local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
- local paccker_bootstrap
- if fn.empty(fn.glob(install_path)) > 0 then
- vim.notify("正在安装Pakcer.nvim,请稍后...")
- paccker_bootstrap = fn.system({
- "git",
- "clone",
- "--depth",
- "1",
- "https://github.com/wbthomason/packer.nvim",
- -- "https://gitcode.net/mirrors/wbthomason/packer.nvim",
- install_path,
- })
- -- https://github.com/wbthomason/packer.nvim/issues/750
- local rtp_addition = vim.fn.stdpath("data") .. "/site/pack/*/start/*"
- if not string.find(vim.o.runtimepath, rtp_addition) then
- vim.o.runtimepath = rtp_addition .. "," .. vim.o.runtimepath
- end
- vim.notify("Pakcer.nvim 安装完毕")
- end
- -- Use a protected call so we don't error out on first use
- local status_ok, packer = pcall(require, "packer")
- if not status_ok then
- vim.notify("没有安装 packer.nvim")
- return
- end
- packer.startup({
- function(use)
- -- Packer 可以管理自己本身
- use("wbthomason/packer.nvim")
- -- 底部状态栏
- use({
- "nvim-lualine/lualine.nvim",
- requires = {
- "nvim-tree/nvim-web-devicons",
- opt = true,
- },
- })
- use("nvim-tree/nvim-web-devicons")
- -- tokyonight 主题
- use("folke/tokyonight.nvim")
- -- nvim-tree 文件侧边栏
- use({
- "kyazdani42/nvim-tree.lua",
- requires = "kyazdani42/nvim-web-devicons",
- })
- -- 文件搜索
- use({
- "nvim-telescope/telescope.nvim",
- requires = { "nvim-lua/plenary.nvim" },
- })
- -- dashboard-nvim vim 主页
- use({
- "glepnir/dashboard-nvim",
- requires = { "nvim-tree/nvim-web-devicons" },
- })
- -- 悬浮终端
- use("voldikss/vim-floaterm")
- -- project
- use("ahmedkhalf/project.nvim")
- -- treesitter 代码高亮
- use({
- "nvim-treesitter/nvim-treesitter",
- run = ":TSUpdate",
- requires = {
- { "p00f/nvim-ts-rainbow" },
- { "JoosepAlviste/nvim-ts-context-commentstring" },
- { "windwp/nvim-ts-autotag" },
- { "nvim-treesitter/nvim-treesitter-refactor" },
- { "nvim-treesitter/nvim-treesitter-textobjects" },
- },
- config = function()
- require("plugin-config.nvim-treesitter")
- end,
- })
- use("nvim-treesitter/nvim-tree-docs")
- --------------------- LSP --------------------
- -- use({
- -- "neoclide/coc.nvim",
- -- branch = "release",
- -- })
- -- mason
- use({
- "williamboman/mason.nvim",
- run = ":MasonUpdate", -- :MasonUpdate updates registry contents
- })
- use("jay-babu/mason-null-ls.nvim")
- use("williamboman/mason-lspconfig.nvim")
- use({ "neovim/nvim-lspconfig" })
- use("hrsh7th/nvim-cmp") -- completion plugin
- use("hrsh7th/cmp-nvim-lsp")
- use("onsails/lspkind.nvim")
- -- 自动关闭标签
- use({ "windwp/nvim-ts-autotag" })
- -- snippet 引擎
- use({ "saadparwaiz1/cmp_luasnip" })
- use({ "L3MON4D3/LuaSnip", run = "make install_jsregexp" })
- -- 补全源
- use("hrsh7th/vim-vsnip")
- use("hrsh7th/cmp-vsnip")
- --use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp }
- use("hrsh7th/cmp-buffer") -- { name = 'buffer' },
- use("hrsh7th/cmp-path") -- { name = 'path' }
- use("hrsh7th/cmp-cmdline") -- { name = 'cmdline' }
- -- 常见编程语言代码段
- use("rafamadriz/friendly-snippets")
- -- git
- use({ "lewis6991/gitsigns.nvim" })
- -- lazygit
- use({
- "kdheepak/lazygit.nvim",
- -- optional for floating window border decoration
- requires = {
- "nvim-lua/plenary.nvim",
- },
- })
- -- eslint
- use("MunifTanjim/eslint.nvim")
- -- indent
- use("lukas-reineke/indent-blankline.nvim")
- -- 闭合高亮
- use("leafOfTree/vim-matchtag")
- -- 切换窗口大小
- use("szw/vim-maximizer")
- -- 错误提示
- use({ "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons" })
- -- 括号自动补全
- use({
- "windwp/nvim-autopairs",
- config = function()
- require("nvim-autopairs").setup({})
- end,
- })
- -- 代码注释 gcc
- use({
- "numToStr/Comment.nvim",
- config = function()
- require("Comment").setup()
- end,
- })
- -- hop 快速跳转
- use({
- "phaazon/hop.nvim",
- branch = "v2", -- optional but strongly recommended
- config = function()
- -- you can configure Hop the way you like here; see :h hop-config
- require("hop").setup({ keys = "etovxqpdygfblzhckisuran" })
- end,
- })
- -- lspsage
- use("tami5/lspsaga.nvim")
- -- TypeScript 增强
- use({ "jose-elias-alvarez/nvim-lsp-ts-utils", requires = "nvim-lua/plenary.nvim" })
- use("jose-elias-alvarez/typescript.nvim")
- -- 代码格式化
- use("MunifTanjim/prettier.nvim")
- use("mhartington/formatter.nvim")
- use({ "jose-elias-alvarez/null-ls.nvim", requires = "nvim-lua/plenary.nvim" })
- -- lua 增强
- use("folke/neodev.nvim")
- --json 增强
- use("b0o/schemastore.nvim")
- -- Rust 增强
- use("simrat39/rust-tools.nvim")
- -- 彩虹括号
- use("p00f/nvim-ts-rainbow")
- -- nvim-notify
- use({
- "rcarriga/nvim-notify",
- config = function()
- require("plugin-config.nvim-notify")
- end,
- })
- -- fidget.nvim
- use({
- "j-hui/fidget.nvim",
- config = function()
- require("plugin-config.fidget")
- end,
- })
- -- 颜色高亮
- use("norcalli/nvim-colorizer.lua")
- use({
- "folke/noice.nvim",
- requires = {
- { "MunifTanjim/nui.nvim" },
- },
- })
- use({
- "smjonas/inc-rename.nvim",
- config = function()
- require("inc_rename").setup()
- end,
- })
- end,
- config = {
- -- 并发数限制
- max_jobs = 16,
- -- 自定义源
- git = {
- -- default_url_format = "https://hub.fastgit.xyz/%s",
- -- default_url_format = "https://mirror.ghproxy.com/https://github.com/%s"
- -- default_url_format = "https://gitcode.net/mirrors/%s"
- -- default_url_format = "https://gitclone.com/github.com/%s",
- },
- display = {
- open_fn = function()
- return require("packer.util").float({
- border = "single",
- })
- end,
- },
- },
- })
- -- 每次保存 plugins.lua 自动安装插件
- pcall(
- vim.cmd,
- [[
- augroup packer_user_config
- autocmd!
- autocmd BufWritePost plugins.lua source <afile> | PackerSync
- augroup end
- ]]
- )
|