Skip to content

Commit 9ad93b6

Browse files
feat(view): add view.cursorline (#1859)
* feat(#1814): added cursorline config to DEFAULT_OPTS Extends #1814 Currently, the config cursorline is set to `true` by default. This behaviour can only be changed by a hacky way of listening to an event, as @alex-courtis mentioned that: "The user can change this default if they want via event". This PR generalizes the configuration to be easier to config via the function `setup()`. * doc: add cursorline Co-authored-by: Alexander Courtis <[email protected]>
1 parent 3c4958a commit 9ad93b6

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

doc/nvim-tree-lua.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Subsequent calls to setup will replace the previous configuration.
191191
view = {
192192
adaptive_size = false,
193193
centralize_selection = false,
194+
cursorline = true,
194195
width = 30,
195196
hide_root_folder = false,
196197
side = "left",
@@ -681,6 +682,10 @@ Window / buffer setup.
681682
initially centralized, see |zz|.
682683
Type: `boolean`, Default: `false`
683684

685+
*nvim-tree.view.cursorline*
686+
Enable |cursorline| in the tree window.
687+
Type: `boolean`, Default: `true`
688+
684689
*nvim-tree.view.hide_root_folder*
685690
Hide the path of the current working directory on top of the tree.
686691
Type: `boolean`, Default: `false`

lua/nvim-tree.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
499499
view = {
500500
adaptive_size = false,
501501
centralize_selection = false,
502+
cursorline = true,
502503
width = 30,
503504
hide_root_folder = false,
504505
side = "left",

lua/nvim-tree/view.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ function M.setup(opts)
490490
M.View.hide_root_folder = options.hide_root_folder
491491
M.View.tab = opts.tab
492492
M.View.preserve_window_proportions = options.preserve_window_proportions
493+
M.View.winopts.cursorline = options.cursorline
493494
M.View.winopts.number = options.number
494495
M.View.winopts.relativenumber = options.relativenumber
495496
M.View.winopts.signcolumn = options.signcolumn

0 commit comments

Comments
 (0)