123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- -- 自动安装 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' }
- }
- -- project
- use("ahmedkhalf/project.nvim")
- -- treesitter (新增)
- use {
- 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate'
- }
- --------------------- LSP --------------------
- use("williamboman/nvim-lsp-installer")
- -- Lspconfig
- use({ "neovim/nvim-lspconfig" })
- 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
- ]])
|