@@ -151,7 +151,6 @@ require'nvim-tree'.setup {
|
|||||||
height = 30,
|
height = 30,
|
||||||
hide_root_folder = false,
|
hide_root_folder = false,
|
||||||
side = 'left',
|
side = 'left',
|
||||||
auto_resize = false,
|
|
||||||
preserve_window_proportions = false,
|
preserve_window_proportions = false,
|
||||||
mappings = {
|
mappings = {
|
||||||
custom_only = false,
|
custom_only = false,
|
||||||
@@ -172,6 +171,7 @@ require'nvim-tree'.setup {
|
|||||||
},
|
},
|
||||||
open_file = {
|
open_file = {
|
||||||
quit_on_open = false,
|
quit_on_open = false,
|
||||||
|
resize_window = false,
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = true,
|
enable = true,
|
||||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ function.
|
|||||||
width = 30,
|
width = 30,
|
||||||
height = 30,
|
height = 30,
|
||||||
side = 'left',
|
side = 'left',
|
||||||
auto_resize = false,
|
|
||||||
preserve_window_proportions = false,
|
preserve_window_proportions = false,
|
||||||
number = false,
|
number = false,
|
||||||
relativenumber = false,
|
relativenumber = false,
|
||||||
@@ -138,6 +137,7 @@ function.
|
|||||||
},
|
},
|
||||||
open_file = {
|
open_file = {
|
||||||
quit_on_open = false,
|
quit_on_open = false,
|
||||||
|
resize_window = false,
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = true,
|
enable = true,
|
||||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||||
@@ -336,10 +336,6 @@ Here is a list of the options available in the setup call:
|
|||||||
type: `string`
|
type: `string`
|
||||||
default: 'left'
|
default: 'left'
|
||||||
|
|
||||||
- |view.auto_resize|: auto resize the tree after opening a file
|
|
||||||
type: `boolean`
|
|
||||||
default: `false`
|
|
||||||
|
|
||||||
- |view.preserve_window_proportions|: preserve window proportions when
|
- |view.preserve_window_proportions|: preserve window proportions when
|
||||||
opening a file. If `false`, the height and width of windows other than
|
opening a file. If `false`, the height and width of windows other than
|
||||||
nvim-tree will be equalized.
|
nvim-tree will be equalized.
|
||||||
@@ -418,6 +414,10 @@ Here is a list of the options available in the setup call:
|
|||||||
type: `boolean`
|
type: `boolean`
|
||||||
default: `false`
|
default: `false`
|
||||||
|
|
||||||
|
- |actions.open_file.resize_window|: resizes the tree when opening a file
|
||||||
|
type: `boolean`
|
||||||
|
default: `false`
|
||||||
|
|
||||||
- |actions.open_file.window_picker|: window picker configuration
|
- |actions.open_file.window_picker|: window picker configuration
|
||||||
|
|
||||||
- |actions.open_file.window_picker.enable|: Enable the feature. If the
|
- |actions.open_file.window_picker.enable|: Enable the feature. If the
|
||||||
|
|||||||
@@ -380,6 +380,7 @@ local DEFAULT_OPTS = {
|
|||||||
},
|
},
|
||||||
open_file = {
|
open_file = {
|
||||||
quit_on_open = vim.g.nvim_tree_quit_on_open == 1,
|
quit_on_open = vim.g.nvim_tree_quit_on_open == 1,
|
||||||
|
resize_window = false,
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = true,
|
enable = true,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ local view = require'nvim-tree.view'
|
|||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
quit_on_open = false,
|
quit_on_open = false,
|
||||||
|
resize_window = false,
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = true,
|
enable = true,
|
||||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||||
@@ -208,8 +209,10 @@ function M.fn(mode, filename)
|
|||||||
cmd = cmd .. vim.fn.fnameescape(filename)
|
cmd = cmd .. vim.fn.fnameescape(filename)
|
||||||
api.nvim_set_current_win(target_winid)
|
api.nvim_set_current_win(target_winid)
|
||||||
pcall(vim.cmd, cmd)
|
pcall(vim.cmd, cmd)
|
||||||
|
if M.resize_window then
|
||||||
view.resize()
|
view.resize()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if mode == "preview" then
|
if mode == "preview" then
|
||||||
view.focus()
|
view.focus()
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ local migrations = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
nvim_tree_auto_resize = function(o)
|
nvim_tree_auto_resize = function(o)
|
||||||
utils.table_create_missing(o, "view")
|
utils.table_create_missing(o, "actions.open_file")
|
||||||
if o.view.auto_resize == nil then
|
if o.actions.open_file.resize_window == nil then
|
||||||
o.view.auto_resize = vim.g.nvim_tree_auto_resize ~= 0
|
o.actions.open_file.resize_window = vim.g.nvim_tree_auto_resize ~= 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|||||||
@@ -324,7 +324,6 @@ local DEFAULT_CONFIG = {
|
|||||||
width = 30,
|
width = 30,
|
||||||
height = 30,
|
height = 30,
|
||||||
side = 'left',
|
side = 'left',
|
||||||
auto_resize = false,
|
|
||||||
preserve_window_proportions = false,
|
preserve_window_proportions = false,
|
||||||
number = false,
|
number = false,
|
||||||
relativenumber = false,
|
relativenumber = false,
|
||||||
@@ -337,7 +336,6 @@ function M.setup(opts)
|
|||||||
M.View.width = options.width
|
M.View.width = options.width
|
||||||
M.View.height = options.height
|
M.View.height = options.height
|
||||||
M.View.hide_root_folder = options.hide_root_folder
|
M.View.hide_root_folder = options.hide_root_folder
|
||||||
M.View.auto_resize = options.auto_resize
|
|
||||||
M.View.preserve_window_proportions = options.preserve_window_proportions
|
M.View.preserve_window_proportions = options.preserve_window_proportions
|
||||||
M.View.winopts.number = options.number
|
M.View.winopts.number = options.number
|
||||||
M.View.winopts.relativenumber = options.relativenumber
|
M.View.winopts.relativenumber = options.relativenumber
|
||||||
|
|||||||
Reference in New Issue
Block a user