add: Packer snapshot feature (#721)
This commit is contained in:
		
							parent
							
								
									36aeebc580
								
							
						
					
					
						commit
						985217b93f
					
				lua
| @ -31,6 +31,7 @@ M.plugins = { | |||||||
|    options = { |    options = { | ||||||
|       packer = { |       packer = { | ||||||
|          init_file = "plugins.packerInit", |          init_file = "plugins.packerInit", | ||||||
|  |          snapshot = nil, | ||||||
|       }, |       }, | ||||||
|       lspconfig = { |       lspconfig = { | ||||||
|          setup_lspconf = "", -- path of lspconfig file |          setup_lspconf = "", -- path of lspconfig file | ||||||
|  | |||||||
| @ -68,6 +68,22 @@ local packer_cmd = function(callback) | |||||||
|    end |    end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | -- snapshot stuff | ||||||
|  | user_cmd("PackerSnapshot", function(info) | ||||||
|  |    require "plugins" | ||||||
|  |    require("packer").snapshot(info.args) | ||||||
|  | end, { nargs = "+" }) | ||||||
|  | 
 | ||||||
|  | user_cmd("PackerSnapshotDelete", function(info) | ||||||
|  |    require "plugins" | ||||||
|  |    require("packer.snapshot").delete(info.args) | ||||||
|  | end, { nargs = "+" }) | ||||||
|  | 
 | ||||||
|  | user_cmd("PackerSnapshotRollback", function(info) | ||||||
|  |    require "plugins" | ||||||
|  |    require("packer").rollback(info.args) | ||||||
|  | end, { nargs = "+" }) | ||||||
|  | 
 | ||||||
| user_cmd("PackerClean", packer_cmd "clean", {}) | user_cmd("PackerClean", packer_cmd "clean", {}) | ||||||
| user_cmd("PackerCompile", packer_cmd "compile", {}) | user_cmd("PackerCompile", packer_cmd "compile", {}) | ||||||
| user_cmd("PackerInstall", packer_cmd "install", {}) | user_cmd("PackerInstall", packer_cmd "install", {}) | ||||||
|  | |||||||
| @ -27,6 +27,8 @@ if not present then | |||||||
|    end |    end | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | local user_snapshot = require("core.utils").load_config().snapshot | ||||||
|  | 
 | ||||||
| packer.init { | packer.init { | ||||||
|    display = { |    display = { | ||||||
|       open_fn = function() |       open_fn = function() | ||||||
| @ -39,6 +41,7 @@ packer.init { | |||||||
|    }, |    }, | ||||||
|    auto_clean = true, |    auto_clean = true, | ||||||
|    compile_on_sync = true, |    compile_on_sync = true, | ||||||
|  |    snapshot = user_snapshot, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| return packer | return packer | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user