mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	feat: create utility functions to make adding bindings even easier
This commit is contained in:
		
					parent
					
						
							
								586a7f5b41
							
						
					
				
			
			
				commit
				
					
						1b1743dc5a
					
				
			
		
					 1 changed files with 19 additions and 1 deletions
				
			
		|  | @ -4,7 +4,7 @@ | ||||||
| nixpkgsLib: let | nixpkgsLib: let | ||||||
|   mkNvimLib = import ./.; |   mkNvimLib = import ./.; | ||||||
| in | in | ||||||
|   nixpkgsLib.extend (self: super: { |   nixpkgsLib.extend (self: super: rec { | ||||||
|     nvim = mkNvimLib {lib = self;}; |     nvim = mkNvimLib {lib = self;}; | ||||||
| 
 | 
 | ||||||
|     mkLuaBinding = key: action: desc: |     mkLuaBinding = key: action: desc: | ||||||
|  | @ -40,6 +40,24 @@ in | ||||||
|         inherit default description; |         inherit default description; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|  |     # Utility function that takes two attrsets: | ||||||
|  |     # { someKey = "some_value" } and | ||||||
|  |     # { someKey = { description = "Some Description"; }; } | ||||||
|  |     # and merges them into | ||||||
|  |     # { someKey = { value = "some_value"; description = "Some Description"; }; } | ||||||
|  |     addDescriptionsToMappings = actualMappings: mappingDefinitions: | ||||||
|  |       self.attrsets.mapAttrs (name: value: { | ||||||
|  |         value = value; | ||||||
|  |         description = mappingDefinitions."${name}".description; | ||||||
|  |       }) | ||||||
|  |       actualMappings; | ||||||
|  | 
 | ||||||
|  |     mkSetBinding = binding: action: | ||||||
|  |       mkBinding binding.value action binding.description; | ||||||
|  | 
 | ||||||
|  |     mkSetLuaBinding = binding: action: | ||||||
|  |       mkLuaBinding binding.value action binding.description; | ||||||
|  | 
 | ||||||
|     # For forward compatibility. |     # For forward compatibility. | ||||||
|     literalExpression = super.literalExpression or super.literalExample; |     literalExpression = super.literalExpression or super.literalExample; | ||||||
|     literalDocBook = super.literalDocBook or super.literalExample; |     literalDocBook = super.literalDocBook or super.literalExample; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 n3oney
				n3oney