Commit graph

23 commits

Author SHA1 Message Date
Folke Lemaitre
d6a38acbf5
feat(picker): new native diff mode (disabled by default). Can be used to show delta diffs for undo. Closes #1288 2025-02-18 20:47:11 +01:00
Folke Lemaitre
3baf95d3a1
feat(picker.undo): ctrl+y to yank added lines, ctrl+shift+y to yank deleted lines 2025-02-07 21:58:34 +01:00
Folke Lemaitre
811a24cc16
feat(picker.undo): added ctrl+y to yank added lines from undo 2025-02-07 10:21:18 +01:00
Folke Lemaitre
ba8badfe74
fix(picker.colorscheme): use wildignore. Closes #969 2025-02-06 21:39:03 +01:00
Folke Lemaitre
8c6c54e26a
ci: auto generate picker function types 2025-02-05 07:44:26 +01:00
Anton Kastritskii
62d99ed2a3
feat(picker.commands): do not autorun commands that require arguments (#879)
## Description

Currently when you use picker.commands to select a command that requires
an argument, it will cause an error. `:BlickCmd` is one example. To
avoid the error we can feed the keys to enter the command mode and
populate the command and leave it to the user what they want to do.

This is also what telescope
[does](415af52339/lua/telescope/builtin/__internal.lua (L399))
in its builtin command picker.

nargs values `*` or `?` mean that the command can be executed both with
arguments and without. I think it is safer to leave it to the user to
decide if they want them to either trigger a run or provide the
arguments. But happy to change it if you think running the commands by
default makes sense.

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-02-02 22:16:41 +01:00
Folke Lemaitre
72826a72de
fix(picker.undo): add newlines
Some checks failed
CI / ci (push) Failing after 0s
2025-02-02 09:50:09 +01:00
Folke Lemaitre
d61fb453c6
feat(picker.undo): make diff opts for undo configurable 2025-02-02 09:47:13 +01:00
Folke Lemaitre
8368176243
fix(picker.undo): cleanup tmp buffer 2025-02-02 09:37:59 +01:00
Folke Lemaitre
033db250cd
fix(picker.undo): disable swap for tmp undo buffer 2025-02-02 09:36:31 +01:00
Folke Lemaitre
3d4b8eeea9
perf(picker.undo): more performance improvements for the undo picker 2025-02-02 09:33:02 +01:00
Folke Lemaitre
c900e2cb3a
fix(picker.undo): copy over buffer lines instead of just the file 2025-02-02 09:20:28 +01:00
Folke Lemaitre
d4a5449813
perf(picker.undo): use a tmp buffer to get diffs. Way faster than before. Closes #863 2025-02-02 09:17:36 +01:00
Folke Lemaitre
44b8e38204
feat(picker.undo): better undo tree visualization. Closes #863 2025-02-02 08:25:18 +01:00
Folke Lemaitre
fbd39a48df
fix(picker.keymaps): added normalized lhs to search text 2025-01-31 06:38:06 +01:00
Folke Lemaitre
4179fc11ec refactor(picker.format): remove redundant depth and addes support for indent guides to file formatter 2025-01-30 17:56:14 +01:00
Folke Lemaitre
2762c37eb0
feat(picker.keymaps): improvements to keymaps picker 2025-01-23 09:14:29 +01:00
Folke Lemaitre
79a6eabd31
fix(picker.undo): use new API. Closes #707 2025-01-23 07:53:35 +01:00
Folke Lemaitre
5c45f1c193
feat(picker): added undo picker to navigate the undo tree. Closes #638 2025-01-19 21:54:18 +01:00
Folke Lemaitre
b170ced527
feat(picker): added spelling picker. Closes #625 2025-01-19 14:02:18 +01:00
Folke Lemaitre
ee988fa4b0
feat(picker.commands): added builtin commands. Fixes #634 2025-01-19 13:01:26 +01:00
Folke Lemaitre
c45a94044b
fix(picker.list): newlines in text. Fixes #607. Closes #580 2025-01-18 10:37:00 +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