Skip to content

Commit 1f4f0ee

Browse files
JafarAbditheHamsta
authored andcommitted
Add option to highlight cursor in case cursorlineopt is set to only number
1 parent b5b8c80 commit 1f4f0ee

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lua/nvim-treesitter-refactor.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function M.init()
1818
disable = {},
1919
is_supported = queries.has_locals,
2020
highlight_eol = false,
21+
highlight_cursor = false,
2122
},
2223
smart_rename = {
2324
module_path = "nvim-treesitter-refactor.smart_rename",

lua/nvim-treesitter-refactor/highlight_current_scope.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ function M.highlight_current_scope(bufnr)
1717
local current_scope = locals.containing_scope(node_at_point, bufnr)
1818

1919
if current_scope then
20+
local config = configs.get_module "refactor.highlight_current_scope"
2021
-- Highlight range [start_line, end_line) 0-based
2122
local highlighter = function(start_line, end_line)
22-
local config = configs.get_module "refactor.highlight_current_scope"
2323
vim.api.nvim_buf_set_extmark(bufnr, current_scope_namespace, math.max(vim.fn.line("w0") - 1, start_line), 0, {
2424
end_row = math.min(vim.fn.line("w$"), end_line),
2525
end_col = 0,
@@ -30,7 +30,7 @@ function M.highlight_current_scope(bufnr)
3030
local start_line, _, end_line, _ = current_scope:range()
3131

3232
if start_line ~= 0 or end_line ~= vim.fn.line("$") then
33-
highlighter(start_line, vim.fn.line(".") - 1)
33+
highlighter(start_line, vim.fn.line(".") + (config.highlight_cursor and 0 or -1))
3434
highlighter(vim.fn.line("."), end_line + 1)
3535
end
3636
end

0 commit comments

Comments
 (0)