shellRaining/hlchunk.nvim

Indent guide is behind folds

goingtosleep opened this issue Β· 6 comments

Describe the bug
The indent guide is behind folds.

To Reproduce
Steps to reproduce the behavior:

  1. Write some code with folds.
  2. The indent guide is hidden behind the folds, resulting in disconnected lines.

Expected behavior
The indent guide should be above the folds. indent-blankline.nvim has the option char_priority to control this IIRC.

Screenshots
image

ok, I will add priority options for every mod~

sorry for late update, can you share the config about folds, I have test the priority options, but not work properly.

Sure @shellRaining, here is the minimal config:

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    'catppuccin/nvim',
    name = 'catppuccin',
    config = function()
      require('catppuccin').setup {
        flavour = 'frappe',
        transparent_background = true,
        term_colors = false,
        custom_highlights = function(colors) return {
          Folded = {fg = colors.text, bg = '#34384b', style={'italic'}},
        }
      end
    }
    end
  },


  {
    'shellRaining/hlchunk.nvim',
    event = 'UIEnter',
    config = function()
      require('hlchunk').setup {
        blank = {enable = false},
        indent = {enable = true},
        line_num = {
          enable = true,
          use_treesitter = true,
          style = '#8c80ca',
        },
        chunk = {
          style = {
            { fg = '#8c80ca' },
            { fg = '#c21f30' },
          }
        }
      }
    end
  },

  {
    'kevinhwang91/nvim-ufo',
    config = function()
      require('ufo').setup {
        provider_selector = function(_, filetype)
          local mappings = {
            python = {'lsp', 'indent'}
          }
          return mappings[filetype]
        end
      }
    end,
    dependencies = 'kevinhwang91/promise-async'
  },


  -- {
  --   'lukas-reineke/indent-blankline.nvim',
  --   config = function()
  --     require('indent_blankline').setup {
  --       show_foldtext = false,
  --       char_priority = 100,
  --       show_current_context = false,
  --       show_first_indent_level = false,
  --   }
  --   end,
  -- },

  {
    'nvim-treesitter/nvim-treesitter',
    build = function()
      pcall(require('nvim-treesitter.install').update { with_sync = true })
    end,
    config = function()
      require('treesitter-context').setup()
      require('nvim-treesitter.configs').setup {
        ensure_installed = {'python'},
        highlight = {
          enable = true,
          additional_vim_regex_highlighting = { 'markdown' },
          disable = {'markdown'},
        },
      }
    end,
    dependencies = {'romgrk/nvim-treesitter-context'},
  },

}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.opt.termguicolors = true
vim.cmd([[colorscheme catppuccin]])
vim.api.nvim_set_hl(0, 'Folded', {bg = '#34384b'})

Steps to reproduce:

  • Save the above as repro.lua.
  • Run nvim -u ./repro.lua main.py.
  • The content I used for main.py:
def f():
    def g():
        if True:
            if True:
                print('something')
    g(

    )

I included indent-blankline config too (commented). Thanks 😊

oh sorryπŸ˜„, I have set the color of indent line same as fold's color, so I not notice that the priority has work properly, will push later~

the newest commit solve your problem, but not provide priority options, I will refactor my code and will add this option later, this need some time to test

It works, thanks a lot @shellRaining πŸŽ‰