octo.nvim icon indicating copy to clipboard operation
octo.nvim copied to clipboard

Improve Neovim to get signs printed on wrapped lines

Open pwntester opened this issue 4 years ago • 7 comments

https://github.com/neovim/neovim/issues/12866

pwntester avatar Feb 05 '21 10:02 pwntester

just tried octo and I thought these were folds initially (you wouldn't be able to render the end of the fold like you did though). I would prefer folds to quickly move through comments but also they appear even for wrapped lines. So that may be an option to consider.

teto avatar Feb 08 '21 22:02 teto

Yep, I might add comment folding, but that does not solve identifying the boundaries of the comment and whether it is edited or not as the current signcolumn-based implemention does. Perhaps, best approach is a mix of the two: signcolumn + fold w/custom foldtext. The problem with wrapped lines and sign column is still a problem though

pwntester avatar Feb 08 '21 22:02 pwntester

Looking how to change the foldcolumn character I found this issue of yours :D https://github.com/neovim/neovim/pull/6073 didnt know it was possible to change these signs. A pitty you didnt implemented the foldend sign in the end, that would have been perfect fit for octo :)

Any idea why after closing and opening a fold several times, the foldsep is replaced with the number of times it was closed/opened?

pwntester avatar Feb 08 '21 23:02 pwntester

either it's a bug or instead of opening/closing you create new folds (in which it displays the level). I would like to improve a bunch of things related to folds post 0.5. Happy to know the foldend would be useful to you, I will add it back to the list ;)

teto avatar Feb 08 '21 23:02 teto

Nice, will definitely move to folds. did you finally implement nvim_fold_create or nvim_win_add_fold() and nvim_win_del_fold()?

UPDATE: just found https://github.com/neovim/neovim/pull/11523 so if you were looking for use cases, Octo is one :)

pwntester avatar Feb 08 '21 23:02 pwntester

Also, do you think there could be some way to change the highlight of a specific fold? I think that using a different color to show when a comment is in sync with github is very useful so wouldnt like to lose that

pwntester avatar Feb 08 '21 23:02 pwntester

Highlight folds differently sounds cumbersome. But I don't know. What about having the comment header line and then only fold its content. This would allow to highlight the header line individually, add virtual text (which can put at any column due to teto's recent PR), have some status text like at the PR/issue header (e.g. open or merged). And then just the collapsed content below. And as you can set the fold text yourself, you can make it something looking good (what ever this would mean). ^^

weilbith avatar Feb 23 '21 15:02 weilbith

fyi: this is how I fixed this in LazyVim: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/util/octo.lua#L81

Those signs are then used by a custom statuscolumn implementation, which is also in the repo.

folke avatar Jun 06 '24 14:06 folke

See my PR #555 that both fixes comments rendering for wrapped lines and better foldtext.

folke avatar Jun 07 '24 14:06 folke