Commit graph

24 commits

Author SHA1 Message Date
Folke Lemaitre
443a3bd6e2
docs: make some scratch methods private 2025-10-31 23:22:07 +01:00
Folke Lemaitre
85f8e22281
feat(scratch): store scratch info in meta files, instead of the filename + custom filekeys 2025-10-30 16:09:47 +01:00
Folke Lemaitre
c8422da50d
fix(scratch): make sure zindex of scratch window is higher than existing floating windows 2025-10-30 13:50:06 +01:00
maskudo
ca0f8b2c09
feat(picker.scratch): add scratch picker with grep, new and delete keybinds (#1019)
## Description


The scratch module uses `vim.ui.select` which misses the nice things
about the picker.
This implementation adds scratch picker with ability to create, grep and
delete scratch buffers.

Couldn't figure out how to prettify the scratch buffer's name so any
help would be appreciated.
## 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. -->

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-23 10:53:02 +02:00
Folke Lemaitre
c1737d866e
feat(win): all existing snacks windows for all plugins now honor vim.o.winborder. Defaults to rounded if not set. 2025-10-22 23:06:35 +02:00
Valentin Degenne
b8d17192b6
feat(win): generalize footer options for keys (#363)
#fixes https://github.com/folke/snacks.nvim/issues/361

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-10-22 22:36:09 +02:00
Frank Blendinger
98345c7012
fix(scratch): branch fallback for detached head (#1519)
## Description

I work a lot with detached `HEAD` in Git repos and noticed that the
scratch files for those were missing in `Snacks.scratch.select()`.

When working with a detached head, the `git branch --show-current`
returns an empty string, so ret will be `nil` in this case. This breaks
the scratch filename generation. The `table.concat` skips the `nil`
value, so the generated filename is missing one `|` separator. This will
later break in `M.list()`: `file_decode` and `match` will confuse
`branch` and `ft`, and the entry is not added to the items list.

A simple fix for this is to fallback to an empty string for the branch
name.

## Related Issue(s)

I didn't create an issue but fixed the problem right away. Hope this is
fine.

## Screenshots

I can provide one if requested.
2025-10-19 11:05:37 +02:00
EasonMo
4379085616
fix(scratch): hide buffer after formatting when close (#1523)
## Description

When you format code in scratch, the scratch buffer will be opened in
bufferline. The buffer will not disappear even after the scratch window
is closed.

## Related Issue(s)

## Screenshots


![image](https://github.com/user-attachments/assets/463289c8-9a40-4a2f-ae13-65f2d142343c)

![image](https://github.com/user-attachments/assets/e9d058c6-dc9a-43d2-866b-26a33c272a96)

![image](https://github.com/user-attachments/assets/f8f46c66-a3f6-4d49-8442-7544ad2d0d02)
2025-10-19 10:13:03 +02:00
Wen
ba90011a14
fix(scratch): use icon[1] when icon is a table to avoid table.concat error (#2242)
## Description

Problem: opts.icon can be a table {icon, icon_hl} but the code inserts
opts.icon directly into filekey and later does table.concat(filekey,
"|"). That crashes when an element is a table.

Fix: use the first element of opts.icon when opts.icon is a table
(fallback to opts.icon or "").

## Related Issue(s)

N/A

## Screenshots

This happens when scratch.opts.icon is a table per documentation
<img width="1453" height="159" alt="image"
src="https://github.com/user-attachments/assets/c22cf58e-517d-400d-87d4-d05830df530d"
/>
2025-10-19 10:03:43 +02:00
Folke Lemaitre
bc902f7032
feat(compat): added svim, a compatibility layer for Neovim. Closes #1321 2025-02-20 06:59:44 +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
Ronuk Raval
8d2e26cf27
fix(scratch): autowrite right buffer. Fixes #449. (#452)
## Description

When toggling scratch closed, it's possible for the active buffer to be
something other than the scratch buffer.

This results in the autowrite behaviour triggering a `write` for
whatever that active buffer was and leaving the scratch buffer as dirty.

## Related Issue(s)

- Fixes #449.
2025-01-13 21:52:20 +01:00
Folke Lemaitre
5200a8baa5
fix(scratch): normalize filename 2024-12-13 13:23:36 +01:00
Folke Lemaitre
33fbb309f8
fix(compat): fixes for Neovim < 0.10 2024-12-11 23:20:28 +01:00
Folke Lemaitre
140204fde5 build: added metadata to plugins 2024-12-10 13:55:51 +01:00
Folke Lemaitre
d6309c62b8 feat(util): set_hl no longer sets default=true when not specified 2024-12-10 13:55:51 +01:00
Folke Lemaitre
0df7a08b01
fix(scratch): sort keys. Fixes #193 2024-12-03 09:45:44 +01:00
Folke Lemaitre
50bd5103ba
fix(scratch): make sure win.opts.keys exists. See #190 2024-12-03 09:18:10 +01:00
Folke Lemaitre
652303e6de
feat(scratch): opts.ft can now be a function and defaults to the ft of the current buffer or markdown 2024-12-02 21:03:49 +01:00
Folke Lemaitre
6c25ab1108
fix(scratch): floating window title/footer hl groups 2024-12-02 21:03:11 +01:00
Folke Lemaitre
6db50cfe2d
fix(scratch): always set filetype on the buffer. Fixes #179 2024-12-01 20:06:04 +01:00
Folke Lemaitre
32c46b4e2f
feat(scratch): use Snacks.debug.run() to execute buffer/selection 2024-12-01 12:46:52 +01:00
Folke Lemaitre
7db0ed4239
feat(scratch): change keymap to execute buffer/selection to <cr> 2024-12-01 12:46:24 +01:00
Folke Lemaitre
1cec695fef
feat(snacks): added new scratch snack 2024-12-01 09:08:03 +01:00