@@ -5,7 +5,7 @@ local ffi, treesitter = require('ffi'), vim.treesitter
55local opt = {
66 only_current = false ,
77 exclude = { ' dashboard' , ' lazy' , ' help' , ' nofile' , ' terminal' , ' prompt' , ' qf' },
8- exclude_nodetype = { ' string ' , ' comment ' },
8+ exclude_nodetype = {},
99 config = {
1010 virt_text_pos = ' overlay' ,
1111 hl_mode = ' combine' ,
@@ -233,7 +233,8 @@ local function on_line(_, _, bufnr, row)
233233 col = level - 1
234234 end
235235 if context .has_ts then
236- local node = treesitter .get_node ({ bufnr = bufnr , pos = { row , col }, ignore_injections = true })
236+ local node =
237+ treesitter .get_node ({ bufnr = bufnr , pos = { row , col }, ignore_injections = true })
237238 while node do
238239 if vim .tbl_contains (opt .exclude_nodetype , node :type ()) then
239240 goto continue
@@ -296,7 +297,9 @@ local function on_win(_, winid, bufnr, toprow, botrow)
296297 context .currow = pos [1 ] - 1
297298 context .curcol = pos [2 ]
298299 local cur_indent = find_in_snapshot (context .currow + 1 ).indent
299- local next_indent = (context .currow + 1 < context .count ) and find_in_snapshot (context .currow + 2 ).indent or 0
300+ local next_indent = (context .currow + 1 < context .count )
301+ and find_in_snapshot (context .currow + 2 ).indent
302+ or 0
300303 -- We only want to look backwards if we are closing a block
301304 local line_text = api .nvim_get_current_line ()
302305 local is_closer = line_text :find (' ^%s*[})%]]' ) or line_text :find (' ^%s*end' )
@@ -317,24 +320,24 @@ local M = {}
317320function M .toggle ()
318321 enabled = not enabled
319322 vim .api .nvim__redraw ({
320- buf = vim .api .nvim_get_current_buf (),
321- valid = false
323+ buf = vim .api .nvim_get_current_buf (),
324+ valid = false ,
322325 })
323326end
324327
325328function M .enable ()
326329 enabled = true
327330 vim .api .nvim__redraw ({
328- buf = vim .api .nvim_get_current_buf (),
329- valid = false
331+ buf = vim .api .nvim_get_current_buf (),
332+ valid = false ,
330333 })
331334end
332335
333336function M .disable ()
334337 enabled = false
335338 vim .api .nvim__redraw ({
336- buf = vim .api .nvim_get_current_buf (),
337- valid = false
339+ buf = vim .api .nvim_get_current_buf (),
340+ valid = false ,
338341 })
339342end
340343
0 commit comments