mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-30 02:37:06 +00:00 
			
		
		
		
	plugins/treesitter: migrate treesitter-context to new setupOpts
		
	This commit is contained in:
		
					parent
					
						
							
								e8035c42f4
							
						
					
				
			
			
				commit
				
					
						c8d38872ab
					
				
			
		
					 4 changed files with 94 additions and 59 deletions
				
			
		|  | @ -4,28 +4,21 @@ | |||
|   ... | ||||
| }: let | ||||
|   inherit (lib.modules) mkIf; | ||||
|   inherit (lib.trivial) boolToString; | ||||
|   inherit (lib.nvim.lua) nullString; | ||||
|   inherit (lib.nvim.lua) toLuaObject; | ||||
|   inherit (lib.nvim.dag) entryAfter; | ||||
| 
 | ||||
|   inherit (config.vim) treesitter; | ||||
|   cfg = treesitter.context; | ||||
| in { | ||||
|   config = mkIf (treesitter.enable && cfg.enable) { | ||||
|     vim.startPlugins = ["nvim-treesitter-context"]; | ||||
|     vim = { | ||||
|       startPlugins = ["nvim-treesitter-context"]; | ||||
| 
 | ||||
|     vim.luaConfigRC.treesitter-context = entryAfter ["treesitter"] '' | ||||
|       require'treesitter-context'.setup { | ||||
|         enable = true, | ||||
|         max_lines = ${toString cfg.maxLines}, | ||||
|         min_window_height = ${toString cfg.minWindowHeight}, | ||||
|         line_numbers = ${boolToString cfg.lineNumbers}, | ||||
|         multiline_threshold = ${toString cfg.multilineThreshold}, | ||||
|         trim_scope = '${cfg.trimScope}', | ||||
|         mode = '${cfg.mode}', | ||||
|         separator = ${nullString cfg.separator}, | ||||
|         z_index = ${toString cfg.zindex}, | ||||
|       } | ||||
|     ''; | ||||
|       # set up treesitter-context after Treesitter. The ordering | ||||
|       # should not matter, but there is no harm in doing this | ||||
|       luaConfigRC.treesitter-context = entryAfter ["treesitter"] '' | ||||
|         require("treesitter-context").setup(${toLuaObject cfg.setupOpts}) | ||||
|       ''; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue