close nvim-tree when open file
This commit is contained in:
		
							parent
							
								
									0144cf18ed
								
							
						
					
					
						commit
						6c0050c423
					
				|  | @ -275,9 +275,6 @@ require('lazy').setup({ | ||||||
|       "nvim-tree/nvim-web-devicons", |       "nvim-tree/nvim-web-devicons", | ||||||
|     }, |     }, | ||||||
|     config = function() |     config = function() | ||||||
|       require("nvim-tree").setup { |  | ||||||
|         on_attach = My_on_attach, |  | ||||||
|       } |  | ||||||
|     end, |     end, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
|  function My_on_attach(bufnr) | local function my_on_attach(bufnr) | ||||||
|   local api = require "nvim-tree.api" |   local api = require "nvim-tree.api" | ||||||
| 
 | 
 | ||||||
|   local function opts(desc) |   local function opts(desc) | ||||||
|  | @ -12,3 +12,13 @@ | ||||||
|   vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent,        opts('Up')) |   vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent,        opts('Up')) | ||||||
|   vim.keymap.set('n', '?',     api.tree.toggle_help,                  opts('Help')) |   vim.keymap.set('n', '?',     api.tree.toggle_help,                  opts('Help')) | ||||||
| end | end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | require("nvim-tree").setup { | ||||||
|  |   on_attach = my_on_attach, | ||||||
|  |     actions = { | ||||||
|  |     open_file = { | ||||||
|  |       quit_on_open = true, | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue