269 lines
7.7 KiB
Lua
269 lines
7.7 KiB
Lua
-- stdpath('config') returns $HOME/.config/nvim
|
|
-- NOTE: strange rules for neovim `packadd` method, only paths match 'pack/*/start/{dirname}' or 'pack/*/opt/{dirname}' can be added
|
|
-- local packer_install_dir = '~/.config/nvim/pack/packer/start/packer.nvim'
|
|
|
|
local config_path = vim.fn.stdpath('config')
|
|
local packer_install_path = config_path .. '/pack/packer/start/packer.nvim'
|
|
local packer_pkg_root = config_path .. '/pack'
|
|
local packer_compile = config_path .. '/pack/packer_complied.lua'
|
|
local packer_cache = vim.fn.stdpath('cache') .. '/packer.nvim'
|
|
|
|
local packer_conf = {
|
|
ensure_dependencies = true, -- Should packer install plugin dependencies?
|
|
snapshot = nil, -- Name of the snapshot you would like to load at startup
|
|
snapshot_path = packer_cache, -- Default save directory for snapshots
|
|
package_root = packer_pkg_root,
|
|
compile_path = packer_compile,
|
|
plugin_package = 'packer', -- The default package for plugins
|
|
max_jobs = nil, -- Limit the number of simultaneous jobs. nil means no limit
|
|
auto_clean = true, -- During sync(), remove unused plugins
|
|
compile_on_sync = true, -- During sync(), run packer.compile()
|
|
disable_commands = false, -- Disable creating commands
|
|
opt_default = false, -- Default to using opt (as opposed to start) plugins
|
|
transitive_opt = true, -- Make dependencies of opt plugins also opt by default
|
|
transitive_disable = true, -- Automatically disable dependencies of disabled plugins
|
|
auto_reload_compiled = true, -- Automatically reload the compiled file after creating it.
|
|
preview_updates = false, -- If true, always preview updates before choosing which plugins to update, same as `PackerUpdate --preview`.
|
|
git = {
|
|
cmd = 'git', -- The base command for git operations
|
|
subcommands = { -- Format strings for git subcommands
|
|
update = 'pull --ff-only --progress --rebase=false',
|
|
install = 'clone --depth %i --no-single-branch --progress',
|
|
fetch = 'fetch --depth 999999 --progress',
|
|
checkout = 'checkout %s --',
|
|
update_branch = 'merge --ff-only @{u}',
|
|
current_branch = 'branch --show-current',
|
|
diff = 'log --color=never --pretty=format:FMT --no-show-signature HEAD@{1}...HEAD',
|
|
diff_fmt = '%%h %%s (%%cr)',
|
|
get_rev = 'rev-parse --short HEAD',
|
|
get_msg = 'log --color=never --pretty=format:FMT --no-show-signature HEAD -n 1',
|
|
submodules = 'submodule update --init --recursive --progress'
|
|
},
|
|
depth = 1, -- Git clone depth
|
|
clone_timeout = 600, -- Timeout, in seconds, for git clones
|
|
-- default_url_format = 'https://github.com/%s', -- Lua format string used for "aaa/bbb" style plugins
|
|
-- default_url_format = 'git@gitee.com:%s.git',
|
|
-- default_url_format = 'https://gitcode.net/%s',
|
|
default_url_format = '%s.git',
|
|
},
|
|
|
|
display = {
|
|
open_fn = function()
|
|
return require("packer.util").float({ border = "rounded" })
|
|
end,
|
|
},
|
|
|
|
luarocks = {
|
|
python_cmd = 'python' -- Set the python command to use for running hererocks
|
|
},
|
|
|
|
log = { level = 'warn' }, -- The default print log level. One of: "trace", "debug", "info", "warn", "error", "fatal".
|
|
|
|
profile = {
|
|
enable = false,
|
|
threshold = 1, -- integer in milliseconds, plugins which load faster than this won't be shown in profile output
|
|
},
|
|
|
|
autoremove = false, -- Remove disabled or unused plugins without prompting the user
|
|
}
|
|
|
|
local ensure_packer = function()
|
|
if vim.fn.empty(vim.fn.glob(packer_install_path)) > 0 then
|
|
vim.fn.system({'git', 'clone', '--depth', '1', 'https://gitcode.net/nvim-packer/packer.nvim', packer_install_path})
|
|
vim.cmd('packadd packer.nvim')
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
local packer_bootstrap = ensure_packer()
|
|
|
|
vim.cmd([[
|
|
augroup packer_user_config
|
|
autocmd!
|
|
autocmd BufWritePost pkg.lua source <afile> | PackerSync
|
|
augroup end
|
|
]])
|
|
|
|
local ok, packer = pcall(require, 'packer')
|
|
if not ok then
|
|
print('packer loaded error')
|
|
return
|
|
end
|
|
|
|
packer.init(packer_conf)
|
|
|
|
return packer.startup(function(use)
|
|
use({
|
|
'https://gitcode.net/nvim-packer/packer.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/plenary.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-web-devicons'
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/telescope.nvim',
|
|
requires = { {'https://gitcode.net/nvim-packer/plenary.nvim'} },
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/project.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/indent-blankline.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/alpha-nvim',
|
|
requires = { {'https://gitcode.net/nvim-packer/nvim-web-devicons'} },
|
|
})
|
|
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-lspconfig',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/mason.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/mason-lspconfig.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/lspsaga.nvim',
|
|
branch = 'main',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/lualine.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/bufferline.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-tree.lua',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-treesitter',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/trouble.nvim',
|
|
requires = { {'https://gitcode.net/nvim-packer/nvim-web-devicons'} },
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/hop.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-solarized-lua',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/go.nvim',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/rust-tools.nvim',
|
|
ft = 'rust',
|
|
config = function()
|
|
require('rust-tools').setup({
|
|
})
|
|
end,
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-ts-rainbow',
|
|
requires = { {'https://gitcode.net/nvim-packer/nvim-treesitter'} },
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-surround',
|
|
config = function()
|
|
require('nvim-surround').setup({
|
|
})
|
|
end
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/nvim-autopairs',
|
|
config = function()
|
|
require("nvim-autopairs").setup({
|
|
})
|
|
end
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/git-blame.nvim',
|
|
-- config = function()
|
|
-- require('gitblame').setup({
|
|
-- })
|
|
-- end
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/gitsigns.nvim',
|
|
-- tag = 'release',
|
|
config = function()
|
|
require('gitsigns').setup()
|
|
end
|
|
})
|
|
|
|
use({ "https://gitcode.net/nvim-packer/nvim-cmp", }) -- The completion plugin
|
|
use({ "https://gitcode.net/nvim-packer/cmp-buffer",}) -- buffer completions
|
|
use({ "https://gitcode.net/nvim-packer/cmp-path", }) -- path completions
|
|
use({ "https://gitcode.net/nvim-packer/cmp_luasnip", }) -- snippet completions
|
|
use({ "https://gitcode.net/nvim-packer/cmp-nvim-lsp", })
|
|
use({ "https://gitcode.net/nvim-packer/cmp-nvim-lua", })
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/Comment.nvim',
|
|
})
|
|
|
|
-- snippets
|
|
use({
|
|
'https://gitcode.net/nvim-packer/LuaSnip',
|
|
-- 'https://github.com/L3MON4D3/LuaSnip',
|
|
-- tag = "v2.*",
|
|
branch = "prod",
|
|
run = "make install_jsregexp",
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/nvim-packer/friendly-snippets',
|
|
})
|
|
|
|
-- use({
|
|
-- 'https://gitcode.net/vim-plug/ale',
|
|
-- })
|
|
|
|
use({
|
|
'https://gitcode.net/vim-plug/vim-easy-align',
|
|
})
|
|
|
|
use({
|
|
'https://gitcode.net/vim-plug/vim-virtualenv',
|
|
})
|
|
|
|
|
|
use({
|
|
'https://gitcode.net/vim-plug/vim-table-mode',
|
|
})
|
|
|
|
if packer_bootstrap then
|
|
require('packer').sync()
|
|
end
|
|
end)
|