Commit graph

2102 commits

Author SHA1 Message Date
folke
ffff5e0850 chore(build): auto-generate docs 2025-10-19 05:44:58 +00:00
Kim A. Ødegaard
02bf7d2205
fix(indent): nil check before setting extmark (#1635)
## Description

Resolves the following error, which occurs when removing a visual line
selection in a TypeScript file when `indent.scope.underline` is `true`:

```
  Error  Error in decoration provider snacks_indent.win:
Error executing lua: ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:317: attempt to get length of local 'scope_from' (a nil value)
stack traceback:
  ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:317: in function 'render_scope'
  ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:285: in function 'on_win'
  ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:496: in function <....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:494>
  [builtin#36]: at 0x7f91509530e0
  ...ghtly/share/nvim/runtime/lua/vim/lsp/semantic_tokens.lua:307: in function 'handler'
  ...rapped-nightly/share/nvim/runtime/lua/vim/lsp/client.lua:679: in function ''
  vim/_editor.lua: in function <vim/_editor.lua:0>
Error in decoration provider snacks_indent.win:
Error executing lua: ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:317: attempt to get length of local 'scope_from' (a nil value)
stack traceback:
  ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:317: in function 'render_scope'
  ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:285: in function 'on_win'
  ....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:496: in function <....local/share/nvim/lazy/snacks.nvim/lua/snacks/indent.lua:494>
  [C]: in function 'nvim_command'
  ....local/share/nvim/lazy/nui.nvim/lua/nui/popup/border.lua:624: in function '_relayout'
  ...m/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:390: in function 'update_layout'
  ....local/share/nvim/lazy/noice.nvim/lua/noice/view/nui.lua:246: in function <....local/share/nvim/lazy/noice.nvim/lua/noice/view/nui.lua:245>
  [C]: in function 'pcall'
  ....local/share/nvim/lazy/noice.nvim/lua/noice/view/nui.lua:143: in function 'reset'
  ...local/share/nv
```

## Steps to reproduce

Edit a TypeScript file with the following contents:

```typescript
//

const test = {
};
````

Remove the file contents with `ggVGd` to trigger the error.
2025-10-19 07:43:55 +02:00
folke
5fe867396b chore(build): auto-generate docs 2025-10-19 05:43:12 +00:00
Iordanis Petkakis
da655a3538
fix(lazygit): allow extensible user args (#789)
## Description
Currently `opts.args` are set to a specific value. Allow users to
optionally pass their own additional args.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
None
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2025-10-19 07:42:25 +02:00
folke
eea7dccfde chore(build): auto-generate docs 2025-10-19 05:41:01 +00:00
Iordanis Petkakis
bebf0bd38e
fix(scope): allow user to disable keys (#1918)
## Description
Currently the user is not able to disable the existing keys in
`keys.textobject`, because if he sets for example `ii = false`, it
throws an error about not being able to index `opts`.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
None, rather a LazyVim discussion
https://github.com/LazyVim/LazyVim/discussions/6118
<!--
  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-19 07:40:07 +02:00
folke
425c1e8e85 chore(build): auto-generate docs 2025-10-19 05:39:04 +00:00
Iordanis Petkakis
b9bd8ae982
fix(picker.actions): take into account if source is recent explicitly (#1920)
## Description
I noticed in the project picker that when pressing `<c-r>` to show
recent files it showed recent files from everywhere instead of only the
item's directory. When the source is `recent` we have to pass
`filter.cwd = ...` so that it correctly filters out recent items.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
None
<!--
  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-19 07:38:06 +02:00
folke
b59ef39194 chore(build): auto-generate docs
Some checks failed
CI / ci (push) Has been cancelled
2025-10-17 19:17:28 +00:00
Iordanis Petkakis
457596be6d
fix(projects): normalize item.text for correct Windows support (#2275)
## Description
`Snacks.picker.projects` would not show correctly projects on Windows.
`item.text` was something like
`C:\Users\my_user\AppData\Local\nvim-data\lazy\LazyVim\.git\`.

By normalizing `item.text` it shows correctly the projects.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
None
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2025-10-17 21:16:24 +02:00
folke
4d261c207f chore(build): auto-generate docs 2025-10-17 19:15:54 +00:00
folke
02606dbcaa chore(build): auto-generate docs 2025-10-17 19:14:57 +00:00
Iordanis Petkakis
39b14c4006
feat(terminal): minor improvements for user experience (#2276)
## Description
I was trying to create a simple `select` picker to choose terminals to
open.

With the current implementation only the fields `cmd` and `id` are
exposed. `cwd` and `env` are not which are used to get the terminal id
as well.

`M.list()` uses `vim.tbl_filter` which turns `terminals` into a list
removing the keys terminal ids. Even if that was not the case (i.e using
a normal `for` loop to add to `terminals`) the keys would be a string
due to `vim.inspect` and one would have to use patterns to extract
information from them.

It's easier to just add `cwd` and `env` to `vim.b[buf].snacks_terminal`
to have that information available and be easier for users to manipulate
which terminal they want to choose and open.

Also added `opts.count` as an option to be able to programmatically
choose the terminal with exactly the same options when it was created,
so one can just do
```lua
local term = vim.b[buf].snacks_terminal
Snacks.terminal(term.cmd, { cwd = term.cwd, env = term.env, count = term.id })
```
to programmatically invoke a certain terminal.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Solves my issue and #2271 as well.
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2025-10-17 21:14:56 +02:00
Folke Lemaitre
4edf207bfe
fix(picker.actions): multi-action descriptions. Fixes #1501 2025-10-17 21:13:56 +02:00
Folke Lemaitre
b064be2882
fix(picker): load correct actions in list of action names. Closes #1501 2025-10-17 21:13:56 +02:00
folke
454ba02d69 chore(build): auto-generate docs
Some checks failed
CI / ci (push) Has been cancelled
2025-10-14 16:30:07 +00:00
Liu Zehao
943a3c7d4a
fix(dim): fixed the issue of dim's scope variable being nil and outputting… (#1938)
## Description

During my use of dim, I found that an empty document can cause Snacks to
output error messages, resulting in an instant freeze when opening an
empty file

## Related Issue(s)

- Fixes #1810 

## Screenshots
before change

![before-fix-dim](https://github.com/user-attachments/assets/203791d7-629a-4650-9c87-a04fb81bad3d)


after change

![after-fix-dim](https://github.com/user-attachments/assets/44097f7d-2229-4407-8868-388e758774b5)
2025-10-14 18:29:08 +02:00
folke
839022302b chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-10-13 18:13:32 +00:00
Folke Lemaitre
914c9004be
fix(bufdelete): try alternate buffer first and otherwise last used buffer 2025-10-13 20:12:34 +02:00
folke
b8d838d8be chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-10-12 19:56:41 +00:00
S1M0N38
125978b57a
fix(picker): add type field to qflist item (#1538) (#1539)
Fix for #1538

## Screenshots

**Old**

<img width="1232" alt="Screenshot 2025-03-09 at 10 40 24"
src="https://github.com/user-attachments/assets/e8b9d122-0f75-4c04-9ee8-509314232e36"
/>

---

**After fix**
<img width="1259" alt="Screenshot 2025-03-09 at 10 40 58"
src="https://github.com/user-attachments/assets/2048d0c6-56c8-4359-927e-444c2b190671"
/>
2025-10-12 21:55:43 +02:00
folke
38fbb948bc chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-10-12 10:15:20 +00:00
Folke Lemaitre
71d6d3cad4
fix(layout): allocate at least 1 cell for a widget and enlarge/shrink the root box when needed. Closes #2261 2025-10-12 12:14:13 +02:00
folke
aaab014bc6 chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-10-11 09:10:44 +00:00
Folke Lemaitre
5c63614880
feat(picker.select): select now fits the list to the items independent of the layout. Closes #2035 2025-10-11 11:09:40 +02:00
Folke Lemaitre
722f9eac7c
feat(picker.layout): added config hook for resolved layouts. See #2035 2025-10-11 11:09:40 +02:00
Folke Lemaitre
ba7845bb85
feat(layout): static (non-flex) layouts now shrink the root box to fit the contents. See #2035 2025-10-11 11:09:40 +02:00
folke
d91fc7d3fa chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-10-10 18:40:52 +00:00
Nick deLannoy
3731644e38
fix(lazygit): check if default config file exists before adding to LG_CONFIG_FILE (#2256)
## Description

I noticed that lazygit was erroring out on open when the default config
file was missing even though lazygit outside of neovim opened fine
without it. Tracked it to the `LG_CONFIG_FILE` var that tells lazygit to
error out when any of the files are missing - and snacks was setting
this to include the default config even when it didn't exist.

## Related Issue(s)

fixes issue: https://github.com/folke/snacks.nvim/issues/1548
2025-10-10 20:39:58 +02:00
folke
94f10539a6 chore(build): auto-generate docs 2025-10-10 14:10:54 +00:00
Folke Lemaitre
c3d6c01916
feat(layout): height=0.7 for preview in vscode layout 2025-10-10 16:09:39 +02:00
Folke Lemaitre
114040b444
build: skip doc comments with @deprecated 2025-10-10 16:09:12 +02:00
folke
dae80fb393 chore(build): auto-generate docs
Some checks failed
CI / ci (push) Has been cancelled
2025-10-08 19:34:47 +00:00
Folke Lemaitre
268dc46c26
ci: update minit.lua 2025-10-08 21:33:23 +02:00
Folke Lemaitre
30d8b32220
ci: update test scripts 2025-10-08 21:26:25 +02:00
folke
bfe8c26dbd chore(build): auto-generate docs
Some checks failed
CI / ci (push) Has been cancelled
2025-09-30 16:17:27 +00:00
Folke Lemaitre
ba745ba281
fix(picker.lsp_config): cmd can be a function 2025-09-30 18:16:04 +02:00
folke
ff3c49a19a chore(build): auto-generate docs 2025-09-30 15:38:57 +00:00
Folke Lemaitre
636be5c3d1
feat(picker.lsp_config): added more info to lsp picker 2025-09-30 17:38:04 +02:00
folke
bfc98ad198 chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-09-30 11:39:08 +00:00
Folke Lemaitre
db399b1332
fix(main): get correct winid for prev window 2025-09-30 13:38:11 +02:00
folke
5d9dacd098 chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-09-29 07:02:23 +00:00
Folke Lemaitre
264cab1380
feat(picker): added custom options to vim.ui.select that snacks can use for a better select 2025-09-29 09:01:21 +02:00
folke
5e0e869852 chore(build): auto-generate docs
Some checks failed
CI / ci (push) Has been cancelled
2025-09-27 07:39:57 +00:00
Folke Lemaitre
dc65ffd4f5
fix(dashboard): pcall chansend for dashoard terminal widgets 2025-09-27 09:39:06 +02:00
folke
f6c06415a2 chore(build): auto-generate docs
Some checks failed
CI / ci (push) Has been cancelled
2025-09-25 10:46:07 +00:00
nickx00
7a5eb1036a
fix(explorer): mounted directories being detected as non-directories in Tree:expand (#2053)
## Description

In certain filesystems — such as bind mounts, NFS, FUSE, or other
mounted paths — uv.fs_scandir_next() may return a nil type for valid
directories. This causes the snacks.nvim explorer to treat mounted
folders as files, making them unexpandable in the UI.

This patch adds a fallback to resolve the correct type when
fs_scandir_next() returns nil. It uses uv.fs_stat() first, and falls
back to vim.fn.isdirectory() if needed.

This ensures that mounted directories are properly marked as navigable.

Code change summary:

- Inside Tree:expand, we now check t == nil
- If so, we call uv.fs_stat() to get the true type
- If fs_stat fails, we fallback to vim.fn.isdirectory
- Final dir = true logic remains intact

Impact:
- Fixes a long-standing bug in mounted directories under /mnt, FUSE,
etc.
- Only runs extra checks when needed (no performance hit for regular
files)
- No changes elsewhere — clean, isolated patch

## Related Issue(s)
  - Fixes #2036

## Screenshots

before:
<img width="1907" height="946" alt="image"
src="https://github.com/user-attachments/assets/15e1b8a5-c999-49e8-8ab5-1d23c60e4969"
/>

after:
<img width="343" height="902" alt="Screenshot_20250715_222920"
src="https://github.com/user-attachments/assets/c7ca2fa0-e0cc-4e3d-a4bb-5345538408f7"
/>

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2025-09-25 12:45:01 +02:00
folke
68da653d20 chore(build): auto-generate docs
Some checks are pending
CI / ci (push) Waiting to run
2025-09-24 16:27:03 +00:00
Folke Lemaitre
12b2f0d2bd
fix(picker.preview): dont do win-local hack for floating windows 2025-09-24 18:26:02 +02:00
folke
f74ae636b8 chore(build): auto-generate docs 2025-09-24 16:22:20 +00:00