mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	nvim-tree: hijack netrw
This commit is contained in:
		
					parent
					
						
							
								68392ae504
							
						
					
				
			
			
				commit
				
					
						9c979a4a84
					
				
			
		
					 1 changed files with 70 additions and 51 deletions
				
			
		|  | @ -24,6 +24,7 @@ in { | ||||||
|         package = "nvim-tree-lua"; |         package = "nvim-tree-lua"; | ||||||
|         setupModule = "nvim-tree"; |         setupModule = "nvim-tree"; | ||||||
|         inherit (cfg) setupOpts; |         inherit (cfg) setupOpts; | ||||||
|  | 
 | ||||||
|         cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"]; |         cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"]; | ||||||
|         keys = [ |         keys = [ | ||||||
|           (mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description) |           (mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description) | ||||||
|  | @ -31,9 +32,8 @@ in { | ||||||
|           (mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description) |           (mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description) | ||||||
|           (mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description) |           (mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description) | ||||||
|         ]; |         ]; | ||||||
|       }; |  | ||||||
| 
 | 
 | ||||||
|       pluginRC.nvimtreelua = entryAnywhere '' |         beforeAll = '' | ||||||
|           ${ |           ${ | ||||||
|             optionalString cfg.setupOpts.disable_netrw '' |             optionalString cfg.setupOpts.disable_netrw '' | ||||||
|               -- disable netrew completely |               -- disable netrew completely | ||||||
|  | @ -42,6 +42,24 @@ in { | ||||||
|             '' |             '' | ||||||
|           } |           } | ||||||
| 
 | 
 | ||||||
|  |           ${optionalString (cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) '' | ||||||
|  |             vim.api.nvim_create_autocmd("BufEnter", { | ||||||
|  |               group = vim.api.nvim_create_augroup("load_nvim_tree", {}), | ||||||
|  |               desc = "Loads nvim-tree when openning a directory", | ||||||
|  |               callback = function(args) | ||||||
|  |                 local stats = vim.uv.fs_stat(args.file) | ||||||
|  | 
 | ||||||
|  |                 if not stats or stats.type ~= "directory" then | ||||||
|  |                   return | ||||||
|  |                 end | ||||||
|  | 
 | ||||||
|  |                 require("lz.n").trigger_load("nvim-tree-lua") | ||||||
|  | 
 | ||||||
|  |                 return true | ||||||
|  |               end, | ||||||
|  |             }) | ||||||
|  |           ''} | ||||||
|  | 
 | ||||||
|           ${ |           ${ | ||||||
|             optionalString cfg.openOnSetup '' |             optionalString cfg.openOnSetup '' | ||||||
|               ${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''} |               ${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''} | ||||||
|  | @ -85,4 +103,5 @@ in { | ||||||
|         ''; |         ''; | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|  |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
				Ching Pei Yang