Commit graph

116 commits

Author SHA1 Message Date
Folke Lemaitre
fa29c6c926
revert: dont always set border when setting title. Closes #1436 2025-02-26 07:55:13 +01:00
Folke Lemaitre
76311aba31
fix(win): make sure the border is set when setting the title 2025-02-25 20:25:53 +01:00
Folke Lemaitre
b100c93717
fix(win): use correct keys for displaying help. Closes #1364 2025-02-22 08:04:06 +01:00
Folke Lemaitre
a00c323d4b
fix(win): don't update title is relative win is invalid. Closes #1348 2025-02-21 08:06:52 +01:00
Folke Lemaitre
a1cb54cc9e
fix(win): call on_close before actually closing so that prev win can be set. Closes #962 2025-02-19 19:38:36 +01:00
Folke Lemaitre
77204102a1
fix(win): better handling when the command window is open. Closes #1245 2025-02-18 21:23:10 +01:00
Folke Lemaitre
c760b8b85b
refactor(win): move fixbuf to separate method 2025-02-16 08:21:52 +01:00
Folke Lemaitre
f36c70a912
fix(dashboard): dashboard can be a main editor window 2025-02-14 12:39:19 +01:00
max397574
f200b3f6c8
feat(picker): allow complex titles (#1112)
fixes https://github.com/folke/snacks.nvim/issues/1111

## Description

Allows more customization of the title

## Related Issue(s)

Fixes #1111 

## Screenshots


![image](https://github.com/user-attachments/assets/4244e94e-a321-4a9b-a0a0-28f010a7efcb)

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-02-13 12:22:56 +01:00
Folke Lemaitre
c5540974fa
fix(layout): make sure width/height are at least 1. Closes #1090 2025-02-12 08:04:39 +01:00
Folke Lemaitre
8272c1c66f
fix(all): better support for opening windows / pickers / ... on multiple tab pages. Closes #1043 2025-02-10 11:24:13 +01:00
Folke Lemaitre
cb99c46fa1
fix(win): apply win-local window options for new buffers displayed in a window. Fixes #925 2025-02-04 20:20:40 +01:00
Folke Lemaitre
c8430fdd8d
fix(win): better handling of alien buffers opening in managed windows. See #886 2025-02-03 10:41:16 +01:00
Folke Lemaitre
4aba559c6e
fix(win): close help when leaving the win buffer 2025-02-01 10:20:03 +01:00
Folke Lemaitre
e1566a483d
fix(util): better keymap normalization 2025-02-01 10:20:03 +01:00
Folke Lemaitre
18de5bb238
fix(win): properly handle closing the last window. Fixes #793 2025-01-30 22:26:39 +01:00
PFiS
6effbcdff1
fix(win): error when enabling padding with listchars="" (#786)
Some checks failed
CI / ci (push) Failing after 0s
## Description

`vim.split` would split `""` into `{ "" }`, causing `table.concat` to
output `",eol: "`.

Resolved by using `vim.tbl_filter` to filter out empty strings before
applying `table.concat`.
2025-01-29 21:07:36 +01:00
Folke Lemaitre
2f396b341d
fix(dashboard): prevent starting picker twice when no session manager. Fixes #783
Some checks failed
CI / ci (push) Failing after 0s
2025-01-29 13:09:02 +01:00
Folke Lemaitre
473be039e5
fix(win): don't destroy opts. Fixes #726 2025-01-24 07:00:29 +01:00
Folke Lemaitre
84ee7ddf54
fix(win): better way of finding a main window when fixbuf is true 2025-01-23 13:52:16 +01:00
acidclouds
bc47e0b1dd
feat(picker): preview window horizontal scrolling (#686)
## Description

This is an initial commit for trying to add horizontal scrolling for the
picker preview window.

Known issue: when scrolling horizontally with scope indent, the indent
chars persist in the preview window and don't disappear as they
should...

Edit:
I just realized this happens only when we are previewing a buffer that
is already open. Only in that case the indents are being rendered... if
we are previewing a file that is not currently open the indents don't
get rendered and therefore there is no issue. Maybe this is a bug?
Should we prevent rendering of the indent guides in the preview window?

## Related Issue(s)

  - Fixes #676 

## Screenshots


![image](https://github.com/user-attachments/assets/573fdba6-93cf-44f1-824d-609106996e6b)

---------

Co-authored-by: Val Gorokhovsky <valery.gorokhovsky@riverbed.com>
2025-01-23 09:13:54 +01:00
Folke Lemaitre
3fa2ea3115
perf(picker): gc optims 2025-01-21 18:33:13 +01:00
Folke Lemaitre
eebf44a34e
perf(picker): fixed some issues with closed pickers not always being garbage collected 2025-01-20 10:30:45 +01:00
Folke Lemaitre
abd7e61b73
fix(win): always close created scratch buffers when win closes 2025-01-19 23:40:36 +01:00
Folke Lemaitre
dc3f114c1f
fix(picker): add keymaps for preview scratch buffers 2025-01-19 17:33:57 +01:00
Folke Lemaitre
c49f38c5a9
fix(win): clear syntax when setting filetype 2025-01-19 14:02:18 +01:00
Folke Lemaitre
ece76b333a
fix(picker.preview): scratch buffer filetype. Fixes #595 2025-01-19 12:00:57 +01:00
Folke Lemaitre
540ecbd9a4
fix(picker): better normkey. Fixes #610 2025-01-18 14:51:27 +01:00
Folke Lemaitre
ad9b382f7d
fix(win): exclude cursor from redraw. Fixes #613 2025-01-18 14:28:34 +01:00
Folke Lemaitre
2e70b7f423
feat(picker): added {preview} and {flags} title placeholders. Closes #557, Closes #540 2025-01-18 09:35:22 +01:00
Folke Lemaitre
5ac80f0159
fix(win): special handling of <C-J>. Closes #565. Closes #592 2025-01-17 20:37:55 +01:00
Folke Lemaitre
825c106f40
fix(win): correctly deal with initial text containing newlines. Fixes #542 2025-01-16 22:35:48 +01:00
Folke Lemaitre
097e68fc72
fix(win): duplicate keymap should take mode into account. Closes #559 2025-01-16 22:01:56 +01:00
Folke Lemaitre
7865df0558
fix(picker): deepcopy before config merging. Fixes #554 2025-01-16 21:42:30 +01:00
Folke Lemaitre
a71b7c0d26
feat(win): warn on duplicate keymaps that differ in case. See #554 2025-01-16 20:39:23 +01:00
Folke Lemaitre
3fdb7f4461
style(win): luals annotations 2025-01-16 09:08:19 +01:00
Folke Lemaitre
5b1cd464e8
fix(win): fix relative=cursor again 2025-01-16 09:05:06 +01:00
Folke Lemaitre
743f8b3fee
fix(win): relative=cursor. Closes #427. Closes #477 2025-01-16 08:45:36 +01:00
Folke Lemaitre
559d6c6bf2
feat(snacks): added snacks.picker (#445)
## Description

More info coming tomorrow.

In short:
- very fast. pretty much realtime filtering/sorting in huge repos (like
1.7 million files)
- extensible
- easy to customize the layout (and lots of presets) with
`snacks.layout`
- simple to create custom pickers
- `vim.ui.select`
- lots of builtin pickers
- uses treesitter highlighting wherever it makes sense
- fast lua fuzzy matcher which supports the [fzf
syntax](https://junegunn.github.io/fzf/search-syntax/) and additionally
supports field filters, like `file:lua$ 'function`

There's no snacks picker command, just use lua.

```lua
-- all pickers
Snacks.picker()

-- run files picker
Snacks.picker.files(opts)
Snacks.picker.pick("files", opts)
Snacks.picker.pick({source = "files", ...})
```

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Todo
- [x] issue with preview loc not always correct when scrolling fast in
list (probably due to `snacks.scroll`)
- [x] `grep` (`live_grep`) is sometimes too fast in large repos and can
impact ui rendering. Not very noticeable, but something I want to look
at.
- [x] docs
- [x] treesitter highlights are broken. Messed something up somewhere

## Related Issue(s)

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

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2025-01-14 22:53:59 +01:00
Folke Lemaitre
ee08b1f32e
fix(win): win position with border offsets. Closes #413. Fixes #423 2025-01-05 19:12:23 +01:00
Chris Grieser
373d0f9b6d
fix(win): backdrop having bright cell at top right (#400)
## The bug
`backdrop` displays a bright cell at the top left. upon investigation, I
figured out that it's created by the user's `colorcolumn` setting also
being applied to the backdrop.

## The fix
Disable `colorcolumn` for the backdrop window.

## Screenshots

before
![Pasted image 2024-12-27 at 14 16
40@2x](https://github.com/user-attachments/assets/8495330e-cec3-46bb-ac8c-c009865a18e3)

after
![Pasted image 2024-12-27 at 14 17
14@2x](https://github.com/user-attachments/assets/2d0b46e5-a74a-4e01-aa01-e35536eb042c)
2024-12-31 06:21:15 +01:00
Folke Lemaitre
60adc6ac8a
docs: docgen 2024-12-31 06:20:31 +01:00
Folke Lemaitre
cc0b52872b
feat(win): better dimension calculation for windows (use by upcoming layouts) 2024-12-31 06:15:54 +01:00
Folke Lemaitre
320ecbc15c
feat(win): top,right,bottom,left borders 2024-12-31 06:15:05 +01:00
Folke Lemaitre
402494bdee
feat(win): allow setting desc for window actions 2024-12-31 06:14:20 +01:00
Folke Lemaitre
93aabee9b2
refactor(win): manage window events 2024-12-31 06:13:15 +01:00
Folke Lemaitre
4cd0647eb5
feat(win): Snacks.win:border_size 2024-12-31 06:10:03 +01:00
Folke Lemaitre
a7899f58cf
refactor(win): __index 2024-12-31 06:05:17 +01:00
Folke Lemaitre
0711a82b7a
feat(win): Snacks.win:redraw 2024-12-31 06:04:30 +01:00
Folke Lemaitre
dd50e53a9e
fix(win): force-close any buffer that is not a file 2024-12-31 06:03:48 +01:00