Commit graph

23 commits

Author SHA1 Message Date
Iordanis Petkakis
7bcd3baaf8
fix(statuscolumn): show open folds in consecutive levels (#1534)
## Description
This uses `vim.treesitter.foldexpr` to get the start of a foldlevel,
because `vim.fn.foldlevel()` will return the same number in adjacent
foldlevels, thus making the open fold markers inconsistent.

This will however introduce a dependency on `vim.treesitter.foldexpr`
and I haven't seen any other computations based on `vim.treesitter`, so
maybe this is not desirable?

Unfortunately, I wasn't able to come up with a better solution, so feel
free to disregard.

PS: I came across #1445 and this PR reverts those changes I realize. But
I fail to find a good way for both to co-exist. I tried checking the
value with `vim.api.nvim_get_option_value("foldexpr", {})`, but this
will only work if `vim.opt.foldexpr` will be set directly into one of
the 2. If it's set to another function that is required like in LazyVim,
I'm not able to distinguish what value `foldexpr` is actually set to.

PS2: I'm guessing the same thing happens when `foldexpr` is set to
`vim.lsp.foldexpr` and the ideal would be some way to distinguish which
one is currently active and then use either
`vim.treesitter.foldexpr(lnum):sub(1, 1) == ">"` or
`vim.lsp.foldexpr(lnum):sub(1, 1) == ">"` respectively.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Fixes #1533 
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots
Before 

![2025-03-08_18-19](https://github.com/user-attachments/assets/ec911497-3883-4a94-a607-7ce0f7021a8d)

After

![2025-03-08_18-20](https://github.com/user-attachments/assets/ed80f174-759a-41e5-b5af-9366e66a2d4a)


<!-- Add screenshots of the changes if applicable. -->

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-21 00:16:15 -07:00
Folke Lemaitre
1239fb84bc
fix(statuscolumn): better way of determining open folds. Closes #1445 2025-02-26 14:09:01 +01:00
Folke Lemaitre
dd15e3a05a
fix(statuscolumn): right-align the current line number when relativenumber=true. Closes #1376 2025-02-23 08:37:11 +01:00
felipeymn
345eeb6941
fix(statuscolumn): only execute za when fold exists (#1093)
## Description

Currently, clicking the status column on a line without a fold results
in an error (see screenshot below). This PR adds a check before
executing `za` to prevent this issue.

## Screenshots

![statuscolumn](https://github.com/user-attachments/assets/c0377595-cdcc-438c-bd3f-2feabb3a220a)
2025-02-12 07:01:19 +01:00
Folke Lemaitre
98a7b647c9
feat(statuscolumn): added mouse click handler to open/close folds. Closes #968 2025-02-06 19:03:08 +01:00
莊加旭 (Max Chuang)
af559349e5
fix(statusline): fix status line cache key (#656)
## Description

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->
-
d972bc0a47
breaks cache key for virtual lines since `0 and 1 or 0` also evaluates
to 1 in lua.

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->
- Fixes #510 

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2025-01-20 13:26:20 +01:00
Folke Lemaitre
c4980ef9b4
fix(statuscolumn): return "" when no signs and no numbers are needed. Closes #570. 2025-01-18 10:50:14 +01:00
Folke Lemaitre
8a6e5b9685
feat(statuscolumn): allow changing the marks hl group. Fixes #390 2025-01-05 06:53:08 +01:00
Folke Lemaitre
cb42b952c5
feat(statuscolumn): allow left/right to be a function. Closes #288 2024-12-15 08:12:29 +01:00
Folke Lemaitre
140204fde5 build: added metadata to plugins 2024-12-10 13:55:51 +01:00
Folke Lemaitre
d972bc0a47
perf(statuscolumn): optimize caching 2024-12-07 21:33:08 +01:00
Folke Lemaitre
3647ca7d8a
fix(statuscolumn): add virtnum and relnum to cache key. See #198 2024-12-04 15:24:27 +01:00
Folke Lemaitre
f5fb59cc4c
fix(statuscolumn): don't show signs on virtual ligns. See #198 2024-12-04 15:24:04 +01:00
Folke Lemaitre
985be4a759
perf(statuscolumn): some small optims 2024-11-26 14:00:07 +01:00
Folke Lemaitre
b3a60c087a
docs(statuscolumn): duplicate help tags 2024-11-26 12:06:13 +01:00
Folke Lemaitre
7564a30cad
fix(statuscolumn): bad copy/paste!! Fixes #152 2024-11-23 14:29:07 +01:00
Folke Lemaitre
cf840087c5
fix(statuscolumn): never error (in case of E565 for example). Fixes #150 2024-11-23 13:10:33 +01:00
Folke Lemaitre
1c4c74828f feat(health): added health checks to plugins 2024-11-14 23:56:37 +01:00
Folke Lemaitre
97e0e1ec7f
fix(statuscolumn): ensure Snacks exists when loading before plugin loaded 2024-11-12 20:07:48 +01:00
Folke Lemaitre
7e6ea65f5f
docs: better docgen using treesitter 2024-11-09 14:42:09 +01:00
Folke Lemaitre
82ea3e68c4
docs: moar docs 2024-11-06 11:43:50 +01:00
Folke Lemaitre
c71f3c84f4
docs: update 2024-11-06 00:35:44 +01:00
Folke Lemaitre
99b1700015
feat: statuscolumn 2024-11-03 12:56:30 +01:00