pretty-fold.nvim icon indicating copy to clipboard operation
pretty-fold.nvim copied to clipboard

FR: highlight 'content'

Open guoang opened this issue 2 years ago • 5 comments

Great Plugin!

Is there a way to highlight the 'content'? It'll make the function signature looks better

image image

guoang avatar Feb 02 '23 09:02 guoang

Same, would it be possible to have some simple colours in fold signature, it looks pretty dull right now

image

anurag3301 avatar Aug 15 '23 05:08 anurag3301

Seems like work the discussion has been going on for quite a while on neovim

Here are few threads

  1. Issue #12649
  2. PR #23471
  3. PR #20750

anurag3301 avatar Aug 15 '23 05:08 anurag3301

This could be implemented now, since https://github.com/neovim/neovim/pull/25209 has been merged.

stevanmilic avatar Sep 26 '23 20:09 stevanmilic

I managed to do this in C, however it's nothing to do with pretty-fold plugin. If you do, tree sitter folding plugin this is an option: https://github.com/nvim-treesitter/nvim-treesitter/issues/1564

You need to add the following into config file:

      vim.treesitter.query.set(
        "c",
        "folds",
        [[
          [
           (switch_statement)
           (case_statement)
           (comment)
          ] @fold
          (function_definition
            type: (type_identifier)  @fold
          )
          (function_definition
            body: (compound_statement)  @fold
          )
          ]]
      )

      vim.treesitter.query.set(
        "cpp",
        "folds",
        [[
          [
           (switch_statement)
           (case_statement)
           (comment)
           (function_definition)
          ] @fold
          ]]
      )

The above code folds this code: image

Into: image

alexveden avatar Dec 23 '23 15:12 alexveden

An alternative approach was choosen upstream to support this: https://github.com/neovim/neovim/pull/20750/

Duologic avatar Jan 31 '24 11:01 Duologic