shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Indent guide is behind folds #70

Closed goingtosleep closed 10 months ago

goingtosleep commented 10 months ago

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

shellRaining commented 10 months ago

ok, I will add priority options for every mod~

shellRaining commented 10 months ago

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

goingtosleep commented 10 months ago

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:

I included indent-blankline config too (commented). Thanks ๐Ÿ˜Š

shellRaining commented 10 months ago

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~

shellRaining commented 10 months ago

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

goingtosleep commented 10 months ago

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