Commit graph

64 commits

Author SHA1 Message Date
Folke Lemaitre
8b0e79ab4c
fix(dashboard): escape filenames for edit. Closes #1453 2025-02-27 08:36:29 +01:00
Folke Lemaitre
bc902f7032
feat(compat): added svim, a compatibility layer for Neovim. Closes #1321 2025-02-20 06:59:44 +01:00
Joshua Li
b91f417670
perf(dashboard): speed up filtering for recent_files (#1250)
## Description

I have 5000 oldfiles, every time i go to a new directory and open nvim,
the dashboard recent_files (with `cwd=true`) computation takes 4-5
seconds to go through all oldfiles before deciding nothing should show
up

```lua
sections = {
  { icon = " ", title = "Recent files (current directory)", section = "recent_files", cwd = true },
}
```

It appears to be the `vim.v.oldfiles[i]` indexing. I didn't look much
into it but it opens much faster looping with ipairs.

Repro:
1. add the above section config in dashboard
2. increase oldfiles limit and populate up to the limit
3. `mkdir brand-new-directory; cd brand-new-directory; nvim`
4. the section is empty as expected, but it takes a few seconds before
dashboard shows up

## 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-02-18 23:05:55 +01:00
Folke Lemaitre
c2f06daeca
fix(dashboard): use Snacks.util.icon for icons. Closes #1192 2025-02-15 12:27:37 +01:00
Folke Lemaitre
f36c70a912
fix(dashboard): dashboard can be a main editor window 2025-02-14 12:39:19 +01:00
Folke Lemaitre
e3ead3c648
fix(dashboard): allow dashboard to be the main editor window 2025-02-14 07:04:56 +01:00
Folke Lemaitre
5420a64b66
feat(dashboard): play nice with file explorer netrw replacement 2025-01-31 07:44:44 +01:00
Folke Lemaitre
558b0ee04d
fix(dashboard): update on VimResized and WinResized 2025-01-31 07:44:12 +01:00
Folke Lemaitre
2f396b341d
fix(dashboard): prevent starting picker twice when no session manager. Fixes #783
Some checks failed
CI / ci (push) Failing after 0s
2025-01-29 13:09:02 +01:00
soulsoiledit
5ff2ad320b
fix(dashboard): don't override user configuration (#774)
## Description

When `picker` is enabled, the original line removes it from the table
and reinserts it as the first element, preventing the user configuration
in `preset.picker` from being used as the picker. This change inserts it
as the second element instead.
2025-01-29 06:55:44 +01:00
Folke Lemaitre
6cb7fdfb03
fix(dashboard): better handling of closed dashboard win 2025-01-28 12:19:33 +01:00
Folke Lemaitre
d44b978d7d
fix(dashboard): fix dasdhboard when opening in a new win. Closes #767 2025-01-28 08:50:55 +01:00
Folke Lemaitre
32cd34383c
fix(dashboard): added optional filter for recent files 2025-01-20 12:14:54 +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
Jay Madden
d312053f78
fix(dashboard): hash dashboard terminal section caching key to support long commands (#381)
## Description

This change hashes the caching key for snacks dashboards terminal
sections instead of building the key from the command itself. This
allows for arbitrary length scripts to be given as a terminal section
command instead of relying on existing commands in PATH.

## Related Issue(s)

#379 

## Screenshots

<img width="1176" alt="image"
src="https://github.com/user-attachments/assets/77a376c1-75b6-4023-8984-efd590f66a68"
/>
2024-12-31 06:24:21 +01:00
Folke Lemaitre
dcc5338e6f
fix(dashboard): telescope can't be run from a vim.schedule for some reason 2024-12-15 07:54:47 +01:00
Folke Lemaitre
7c7b18fdee
fix(dashboard): set cursor to non-hidden actionable items. Fixes #273 2024-12-13 09:45:28 +01:00
SueXY
63506d5168
feat(dashboard): add dashboard startuptime icon option (#214)
## Description

Adds an `icon` option to the dashboard `startup` section. So people
(like me, who thinks an emoji in a bunch of nerdfonts is awkward) can
change it easily.

## Screenshots

<details>
<summary>Screenshots</summary>

Screenshot with a minimal config

![Snipaste_2024-12-07_22-08-42](https://github.com/user-attachments/assets/bf8c4754-3902-412d-83dc-f7efec77ee7f)

</details>

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2024-12-12 06:50:04 +01:00
pynappo
9c68a54af6
fix(dashboard): add filetype to terminal sections (#215)
The intention is to make it easier to exclude the dashboard terminal
from some plugins. For example, heirline.nvim sets winbar per-window to
allow for winbar to be optionally disabled in non-floating windows, so
this PR lets me disable heirline for snacks' dashboard terminals over
other floating terminals.
2024-12-11 22:35:56 +01:00
Folke Lemaitre
140204fde5 build: added metadata to plugins 2024-12-10 13:55:51 +01:00
Folke Lemaitre
47ad2a7bfa fix(dashboard): override foldmethod 2024-12-10 13:55:51 +01:00
Folke Lemaitre
0194f18cfa refactor: auto-gen plugin types 2024-12-10 13:55:51 +01:00
Iordanis Petkakis
6b78172864
fix(dashboard): don't open with startup option args (#222)
## Description
Don't open dashboard when Neovim opens with only startup option args.
Took a look at how `dashboard.nvim` did it.
They also have an autocmd for `StdInReadPre`, but I tested with piping
`echo "hello" | nvim` and it works as expected.

Not sure if it's the best solution, so feel free to make any additional
changes or completely disregard for something more robust.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

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

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2024-12-09 14:28:26 +01:00
Folke Lemaitre
736ce447e8
fix(dashboard): take hidden items into account when calculating padding. Fixes #194 2024-12-03 09:57:36 +01:00
Marcin
42d62775d8
feat(dashboard): make buffer not listed (#191)
## Description

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

Set the dashboard buffer to not listed for consistency with other
dashboard plugins

## 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. -->
2024-12-02 17:35:17 +01:00
Folke Lemaitre
cda695e53f
fix(dashboard): take indent into account when calculating terminal width 2024-12-02 16:59:27 +01:00
Folke Lemaitre
045a17da06
feat(dashboard): when a section has a title, use that for action and key. If not put it in the section. Fixes #189 2024-12-02 16:33:55 +01:00
Folke Lemaitre
6e3b9546de
fix(dashboard): calculate proper offset when item has no text 2024-12-02 16:27:36 +01:00
Folke Lemaitre
78f44f720b
feat(dashboard): allow terminal sections to have actions. Closes #189 2024-12-02 12:15:22 +01:00
Folke Lemaitre
d370be6d69
feat(dashboard): hide title if section has no items. Fixes #184 2024-12-01 21:52:01 +01:00
Folke Lemaitre
4bdf7daece
fix(dashboard): truncate file names when too long. Fixes #183 2024-12-01 19:56:44 +01:00
Folke Lemaitre
b99bc64ef9
feat(dashbard): explude files from stdpath data/cache/state in recent files and projects 2024-12-01 19:49:26 +01:00
Folke Lemaitre
93b254d658
fix(dashboard): prevent possible duplicate recent files. Fixes #171 2024-12-01 18:16:43 +01:00
Folke Lemaitre
7a47eb76df
feat(dashboard): allow items to be hidden, but still create the keymaps etc 2024-12-01 17:41:10 +01:00
Folke Lemaitre
8e6d977ec9
perf(dashboard): properly cleanup autocmds 2024-11-30 21:45:41 +01:00
Folke Lemaitre
59f8f0db99
feat(dashboard): always render cache even when expired. Then refresh when needed. 2024-11-27 17:40:32 +01:00
Folke Lemaitre
f83a7b0ffb
fix(dashboard): terminal commands get 5 seconds to complete to trigger caching 2024-11-26 13:59:49 +01:00
Folke Lemaitre
417e07c0d2
feat(dashboard): allow passing win=0, buf=0 to use for the dashboard instead of creating a new window 2024-11-23 00:10:16 +01:00
Ughur Alakbarov
c014c6dcfb
docs(dashboard): typo (#148)
supersedes #141
2024-11-22 22:32:36 +01:00
Folke Lemaitre
4e04b70ea3
fix(dashboard): fixed mini.sessions.read. Fixes #144 2024-11-22 18:58:07 +01:00
Folke Lemaitre
54d521cd0f
fix(dashboard): align should always set width even if no alignment is needed. Fixes #137 2024-11-22 07:20:02 +01:00
Folke Lemaitre
c359164872
fix(dashboard): randomseed needs argument on stable 2024-11-21 20:04:16 +01:00
Folke Lemaitre
aebffe535b
fix(dashboard): vim.pesc for auto keys. Fixes #134 2024-11-21 19:10:37 +01:00
Folke Lemaitre
c770ebeaf7
feat(dashboard): added Snacks.dashboard.update(). Closes #121 2024-11-20 20:30:29 +01:00
Folke Lemaitre
853240bb20
fix(dashboard): open fullscreen on relaunch 2024-11-20 17:10:56 +01:00
Oli
26bec4b51d
fix(sessions): change persisted.nvim load session command (#118)
## Description

Firstly, thank you for integrating persisted.nvim in the dashboard out
of the box.

This PR changes the command to load a persisted.nvim session. This
accounts for users potentially not having `SessionLoad` available to
them if they lazy load their dashboard and don't have `cmd = {
"SessionLoad" }` setup.

## Related Issue(s)

N/A

## Screenshots

N/A
2024-11-20 09:39:41 +01:00
Folke Lemaitre
143c244346
refactor: move all dashboard tracing to debug 2024-11-19 14:55:04 +01:00
Folke Lemaitre
3311d75f89
fix(dashboard): only check for piped stdin when in TUI. Ignore GUIs 2024-11-19 09:45:24 +01:00
Folke Lemaitre
c15953ee88
feat(dashboard): when an item is wider than pane width and only one pane, then center it. See #108 2024-11-19 09:35:24 +01:00
Folke Lemaitre
1acea8b940
fix(dashboard): check session managers in order 2024-11-19 08:41:09 +01:00