Commit graph

24 commits

Author SHA1 Message Date
Folke Lemaitre
8e0dfd2856
fix(git): use nul char as separator for git status 2025-02-04 19:08:38 +01:00
Folke Lemaitre
85e1b343b0
feat(explorer): add hl groups for ignored / hidden files. Closes #887 2025-02-03 11:37:14 +01:00
Folke Lemaitre
5cae48d93c
feat(explorer): added git status. Closes #817 2025-01-31 19:08:32 +01:00
Folke Lemaitre
d76d9aaaf2
fix(git): basic support for git work trees 2025-01-30 23:37:50 +01:00
Folke Lemaitre
e960010496
fix(picker.git): better stash pattern. Closes #775 2025-01-29 00:07:58 +01:00
Folke Lemaitre
7da5d953f9
style(picker.git): luals annotations 2025-01-28 16:32:19 +01:00
Folke Lemaitre
3cdebee880
fix(picker.git): default to git root for git_files. Closes #751 2025-01-28 16:29:26 +01:00
Folke Lemaitre
2b15357c25
fix(picker.git): ignore autostash 2025-01-28 16:06:21 +01:00
Folke Lemaitre
bb3db117a4
feat(picker): added git_stash picker. Closes #762 2025-01-28 16:05:30 +01:00
Folke Lemaitre
9c0e2d4362
refactor(picker): pass finder context to transform 2025-01-22 23:49:56 +01:00
Folke Lemaitre
4c2827246a
refactor(picker.proc): make it easier to customize proc finders 2025-01-22 23:49:56 +01:00
Folke Lemaitre
caf20764f1
refactor(picker.finder): function signature of finders changed to fun(opts, ctx) 2025-01-22 23:49:56 +01:00
Folke Lemaitre
2cac6678a9
fix(picker.git): parse all detached states. See #671 2025-01-21 08:42:12 +01:00
Kyle Whliang
390f687431
fix(picker.git_branches): handle detached HEAD (#671)
## Description

Handle [detached
HEAD](https://git-scm.com/docs/git-checkout#_detached_head)

- list: display correct information
- preview: without error notification
- action: checkout the commit that HEAD detached at

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

## Related Issue(s)

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

- Fixes #672 

## Screenshots

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

Before:
<img width="1308" alt="image"
src="https://github.com/user-attachments/assets/fad291a3-a730-4a2b-9eb2-4a0edd83d794"
/>

After:
<img width="1038" alt="image"
src="https://github.com/user-attachments/assets/d312579a-e12d-4286-845c-a706d91a6c95"
/>

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-01-20 20:03:38 +01:00
Folke Lemaitre
23a8668ef0
fix(picker.git): --follow only works for git_log_file. Closes #666 2025-01-20 16:04:41 +01:00
Folke Lemaitre
8563dfce68
feat(picker): added git_branches picker. Closes #614 2025-01-19 16:24:35 +01:00
Folke Lemaitre
903431903b
fix(picker.git): git log file/line for a file not in cwd. Fixes #616 2025-01-19 14:22:30 +01:00
Kristijan Husak
43c312dfc1
fix(picker): show all files in git status (#586)
## Description

When new folder is created in a git project, and there are files inside,
git status picker only shows the folder without any preview. Adding
`-uall` to the commands lists them all.

## Related Issue(s)



## Screenshots

Before: 

![screenshot_2025_01_17_15_42_14](https://github.com/user-attachments/assets/e556f563-dc63-472e-9543-bc784e6e1a35)

After: 

![screenshot_2025_01_17_15_43_13](https://github.com/user-attachments/assets/d6b6d715-02fd-4c77-b167-5c62058153dc)
2025-01-17 20:41:13 +01:00
Folke Lemaitre
1481a90aff
fix(picker.git): git_file and git_line should only show diffs including the file. Fixes #522 2025-01-16 23:21:49 +01:00
Folke Lemaitre
de01218d1d
style(picker.git): lua annotations 2025-01-16 09:58:57 +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
a2fb70e8ba
fix(picker.git): use Snacks.git.get_root instead vim.fs.root for backward compatibility 2025-01-15 21:18:52 +01:00
Kristijan Husak
2cc7cf42e9
fix(picker): set correct cwd for git status picker (#505)
## Description

Cwd was wrong for git status picker.

## Related Issue(s)

- Fixes #504
2025-01-15 20:44:04 +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