feat: allow number and relativenumber settings (#762)

This commit is contained in:
JavierPoduje 2021-11-28 10:18:43 -03:00 committed by GitHub
parent f2f1a34733
commit 9db956fab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 4 deletions

View File

@ -88,7 +88,9 @@ require'nvim-tree'.setup {
mappings = {
custom_only = false,
list = {}
}
},
number = false,
relativenumber = false
}
}
```

View File

@ -110,14 +110,16 @@ function.
height = 30,
side = 'left',
auto_resize = false,
number = false,
relativenumber = false,
mappings = {
custom_only = false,
list = {}
}
},
filters = {
dotfiles = false,
custom = {}
dotfiles = false,
custom = {}
}
}
<
@ -287,6 +289,16 @@ Here is a list of the options available in the setup call:
type: `boolean`
default: false
- |view.number|: print the line number in front of each line.
type: `boolean`
default: false
- |view.relativenumber|: show the line number relative to the line with the
cursor in front of each line. If the option `view.number` is also `true`,
the number on the cursor line will be the line number instead of `0`.
type: `boolean`
default: false
- |view.mappings|: configuration options for keymaps
- |view.mappings.custom_only|: will use only the provided user mappings and not the default

View File

@ -114,7 +114,9 @@ local DEFAULT_CONFIG = {
mappings = {
custom_only = false,
list = {}
}
},
number = false,
relativenumber = false
}
local function merge_mappings(user_mappings)
@ -147,6 +149,8 @@ function M.setup(opts)
M.View.height = options.height
M.View.hide_root_folder = options.hide_root_folder
M.View.auto_resize = opts.auto_resize
M.View.winopts.number = options.number
M.View.winopts.relativenumber = options.relativenumber
if options.mappings.custom_only then
M.View.mappings = options.mappings.list
else