From 9ad93b6ac062acca6d50563bf3984b287e10f721 Mon Sep 17 00:00:00 2001 From: youkwhd <74759624+youkwhd@users.noreply.github.com> Date: Sat, 31 Dec 2022 11:27:31 +0700 Subject: [PATCH] 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 --- doc/nvim-tree-lua.txt | 5 +++++ lua/nvim-tree.lua | 1 + lua/nvim-tree/view.lua | 1 + 3 files changed, 7 insertions(+) diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 8efcb0f5..ad3ec1ca 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -191,6 +191,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", @@ -681,6 +682,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` diff --git a/lua/nvim-tree.lua b/lua/nvim-tree.lua index 63863a3d..d4b35058 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 f843cb65..4ffa3905 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