Commit graph

189 commits

Author SHA1 Message Date
Folke Lemaitre
8293add1e5
perf(picker): dont use prompt buffer callbacks 2025-01-17 22:32:14 +01:00
Folke Lemaitre
84c3738fb0
feat(picker): added jump options jumplist(true for all), reuse_win & tagstack (true for lsp). Closes #589. Closes #568 2025-01-17 21:28:14 +01:00
Biggybi
64026877ad
feat(picker): custom icon for unselected entries (#588)
Snacks picker allows setting an icon for selected list entries.
With this PR, we can also select one for unselected entries.

I think it looks great.


![image](https://github.com/user-attachments/assets/f97543ae-b0ab-4490-9fd5-f8d8f1b804a9)

(Replica of #583 which I closed by mistake, sorry about that.)

---------

Co-authored-by: biggybi <biggybi@pm.me>
Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-01-17 21:05:54 +01:00
Sergey Kochetkov
3739b5f8ff
chore(picker): fix typo (#587)
## Description

Fixed typo for the `Unknown` icon
2025-01-17 20:40:52 +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
9986b47707
fix(picker.config): better config merging and tests 2025-01-17 20:36:33 +01:00
Folke Lemaitre
706b1abc16
fix(picker.config): allow merging list-like layouts with table layout options 2025-01-17 14:50:47 +01:00
Folke Lemaitre
192fb31c4b
feat(picker): added exclude option for files and grep. Closes #581 2025-01-17 14:35:29 +01:00
Folke Lemaitre
924a988d9a
feat(picker.list): better way of highlighting field patterns 2025-01-17 12:40:37 +01:00
Folke Lemaitre
be421822d5
feat(picker.sources): lines just sorts by score/idx. Smart sorts on empty 2025-01-17 09:42:57 +01:00
Folke Lemaitre
ed91078625
feat(picker.matcher): added opts.matcher.sort_empty and opts.matcher.filename_bonus 2025-01-17 09:42:35 +01:00
Folke Lemaitre
d5ccb301c1
feat(picker.matcher): moved length tiebreak to sorter instead 2025-01-17 09:41:36 +01:00
Folke Lemaitre
7865df0558
fix(picker): deepcopy before config merging. Fixes #554 2025-01-16 21:42:30 +01:00
Folke Lemaitre
afef949d88
fix(picker.config): normalize keys before merging so you can override <c-s> with <C-S> 2025-01-16 20:40:16 +01:00
Folke Lemaitre
772f3e9b89
feat(picker): added smart picker 2025-01-16 13:01:05 +01:00
Folke Lemaitre
7267e2493b
feat(picker.matcher): integrate custom item scores 2025-01-16 12:57:26 +01:00
Folke Lemaitre
ba3a68f988
style(picker): cleanup 2025-01-16 12:56:51 +01:00
Folke Lemaitre
123f0d9e5d
fix(picker.input): don't set prompt interrupt, but use a <c-c> mapping instead that can be changed 2025-01-16 12:56:28 +01:00
Anton Kastritskii
cc69043689
feat(picker.git): added git_diff picker for diff hunks (#519)
Hi and thank you for the useful plugin!

## Description

I have been exploring the new picker api and got this git diff picker
working which I think can be a nice addition to the existing set of
picker. The key difference from the existing git_status picker is that
it separates each hunk into its own item similar to `git add --patch`
and when you select an item it takes you to the first hunk's line
instead of top of the buffer. Before I put more effort into it I would
like to see if this is a welcome change first.

This implementation can be further extended by allowing to support
additional arguments such as `--staged`, `--ignore-all-space` or both.

A few points on current implementations. I could not get the per line
parsing to work using the
`require("snacks.picker.source.proc").proc(...)` and fell back to
manually parsing the output after the command finished executing. There
are likely many ways to improve it. I have been using it with telescope
for about a year and so far it worked great. I think more people can
benefit from this picker.

## Related Issue(s)

none

## Screenshots

Demo


https://github.com/user-attachments/assets/6cdfa48e-bc29-4194-8430-092fbc5f3dcd

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-01-16 09:54:31 +01:00
Folke Lemaitre
f06f14c4ae
fix(layout): allow root with relative=cursor. Closes #479 2025-01-16 09:08:19 +01:00
Folke Lemaitre
2479ff7cf4
feat(picker.buffers): del buffer with ctrl+x 2025-01-16 08:54:30 +01:00
Folke Lemaitre
821e23101f
feat(picker.list): added debug option to show scores 2025-01-16 08:09:44 +01:00
Folke Lemaitre
2ab18a0b9f
feat(picker.buffers): delete buffers with dd 2025-01-15 22:18:28 +01:00
Folke Lemaitre
0892db4f42
feat(picker.git): stage/unstage files in git status with <tab> key 2025-01-15 22:12:19 +01:00
Folke Lemaitre
a652214f52
fix(picker.preview): don't show line numbers for preview commands 2025-01-15 21:18:52 +01:00
Folke Lemaitre
98562ae6a1
feat(pickers.format): added opts.picker.formatters.file.filename_first 2025-01-15 19:50:52 +01:00
Folke Lemaitre
e36e6af96c
feat(picker.git): git diff/show can now use native or neovim for preview. defaults to neovim. Closes #500. Closes #494. Closes #491. Closes #478 2025-01-15 19:00:33 +01:00
Folke Lemaitre
c9e2695969
feat(picker.list): added select_all action mapped to ctrl+a 2025-01-15 17:25:33 +01:00
Folke Lemaitre
8386540c42
fix(picker): changed inspect mapping to <a-d> since not all terminal differentiate between <a-i> and <tab> 2025-01-15 16:44:18 +01:00
Folke Lemaitre
000db17bf9
feat(picker): added preliminary support for combining finder results. More info coming soon 2025-01-15 10:58:31 +01:00
Folke Lemaitre
46554a6342
fix(picker): add alias for oldfiles 2025-01-15 10:35:29 +01:00
Folke Lemaitre
2ba165b826
feat(picker): added inspect action mapped to <c-i>. Useful to see what search fields are available on an item. 2025-01-15 10:32:27 +01:00
Folke Lemaitre
76fbf9e8a8
feat(picker): allow disabling file icons 2025-01-15 09:33:18 +01:00
Folke Lemaitre
5a83a8e328
feat(picker): add some source aliases like the Telescope / FzfLua names 2025-01-15 06:38:47 +01:00
Folke Lemaitre
0437cfd98e
feat(picker.grep): added ft (rg's type) and regex (rg's --fixed-strings) options 2025-01-15 06:34:31 +01:00
Folke Lemaitre
4a9dcdf552
docs: added example mapping to use ESC in insert mode to close 2025-01-15 00:13:16 +01:00
Folke Lemaitre
89847bd76d
docs: more docs 2025-01-14 23:36:28 +01:00
Folke Lemaitre
e0febc4557
style(picker): visual for cursorline 2025-01-14 23:00:26 +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