From c6dd02f6f6fe37c23420ae9ded436311a533655f Mon Sep 17 00:00:00 2001 From: youkwhd Date: Sun, 25 Dec 2022 18:09:05 +0700 Subject: [PATCH 1/2] 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/nvim-tree-lua.txt | 1 + lua/nvim-tree.lua | 1 + lua/nvim-tree/view.lua | 1 + 3 files changed, 3 insertions(+) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 9c4b33f3ca7..866f2e83aad 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -190,6 +190,7 @@ Subsequent calls to setup will replace the previous configuration. view = { adaptive_size = false, centralize_selection = false, + cursorline = true, width = 30, hide_root_folder = false, side = "left", diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 63863a3dd90..d4b35058de0 100644 --- a/lua/nvim-tree.lua +++ b/lua/nvim-tree.lua @@ -499,6 +499,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS view = { adaptive_size = false, centralize_selection = false, + cursorline = true, width = 30, hide_root_folder = false, side = "left", diff --git a/lua/nvim-tree/view.lua b/lua/nvim-tree/view.lua index f843cb65f40..4ffa39053b8 100644 --- a/lua/nvim-tree/view.lua +++ b/lua/nvim-tree/view.lua @@ -490,6 +490,7 @@ function M.setup(opts) M.View.hide_root_folder = options.hide_root_folder M.View.tab = opts.tab M.View.preserve_window_proportions = options.preserve_window_proportions + M.View.winopts.cursorline = options.cursorline M.View.winopts.number = options.number M.View.winopts.relativenumber = options.relativenumber M.View.winopts.signcolumn = options.signcolumn From 3bff63d8a62db4429a0777367f7da57544985163 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 31 Dec 2022 15:26:26 +1100 Subject: [PATCH 2/2] doc: add cursorline --- doc/nvim-tree-lua.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 866f2e83aad..4deb16a09fe 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -681,6 +681,10 @@ Window / buffer setup. initially centralized, see |zz|. Type: `boolean`, Default: `false` + *nvim-tree.view.cursorline* + Enable |cursorline| in the tree window. + Type: `boolean`, Default: `true` + *nvim-tree.view.hide_root_folder* Hide the path of the current working directory on top of the tree. Type: `boolean`, Default: `false`