text
stringlengths 55
456k
| metadata
dict |
---|---|
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
title: Unobstructed Area
description: |
Details on how to use the UnobstructedArea API to adapt your watchface layout
when the screen is partially obstructed by a system overlay.
guide_group: user-interfaces
order: 5
related_docs:
- Graphics
- LayerUpdateProc
- UnobstructedArea
related_examples:
- title: Simple Example
url: https://github.com/pebble-examples/unobstructed-area-example
- title: Watchface Tutorial
url: https://github.com/pebble-examples/watchface-tutorial-unobstructed
---
The ``UnobstructedArea`` API, added in SDK 4.0, allows developers to dynamically
adapt their watchface design when an area of the screen is partially obstructed
by a system overlay. Currently, the Timeline Quick View feature is the only
system overlay.
Developers are not required to adjust their designs to cater for such system
overlays, but by using the ``UnobstructedArea`` API they can detect changes to
the available screen real-estate and then move, scale, or hide their layers to
achieve an optimal layout while the screen is partially obscured.

<p class="blog__image-text">Sample watchfaces with Timeline Quick View overlay
</p>

<p class="blog__image-text">Potential versions of sample watchfaces using the
UnobstructedArea API</p>
### Determining the Unobstructed Bounds
Prior to SDK 4.0, when displaying layers on screen you would calculate the
size of the display using ``layer_get_bounds()`` and then scale and position
your layers accordingly. Developers can now calculate the size of a layer,
excluding system obstructions, using the new
``layer_get_unobstructed_bounds()``.
```c
static Layer *s_window_layer;
static TextLayer *s_text_layer;
static void main_window_load(Window *window) {
s_window_layer = window_get_root_layer(window);
GRect unobstructed_bounds = layer_get_unobstructed_bounds(s_window_layer);
s_text_layer = text_layer_create(GRect(0, unobstructed_bounds.size.h / 4, unobstructed_bounds.size.w, 50));
}
```
If you still want a fullscreen entities such as a background image, regardless
of any obstructions, just combine both techniques as follows:
```c
static Layer *s_window_layer;
static BitmapLayer *s_image_layer;
static TextLayer *s_text_layer;
static void main_window_load(Window *window) {
s_window_layer = window_get_root_layer(window);
GRect full_bounds = layer_get_bounds(s_window_layer);
GRect unobstructed_bounds = layer_get_unobstructed_bounds(s_window_layer);
s_image_layer = bitmap_layer_create(full_bounds);
s_text_layer = text_layer_create(GRect(0, unobstructed_bounds.size.h / 4, unobstructed_bounds.size.w, 50));
}
```
The approach outlined above is perfectly fine to use when your watchface is
initially launched, but youโre also responsible for handling the obstruction
appearing and disappearing while your watchface is running.
### Rendering with LayerUpdateProc
If your application controls its own rendering process using a
``LayerUpdateProc`` you can just dynamically adjust your rendering
each time your layer updates.
In this example, we use ``layer_get_unobstructed_bounds()`` instead of
``layer_get_bounds()``. The graphics are then positioned or scaled based upon
the available screen real-estate, instead of the screen dimensions.
> You must ensure you fill the entire window, not just the unobstructed
> area, when drawing the screen - failing to do so may cause unexpected
> graphics to be drawn behind the quick view, during animations.
```c
static void hands_update_proc(Layer *layer, GContext *ctx) {
GRect bounds = layer_get_unobstructed_bounds(layer);
GPoint center = grect_center_point(&bounds);
const int16_t second_hand_length = (bounds.size.w / 2);
time_t now = time(NULL);
struct tm *t = localtime(&now);
int32_t second_angle = TRIG_MAX_ANGLE * t->tm_sec / 60;
GPoint second_hand = {
.x = (int16_t)(sin_lookup(second_angle) * (int32_t)second_hand_length / TRIG_MAX_RATIO) + center.x,
.y = (int16_t)(-cos_lookup(second_angle) * (int32_t)second_hand_length / TRIG_MAX_RATIO) + center.y,
};
// second hand
graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_draw_line(ctx, second_hand, center);
// minute/hour hand
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_context_set_stroke_color(ctx, GColorBlack);
gpath_rotate_to(s_minute_arrow, TRIG_MAX_ANGLE * t->tm_min / 60);
gpath_draw_filled(ctx, s_minute_arrow);
gpath_draw_outline(ctx, s_minute_arrow);
gpath_rotate_to(s_hour_arrow, (TRIG_MAX_ANGLE * (((t->tm_hour % 12) * 6) +
(t->tm_min / 10))) / (12 * 6));
gpath_draw_filled(ctx, s_hour_arrow);
gpath_draw_outline(ctx, s_hour_arrow);
// dot in the middle
graphics_context_set_fill_color(ctx, GColorBlack);
graphics_fill_rect(ctx, GRect(bounds.size.w / 2 - 1, bounds.size.h / 2 - 1, 3,
3), 0, GCornerNone);
}
```
### Using Unobstructed Area Handlers
If you are not overriding the default rendering of a ``Layer``, you will need to
subscribe to one or more of the ``UnobstructedAreaHandlers`` to adjust the sizes
and positions of layers.
There are 3 events available using ``UnobstructedAreaHandlers``.
These events will notify you when the unobstructed area is: *about to change*,
*is currently changing*, or *has finished changing*. You can use these handlers
to perform any necessary alterations to your layout.
`.will_change` - an event to inform you that the unobstructed area size is about
to change. This provides a ``GRect`` which lets you know the size of the screen
after the change has finished.
`.change` - an event to inform you that the unobstructed area size is currently
changing. This event is called several times during the animation of an
obstruction appearing or disappearing. ``AnimationProgress`` is provided to let
you know the percentage of progress towards completion.
`.did_change` - an event to inform you that the unobstructed area size has
finished changing. This is useful for deinitializing or destroying anything
created or allocated in the will_change handler.
These handlers are optional, but at least one must be specified for a valid
subscription. In the following example, we subscribe to two of the three
available handlers.
> **NOTE**: You must construct the
> ``UnobstructedAreaHandlers`` object *before* passing it to the
> ``unobstructed_area_service_subscribe()`` method.
```c
UnobstructedAreaHandlers handlers = {
.will_change = prv_unobstructed_will_change,
.did_change = prv_unobstructed_did_change
};
unobstructed_area_service_subscribe(handlers, NULL);
```
#### Hiding Layers
In this example, weโre going to hide a ``TextLayer`` containing the current
date, while the screen is obstructed.
Just before the Timeline Quick View appears, weโre going to hide the
``TextLayer`` and weโll show it again after the Timeline Quick View disappears.
```c
static Window *s_main_window;
static Layer *s_window_layer;
static TextLayer *s_date_layer;
```
Subscribe to the `.did_change` and `.will_change` events:
```c
static void main_window_load(Window *window) {
// Keep a handle on the root layer
s_window_layer = window_get_root_layer(window);
// Subscribe to the will_change and did_change events
UnobstructedAreaHandlers handlers = {
.will_change = prv_unobstructed_will_change,
.did_change = prv_unobstructed_did_change
};
unobstructed_area_service_subscribe(handlers, NULL);
}
```
The `will_change` event fires before the size of the unobstructed area changes,
so we need to establish whether the screen is already obstructed, or about to
become obstructed. If there isnโt a current obstruction, that means the
obstruction must be about to appear, so weโll need to hide our data layer.
```c
static void prv_unobstructed_will_change(GRect final_unobstructed_screen_area,
void *context) {
// Get the full size of the screen
GRect full_bounds = layer_get_bounds(s_window_layer);
if (!grect_equal(&full_bounds, &final_unobstructed_screen_area)) {
// Screen is about to become obstructed, hide the date
layer_set_hidden(text_layer_get_layer(s_date_layer), true);
}
}
```
The `did_change` event fires after the unobstructed size changes, so we can
perform the same check to see whether the screen is already obstructed, or
about to become obstructed. If the screen isnโt obstructed when this event
fires, then the obstruction must have just cleared and weโll need to display
our date layer again.
```c
static void prv_unobstructed_did_change(void *context) {
// Get the full size of the screen
GRect full_bounds = layer_get_bounds(s_window_layer);
// Get the total available screen real-estate
GRect bounds = layer_get_unobstructed_bounds(s_window_layer);
if (grect_equal(&full_bounds, &bounds)) {
// Screen is no longer obstructed, show the date
layer_set_hidden(text_layer_get_layer(s_date_layer), false);
}
}
```
#### Animating Layer Positions
The `.change` event will fire several times while the unobstructed area is
changing size. This allows us to use this event to make our layers appear to
slide-in or slide-out of their initial positions.
In this example, weโre going to use percentages to position two text layers
vertically. One layer at the top of the screen and one layer at the bottom. When
the screen is obstructed, these two layers will shift to be closer together.
Because weโre using percentages, it doesnโt matter if the unobstructed area is
increasing or decreasing, our text layers will always be relatively positioned
in the available space.
```c
static const uint8_t s_offset_top_percent = 33;
static const uint8_t s_offset_bottom_percent = 10;
```
A simple helper function to simulate percentage based coordinates:
```c
uint8_t relative_pixel(int16_t percent, int16_t max) {
return (max * percent) / 100;
}
```
Subscribe to the change event:
```c
static void main_window_load(Window *window) {
UnobstructedAreaHandlers handler = {
.change = prv_unobstructed_change
};
unobstructed_area_service_subscribe(handler, NULL);
}
```
Move the text layer each time the unobstructed area size changes:
```c
static void prv_unobstructed_change(AnimationProgress progress, void *context) {
// Get the total available screen real-estate
GRect bounds = layer_get_unobstructed_bounds(s_window_layer);
// Get the current position of our top text layer
GRect frame = layer_get_frame(text_layer_get_layer(s_top_text_layer));
// Shift the Y coordinate
frame.origin.y = relative_pixel(s_offset_top_percent, bounds.size.h);
// Apply the new location
layer_set_frame(text_layer_get_layer(s_top_text_layer), frame);
// Get the current position of our bottom text layer
GRect frame2 = layer_get_frame(text_layer_get_layer(s_top_text_layer));
// Shift the Y coordinate
frame2.origin.y = relative_pixel(s_offset_bottom_percent, bounds.size.h);
// Apply the new position
layer_set_frame(text_layer_get_layer(s_bottom_text_layer), frame2);
}
```
### Toggling Timeline Quick View
The `pebble` tool which shipped as part of [SDK 4.0](/sdk4),
allows developers to enable and disable Timeline Quick View, which is
incredibly useful for debugging purposes.

To enable Timeline Quick View, you can use:
```nc|text
$ pebble emu-set-timeline-quick-view on
```
To disable Timeline Quick View, you can use:
```nc|text
$ pebble emu-set-timeline-quick-view off
```
> [CloudPebble]({{site.links.cloudpebble}}) does not currently support toggling
> Timeline Quick View, but it will be added as part of a future update.
### Additional Considerations
If you're scaling or moving layers based on the unobstructed area, you must
ensure you fill the entire window, not just the unobstructed area. Failing to do
so may cause unexpected graphics to be drawn behind the quick view, during
animations.
At present, Timeline Quick View is not currently planned for the Chalk platform.
For design reference, the height of the Timeline Quick View overlay will be
*51px* in total, which includes a 2px border, but this may vary on newer
platforms and and the height should always be calculated at runtime.
```c
// Calculate the actual height of the Timeline Quick View
s_window_layer = window_get_root_layer(window);
GRect fullscreen = layer_get_bounds(s_window_layer);
GRect unobstructed_bounds = layer_get_unobstructed_bounds(s_window_layer);
int16_t obstruction_height = fullscreen.size.h - unobstructed_bounds.size.h;
``` | {
"source": "google/pebble",
"title": "devsite/source/_guides/user-interfaces/unobstructed-area.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_guides/user-interfaces/unobstructed-area.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 13341
} |
{% comment %}
Copyright 2025 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
{% for sub_group in include.group.subgroups %}
{% assign sub_grp = sub_group[1] %}
* [**{{ sub_grp.title }}**]({{sub_grp.url}}) - {{ sub_grp.description }}
{% endfor %}
{% if include.group.guides.size > 0 %}
{% assign guides = include.group.guides | sort: 'title' | where:'menu',true %}
{% for guide in guides %}
* [**{{ guide.title }}**]({{guide.url}}) - {{ guide.summary }}
{% endfor %}
{% endif %} | {
"source": "google/pebble",
"title": "devsite/source/_includes/guides/contents-group.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_includes/guides/contents-group.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 993
} |
{% comment %}
Copyright 2025 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
### Windows
Installing the Pebble SDK directly on Windows is not supported at this time. We
recommend you use [CloudPebble]({{ site.links.cloudpebble }}) instead.
Alternatively, you can run a Linux virtual machine:
1. Install a virtual machine manager such as
[VirtualBox](http://www.virtualbox.org/) (free) or
[VMWare Workstation](http://www.vmware.com/products/workstation/).
2. Install [Ubuntu Linux](http://www.ubuntu.com/) in a new virtual machine.
3. Follow the [manual installation instructions](/sdk/install/linux/), but skip
"Download and install the Pebble ARM toolchain", as the toolchain is
included.
### Mac OS X
If you previously used Homebrew to install the Pebble SDK, run:
```bash
$ brew update && brew upgrade --devel pebble-sdk
```
If you've never used Homebrew to install the Pebble SDK, run:
```bash
$ brew update && brew install --devel pebble/pebble-sdk/pebble-sdk
```
If you would prefer to not use Homebrew and would like to manually install the
Pebble SDK:
1. Download the
[SDK package](https://s3.amazonaws.com/assets.getpebble.com/pebble-tool/pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-mac.tar.bz2).
2. Follow the [manual installation instructions](/sdk/install/), but skip
"Download and install the Pebble ARM toolchain", as the toolchain is
included.
### Linux
1. Download the relevant package:
[Linux (32-bit)](https://s3.amazonaws.com/assets.getpebble.com/pebble-tool/pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-linux32.tar.bz2) |
[Linux (64-bit)](https://s3.amazonaws.com/assets.getpebble.com/pebble-tool/pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-linux64.tar.bz2)
2. Install the SDK by following the
[manual installation instructions](/sdk/install/linux/), but skip
"Download and install the Pebble ARM toolchain", as the toolchain is
included. | {
"source": "google/pebble",
"title": "devsite/source/_includes/sdk/beta_instructions_no_platform.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_includes/sdk/beta_instructions_no_platform.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2446
} |
{% comment %}
Copyright 2025 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
## Next Steps
Now that you have the Pebble SDK downloaded and installed on your computer,
it is time to learn how to write your first app!
You should checkout the [Tutorials](/tutorials/) for a step-by-step look at how
to write a simple C Pebble application. | {
"source": "google/pebble",
"title": "devsite/source/_includes/sdk/steps_getting_started.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_includes/sdk/steps_getting_started.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 853
} |
{% comment %}
Copyright 2025 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
### Installation Problems?
If you have any issues with downloading or installing the Pebble SDK, you
should take a look at the
[SDK Help category](https://forums.getpebble.com/categories/watchface-sdk-help)
on our forums.
Alternatively, you can [send us a message](/contact/) letting us know what
issues you're having and we will try and help you out. | {
"source": "google/pebble",
"title": "devsite/source/_includes/sdk/steps_help.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_includes/sdk/steps_help.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 948
} |
{% comment %}
Copyright 2025 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
{% if include.mac %}
1. If you have not already, download the [latest version of the SDK]({{ site.links.pebble_tool_root }}pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-mac.tar.bz2).
{% else %}
1. If you have not already, download the latest version of the SDK -
[Linux 32-bit]({{ site.links.pebble_tool_root }}pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-linux32.tar.bz2) |
[Linux 64-bit]({{ site.links.pebble_tool_root }}pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-linux64.tar.bz2).
{% endif %}
2. Open {% if include.mac %}Terminal{% else %}a terminal{% endif %} window and
create a directory to host all Pebble tools:
```bash
mkdir {{ site.data.sdk.path }}
```
3. Change into that directory and extract the Pebble SDK that you just
downloaded, for example:
```bash
cd {{ site.data.sdk.path }}
tar -jxf ~/Downloads/pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-{% if include.mac %}mac{% else %}linux64{% endif %}.tar.bz2
```
{% unless include.mac %}
> Note: If you are using 32-bit Linux, the path shown above will be
> different as appropriate.
{% endunless %}
You should now have the directory
`{{ site.data.sdk.path }}pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-{% if include.mac %}mac{% else %}linux64{% endif %}` with the SDK files and directories inside it.
4. Add the `pebble` tool to your path and reload your shell configuration:
```bash
echo 'export PATH=~/pebble-dev/pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-{% if include.mac %}mac{% else %}linux64{% endif %}/bin:$PATH' >> ~/.bash_profile
. ~/.bash_profile
```
You can now continue on and install the rest of the dependencies. | {
"source": "google/pebble",
"title": "devsite/source/_includes/sdk/steps_install_sdk.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_includes/sdk/steps_install_sdk.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2312
} |
{% comment %}
Copyright 2025 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
### Download and install Python libraries
The Pebble SDK depends on Python libraries to convert fonts and images from your
computer into Pebble resources.
{% if include.mac %}
You need to use the standard Python `easy_install` package manager to install
the alternative `pip` package manager. This is then used to install other Python
dependencies.
Follow these steps in Terminal:
{% endif %}
1. Install `pip` and `virtualenv`:
```bash
{% if include.mac %}sudo easy_install pip{% else %}sudo apt-get install python-pip python2.7-dev{% endif %}
sudo pip install virtualenv
```
2. Install the Python library dependencies locally:
```bash
cd {{ site.data.sdk.path }}pebble-sdk-{{ site.data.sdk.pebble_tool.version }}-{% if include.mac %}mac{% else %}linux64{% endif %}
virtualenv --no-site-packages .env
source .env/bin/activate
{% if include.mac %}CFLAGS="" {% endif %}pip install -r requirements.txt
deactivate
```
> **Note: virtualenv is not optional.** | {
"source": "google/pebble",
"title": "devsite/source/_includes/sdk/steps_python.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_includes/sdk/steps_python.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 1598
} |
---
layout: guides/default
title: Dummy
description: Details
--- | {
"source": "google/pebble",
"title": "devsite/source/_layouts/guides/index.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/_layouts/guides/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 64
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
permalink: /feed.xml
layout: docs/markdown
title: PebbleKit Android Documentation
docs_language: pebblekit_android
---
This is the contents page for the PebbleKit Android SDK documentation, which
includes all information on the two main packages below:
{% for module in site.data.docs_tree.pebblekit_android %}
<h3><a href="{{ module.url }}">{{ module.name }}</a></h3>
<p/>
{% endfor %}
This part of the SDK can be used to build companion apps for Android to enhance
the features of the watchapp or to integrate Pebble into an existing mobile app
experience.
Get started using PebbleKit Android by working through the
[*Android Tutorial*](/tutorials/android-tutorial/part1). Check out
{% guide_link communication/using-pebblekit-android %} to learn more about using
this SDK.
You can also find the source code for PebbleKit Android
[on GitHub](https://github.com/pebble/pebble-android-sdk). | {
"source": "google/pebble",
"title": "devsite/source/docs/pebblekit-android/index.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/docs/pebblekit-android/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 1474
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
permalink: /feed.xml
layout: docs/markdown
title: PebbleKit iOS Documentation
docs_language: pebblekit_ios
---
This is the contents page for the PebbleKit iOS SDK documentation, which
includes all information on the main reference sections below.
This part of the SDK can be used to build companion apps for iOS to enhance the
features of the watchapp or to integrate Pebble into an existing mobile app
experience.
Get started using PebbleKit iOS by working through the
[*iOS Tutorial*](/tutorials/ios-tutorial/part1). Check out
{% guide_link communication/using-pebblekit-ios %} to learn more about using
this SDK.
You can find the source code for PebbleKit iOS
[on GitHub](https://github.com/pebble/pebble-ios-sdk), and the documentation
is also available on
[CocoaDocs](http://cocoadocs.org/docsets/PebbleKit/{{ site.data.sdk.pebblekit-ios.version }}/).
{% for module in site.data.docs_tree.pebblekit_ios %}
<h3>{{ module.name }}</h3>
{% for child in module.children %}
<h5><a href="{{ child.url }}">{{ child.name }}</a></h5>
{% endfor %}
<p/>
{% endfor %} | {
"source": "google/pebble",
"title": "devsite/source/docs/pebblekit-ios/index.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/docs/pebblekit-ios/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 1643
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: sdk/markdown
menu_subsection: install
title: Installing the Pebble SDK
---
## Develop Online
You can use [CloudPebble]({{ site.links.cloudpebble }}) to build, compile
and test Pebble apps entirely in the cloud without any installation needed.
## Install Through Homebrew
We recommend Mac OS X users [install the SDK using Homebrew](/sdk/download).
## Manual Installation
Once you have [downloaded the Pebble SDK](/sdk/download/), you will need to
follow the instructions for your platform.
## [Mac OS X](/sdk/install/mac/) | [Linux](/sdk/install/linux/) | [Windows](/sdk/install/windows/)
### Problems Installing?
If you need help installing the SDK, feel free to post your comments in the
[SDK Installation Help forum][sdk-install-help]. Please make sure you
provide as many details as you can about the issues
you may have encountered.
**Tip:** Copying and pasting commands from your Terminal output will help a great deal.
### What's Next?
Once you have installed the Pebble SDK, you should check out our
[Tutorials](/tutorials/) section to learn the basics of Pebble development.
[sdk-install-help]: https://forums.getpebble.com/categories/sdk-install/ | {
"source": "google/pebble",
"title": "devsite/source/sdk/install/index.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/sdk/install/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 1756
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: sdk/markdown
title: Installing the Pebble SDK on Linux
description: Detailed installation instructions for the Pebble SDK on Linux.
menu_subsection: install
menu_platform: linux
generate_toc: true
permalink: /sdk/install/linux/
---
> **Important**: The Pebble SDK is officially supported on
> Ubuntu GNU/Linux 12.04 LTS, Ubuntu 13.04, Ubuntu 13.10 and Ubuntu 14.04 LTS.
>
> The SDK should also work on other distributions with minor adjustments.
>
> **Python version**: the Pebble SDK requires Python 2.7. At this time, the
> Pebble SDK is not compatible with Python 3. However, some newer
> distributions come with both Python 2.7 and Python 3 installed, which can
> cause problems. You can use </br>`python --version` to determine which is being
> used. This means you may need to run `pip2` instead of `pip` when prompted to
> do so below.
## Download and install the Pebble SDK
{% include sdk/steps_install_sdk.md mac=false %}
{% include sdk/steps_python.md mac=false %}
## Install Pebble emulator dependencies
The Pebble emulator requires some libraries that you may not have installed on
your system.
```bash
sudo apt-get install libsdl1.2debian libfdt1 libpixman-1-0
```
{% include sdk/steps_getting_started.md %}
{% include sdk/steps_help.md %} | {
"source": "google/pebble",
"title": "devsite/source/sdk/install/linux.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/sdk/install/linux.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 1848
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: sdk/markdown
title: Installing the Pebble SDK on Mac OS X
description: Detailed installation instructions for the Pebble SDK on Mac OS X.
menu_subsection: install
menu_platform: mac
generate_toc: true
permalink: /sdk/install/mac/
---
These are the manual installation instructions for installing the Pebble SDK
from a download bundle. We recommend you
[install the SDK using Homebrew](/sdk/download) instead, if possible.
### Compatibility
> **Python version**: the Pebble SDK requires Python 2.7. At this time, the
> Pebble SDK is not compatible with Python 3. However, some newer
> distributions come with both Python 2.7 and Python 3 installed, which can
> cause problems. You can use </br>`python --version` to determine which is being
> used. This means you may need to run `pip2` instead of `pip` when prompted to
> do so below.
### Download and install the Pebble SDK
1. Install the [Xcode Command Line Tools][xcode-command-line-tools] from
Apple if you do not have them already.
{% include sdk/steps_install_sdk.md mac=true %}
{% include sdk/steps_python.md mac=true %}
### Pebble SDK, fonts and freetype
To manipulate and generate fonts, the Pebble SDK requires the freetype library.
If you intend to use custom fonts in your apps, please use
[homebrew][homebrew-install] to install the freetype library.
```bash
brew install freetype
```
### Install Pebble emulator dependencies
The Pebble emulator requires some libraries that you may not have installed on
your system.
The easiest way to install these dependencies is to use [homebrew][homebrew-install].
```bash
brew update
brew install boost-python
brew install glib
brew install pixman
```
> If you have installed Python using Homebrew, you **must** install boost-python
> from source. You can do that with `brew install boost-python --build-from-source` .
{% include sdk/steps_getting_started.md %}
{% include sdk/steps_help.md %}
[xcode-command-line-tools]: https://developer.apple.com/downloads/
[homebrew-install]: http://brew.sh/ | {
"source": "google/pebble",
"title": "devsite/source/sdk/install/macosx.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/sdk/install/macosx.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2608
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: sdk/markdown
title: Installing the Pebble SDK on Windows
description: Detailed installation instructions for the Pebble SDK on Windows.
menu_subsection: install
menu_platform: windows
generate_toc: true
permalink: /sdk/install/windows/
---
Installing the Pebble SDK on Windows is not officially supported at this time.
However, you can choose from several alternative strategies to develop
watchfaces and watchapps on Windows.
## Use CloudPebble
[CloudPebble][cloudpebble] is the official online development environment for
writing Pebble apps.
It allows you to create, edit, build and distribute applications in your web
browser without installing anything on your computer.
**Pebble strongly recommends [CloudPebble][cloudpebble] for Windows users.**
## Use a Virtual Machine
You can also download and run the Pebble SDK in a virtual machine.
1. Install a virtual machine manager such as
[VirtualBox](http://www.virtualbox.org) (free) or
[VMWare Workstation](http://www.vmware.com/products/workstation/).
2. Install [Ubuntu Linux](http://www.ubuntu.com/) in a virtual machine.
3. Follow the standard [Linux installation instructions](/sdk/install/linux/).
## Need installation help?
If you need help installing the SDK, feel free to post in the
[SDK Installation Help forum][sdk-install-help].
Please make sure you provide as many details as you can about the issue you have
encountered (copy/pasting your terminal output will help a lot).
[cloudpebble]: {{ site.links.cloudpebble }}
[sdk-install-help]: https://forums.getpebble.com/categories/sdk-install/ | {
"source": "google/pebble",
"title": "devsite/source/sdk/install/windows.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/sdk/install/windows.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2168
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: utils/redirect_permanent
redirect_to: /tutorials/advanced/vector-animations/
--- | {
"source": "google/pebble",
"title": "devsite/source/tutorials/advanced/index.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/advanced/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 667
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: advanced
tutorial_part: 1
title: Vector Animations
description: |
How to use vector images in icons and animations.
permalink: /tutorials/advanced/vector-animations/
generate_toc: true
platform_choice: true
platforms:
- basalt
- chalk
- diorite
- emery
---
Some of the best Pebble apps make good use of the ``Animation`` and the
[`Graphics Context`](``Graphics``) to create beautiful and eye-catching user
interfaces that look better than those created with just the standard ``Layer``
types.
Taking a good design a step further may involve using the ``Draw Commands`` API
to load vector icons and images, and to animate them on a point-by-point basis
at runtime. An additional capability of the ``Draw Commands`` API is the draw
command sequence, allowing multiple frames to be incorporated into a single
resource and played out frame by frame.
This tutorial will guide you through the process of using these types of image
files in your own projects.
## What Are Vector Images?
As opposed to bitmaps which contain data for every pixel to be drawn, a vector
file contains only instructions about points contained in the image and how to
draw lines connecting them up. Instructions such as fill color, stroke color,
and stroke width are also included.
Vector images on Pebble are implemented using the ``Draw Commands`` APIs, which
load and display PDC (Pebble Draw Command) images and sequences that contain
sets of these instructions. An example is the weather icon used in weather
timeline pins. The benefit of using vector graphics for this icon is that is
allows the image to stretch in the familiar manner as it moves between the
timeline view and the pin detail view:

By including two or more vector images in a single file, an animation can be
created to enable fast and detailed animated sequences to be played. Examples
can be seen in the Pebble system UI, such as when an action is completed:

The main benefits of vectors over bitmaps for simple images and icons are:
* Smaller resource size - instructions for joining points are less memory
expensive than per-pixel bitmap data.
* Flexible rendering - vector images can be rendered as intended, or manipulated
at runtime to move the individual points around. This allows icons to appear
more organic and life-like than static PNG images. Scaling and distortion is
also made possible.
* Longer animations - a side benefit of taking up less space is the ability to
make animations longer.
However, there are also some drawbacks to choosing vector images in certain
cases:
* Vector files require more specialized tools to create than bitmaps, and so are
harder to produce.
* Complicated vector files may take more time to render than if they were simply
drawn per-pixel as a bitmap, depending on the drawing implementation.
## Creating Compatible Files
The file format of vector image files on Pebble is the PDC (Pebble Draw Command)
format, which includes all the instructions necessary to allow drawing of
vectors. These files are created from compatible SVG (Scalar Vector Graphics)
files using the
[`svg2pdc`]({{site.links.examples_org}}/cards-example/blob/master/tools/svg2pdc.py)
tool.
<div class="alert alert--fg-white alert--bg-dark-red">
Pebble Draw Command files can only be used from app resources, and cannot be
created at runtime.
</div>
To convert an SVG file to a PDC image of the same name:
```bash
$ python svg2pdc.py image.svg
```
To create a PDCS (Pebble Draw Command Sequence) from individual SVG frames,
specify the directory containing the frames with the `--sequence` flag when
running `svg2pdc`:
```bash
$ ls frames/
1.svg 2.svg 3.svg
4.svg 5.svg
$ python svg2pdc.py --sequence frames/
```
In the example above, this will create an output file in the `frames` directory
called `frames.pdc` that contains draw command data for the complete animation.
<div class="alert alert--fg-white alert--bg-dark-red">
{% markdown %}
**Limitations**
The `svg2pdc` tool currently supports SVG files that use **only** the following
elements: `g`, `layer`, `path`, `rect`, `polyline`, `polygon`, `line`, `circle`.
We recommend using Adobe Illustrator to create compatible SVG icons and images.
{% endmarkdown %}
</div>
For simplicity, compatible image and sequence files will be provided for you to
use in your own project.
### PDC icons
Example PDC image files are available for the icons listed in
[*App Assets*](/guides/app-resources/app-assets/).
These are ideal for use in many common types of apps, such as notification or
weather apps.
[Download PDC icon files >{center,bg-lightblue,fg-white}]({{ site.links.s3_assets }}/assets/other/pebble-timeline-icons-pdc.zip)
## Getting Started
^CP^ Begin a new [CloudPebble]({{ site.links.cloudpebble }}) project using the
blank template and add code only to push an initial ``Window``, such as the
example below:
^LC^ Begin a new project using `pebble new-project` and create a simple app that
pushes a blank ``Window``, such as the example below:
```c
#include <pebble.h>
static Window *s_main_window;
static void main_window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
GRect bounds = layer_get_bounds(window_layer);
}
static void main_window_unload(Window *window) {
}
static void init() {
s_main_window = window_create();
window_set_window_handlers(s_main_window, (WindowHandlers) {
.load = main_window_load,
.unload = main_window_unload,
});
window_stack_push(s_main_window, true);
}
static void deinit() {
window_destroy(s_main_window);
}
int main() {
init();
app_event_loop();
deinit();
}
```
## Drawing a PDC Image
For this tutorial, use the example
[`weather_image.pdc`](/assets/other/weather_image.pdc) file provided.
^CP^ Add the PDC file as a project resource using the 'Add new' under
'Resources' on the left-hand side of the CloudPebble editor, with an
'Identifier' of `WEATHER_IMAGE`, and a type of 'raw binary blob'. The file is
assumed to be called `weather_image.pdc`.
^LC^ Add the PDC file to your project resources in `package.json` as shown
below. Set the 'name' field to `WEATHER_IMAGE`, and the 'type' field to `raw`.
The file is assumed to be called `weather_image.pdc`:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"media": [
{
"type": "raw",
"name": "WEATHER_IMAGE",
"file": "weather_image.pdc"
}
]
{% endhighlight %}
</div>
^LC^ Drawing a Pebble Draw Command image is just as simple as drawing a normal PNG
image to a graphics context, requiring only one draw call. First, load the
`.pdc` file from resources, for example with the `name` defined as
`WEATHER_IMAGE`, as shown below.
^CP^ Drawing a Pebble Draw Command image is just as simple as drawing a normal
PNG image to a graphics context, requiring only one draw call. First, load the
`.pdc` file from resources, for example with the 'Identifier' defined as
`WEATHER_IMAGE`. This will be available in code as `RESOURCE_ID_WEATHER_IMAGE`,
as shown below.
Declare a pointer of type ``GDrawCommandImage`` at the top of the file:
```c
static GDrawCommandImage *s_command_image;
```
Create and assign the ``GDrawCommandImage`` in `init()`, before calling
`window_stack_push()`:
```nc|c
static void init() {
/* ... */
// Create the object from resource file
s_command_image = gdraw_command_image_create_with_resource(RESOURCE_ID_WEATHER_IMAGE);
/* ... */
}
```
Next, define the ``LayerUpdateProc`` that will be used to draw the PDC image:
```c
static void update_proc(Layer *layer, GContext *ctx) {
// Set the origin offset from the context for drawing the image
GPoint origin = GPoint(10, 20);
// Draw the GDrawCommandImage to the GContext
gdraw_command_image_draw(ctx, s_command_image, origin);
}
```
Next, create a ``Layer`` to display the image:
```c
static Layer *s_canvas_layer;
```
Next, set the ``LayerUpdateProc`` that will do the rendering and add it to the
desired ``Window``:
```c
static void main_window_load(Window *window) {
/* ... */
// Create the canvas Layer
s_canvas_layer = layer_create(GRect(30, 30, bounds.size.w, bounds.size.h));
// Set the LayerUpdateProc
layer_set_update_proc(s_canvas_layer, update_proc);
// Add to parent Window
layer_add_child(window_layer, s_canvas_layer);
}
```
Finally, don't forget to free the memory used by the ``Window``'s sub-components
in `main_window_unload()`:
```c
static void main_window_unload(Window *window) {
layer_destroy(s_canvas_layer);
gdraw_command_image_destroy(s_command_image);
}
```
When run, the PDC image will be loaded, and rendered in the ``LayerUpdateProc``.
To put the image into contrast, we will finally change the ``Window`` background
color after `window_create()`:
```c
window_set_background_color(s_main_window, GColorBlueMoon);
```
The result will look similar to the example shown below.

## Playing a PDC Sequence
The ``GDrawCommandSequence`` API allows developers to use vector graphics as
individual frames in a larger animation. Just like ``GDrawCommandImage``s, each
``GDrawCommandFrame`` is drawn to a graphics context in a ``LayerUpdateProc``.
For this tutorial, use the example
[`clock_sequence.pdc`](/assets/other/clock_sequence.pdc) file provided.
Begin a new app, with a C file containing the [template](#getting-started) provided above.
^CP^ Next, add the file as a `raw` resource in the same way as for a PDC image,
for example with an `Identifier` specified as `CLOCK_SEQUENCE`.
^LC^ Next, add the file as a `raw` resource in the same way as for a PDC image,
for example with the `name` field specified in `package.json` as
`CLOCK_SEQUENCE`.
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"media": [
{
"type": "raw",
"name": "CLOCK_SEQUENCE",
"file": "clock_sequence.pdc"
}
]
{% endhighlight %}
</div>
Load the PDCS in your app by first declaring a ``GDrawCommandSequence`` pointer:
```c
static GDrawCommandSequence *s_command_seq;
```
Next, initialize the object in `init()` before calling `window_stack_push()`:
```nc|c
static void init() {
/* ... */
// Load the sequence
s_command_seq = gdraw_command_sequence_create_with_resource(RESOURCE_ID_CLOCK_SEQUENCE);
/* ... */
}
```
Get the next frame and draw it in the ``LayerUpdateProc``. Then register a timer
to draw the next frame:
```c
// Milliseconds between frames
#define DELTA 13
static int s_index = 0;
/* ... */
static void next_frame_handler(void *context) {
// Draw the next frame
layer_mark_dirty(s_canvas_layer);
// Continue the sequence
app_timer_register(DELTA, next_frame_handler, NULL);
}
static void update_proc(Layer *layer, GContext *ctx) {
// Get the next frame
GDrawCommandFrame *frame = gdraw_command_sequence_get_frame_by_index(s_command_seq, s_index);
// If another frame was found, draw it
if (frame) {
gdraw_command_frame_draw(ctx, s_command_seq, frame, GPoint(0, 30));
}
// Advance to the next frame, wrapping if neccessary
int num_frames = gdraw_command_sequence_get_num_frames(s_command_seq);
s_index++;
if (s_index == num_frames) {
s_index = 0;
}
}
```
Next, create a new ``Layer`` to utilize the ``LayerUpdateProc`` and add it to the
desired ``Window``.
Create the `Window` pointer:
```c
static Layer *s_canvas_layer;
```
Next, create the ``Layer`` and assign it to the new pointer. Set its update
procedure and add it to the ``Window``:
```c
static void main_window_load(Window *window) {
// Get Window information
Layer *window_layer = window_get_root_layer(window);
GRect bounds = layer_get_bounds(window_layer);
// Create the canvas Layer
s_canvas_layer = layer_create(GRect(30, 30, bounds.size.w, bounds.size.h));
// Set the LayerUpdateProc
layer_set_update_proc(s_canvas_layer, update_proc);
// Add to parent Window
layer_add_child(window_layer, s_canvas_layer);
}
```
Start the animation loop using a timer at the end of initialization:
```c
// Start the animation
app_timer_register(DELTA, next_frame_handler, NULL);
```
Finally, remember to destroy the ``GDrawCommandSequence`` and ``Layer`` in
`main_window_unload()`:
```c
static void main_window_unload(Window *window) {
layer_destroy(s_canvas_layer);
gdraw_command_sequence_destroy(s_command_seq);
}
```
When run, the animation will be played by the timer at a framerate dictated by
`DELTA`, looking similar to the example shown below:

## What's Next?
You have now learned how to add vector images and animations to your apps.
Complete examples for these APIs are available under the `pebble-examples`
GitHub organization:
* [`pdc-image`]({{site.links.examples_org}}/pdc-image) - Example
implementation of a Pebble Draw Command Image.
* [`pdc-sequence`]({{site.links.examples_org}}/pdc-sequence) - Example
implementation of a Pebble Draw Command Sequence animated icon.
More advanced tutorials will be added here in the future, so keep checking back! | {
"source": "google/pebble",
"title": "devsite/source/tutorials/advanced/vector-animations.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/advanced/vector-animations.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 14070
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: js-watchface
tutorial_part: 1
title: Build a Watchface in JavaScript using Rocky.js
description: A guide to making a new Pebble watchface with Rocky.js
permalink: /tutorials/js-watchface-tutorial/part1/
menu_section: tutorials
generate_toc: true
platform_choice: true
---
{% include tutorials/rocky-js-warning.html %}
In this tutorial we'll cover the basics of writing a simple watchface with
Rocky.js, Pebble's JavaScript API. Rocky.js enables developers to create
beautiful and feature-rich watchfaces with a modern programming language.
Rocky.js should not be confused with Pebble.js which also allowed developers to
write applications in JavaScript. Unlike Pebble.js, Rocky.js runs natively on
the watch and is now the only offically supported method for developing
JavaScript applications for Pebble smartwatches.
We're going to start with some basics, then create a simple digital watchface
and finally create an analog clock which looks just like this:

## First Steps
^CP^ Go to [CloudPebble]({{ site.links.cloudpebble }}) and click
'Get Started' to log in using your Pebble account, or create a new one if you do
not already have one. Once you've logged in, click 'Create' to create a new
project. Give your project a suitable name, such as 'Tutorial 1' and set the
'Project Type' as 'Rocky.js (beta)'. This will create a completely empty
project, so before you continue, you will need to click the 'Add New' button in
the left menu to create a new Rocky.js JavaScript file.
^CP^ Next we need to change our project from a watchapp to a watchface. Click
'Settings' in the left menu, then change the 'APP KIND' to 'watchface'.
<div class="platform-specific" data-sdk-platform="local">
{% markdown {} %}
If you haven't already, head over the [SDK Page](/sdk/install/) to learn how to
download and install the latest version of the Pebble Tool, and the latest SDK.
Once you've installed the Pebble Tool and SDK 4.0, you can create a new Rocky.js
project with the following command:
```nc|text
$ pebble new-project --rocky helloworld
```
This will create a new folder called `helloworld` and populate it with the basic
structure required for a basic Rocky.js application.
{% endmarkdown %}
</div>
## Watchface Basics
Watchface are essentially long running applications that update the display at
a regular interval (typically once a minute, or when specific events occur). By
minimizing the frequency that the screen is updated, we help to conserve
battery life on the watch.
^CP^ We'll start by editing the `index.js` file that we created earlier. Click
on the filename in the left menu and it will load, ready for editing.
^LC^ The main entry point for the watchface is `/src/rocky/index.js`, so we'll
start by editing this file.
The very first thing we must do is include the Rocky.js library, which gives us
access to the APIs we need to create a Pebble watchface.
```js
var rocky = require('rocky');
```
Next, the invocation of `rocky.on('minutechange', ...)` registers a callback
method to the `minutechange` event - which is emitted every time the internal
clock's minute changes (and also when the handler is registered). Watchfaces
should invoke the ``requestDraw`` method as part of the `minutechange` event to
redraw the screen.
```js
rocky.on('minutechange', function(event) {
rocky.requestDraw();
});
```
> **NOTE**: Watchfaces that need to update more or less frequently can also
> register the `secondchange`, `hourchange` or `daychange` events.
Next we register a callback method to the `draw` event - which is emitted after
each call to `rocky.requestDraw()`. The `event` parameter passed into the
callback function includes a ``CanvasRenderingContext2D`` object, which is used
to determine the display characteristics and draw text or shapes on the display.
```js
rocky.on('draw', function(event) {
// Get the CanvasRenderingContext2D object
var ctx = event.context;
});
```
The ``RockyDrawCallback`` is where we render the smartwatch display, using the
methods provided to us through the ``CanvasRenderingContext2D`` object.
> **NOTE**: The `draw` event may also be emitted at other times, such
as when the handler is first registered.
## Creating a Digital Watchface
In order to create a simple digital watchface, we will need to do the following
things:
- Subscribe to the `minutechange` event.
- Subscribe to the `draw` event, so we can update the display.
- Clear the display each time we draw on the screen.
- Determine the width and height of the available content area of the screen.
- Obtain the current date and time.
- Set the text color to white.
- Center align the text.
- Display the current time, using the width and height to determine the center
point of the screen.
^CP^ To create our minimal watchface which displays the current time, let's
replace the contents of our `index.js` file with the following code:
^LC^ To create our minimal watchface which displays the current time, let's
replace the contents of `/src/rocky/index.js` with the following code:
```js
var rocky = require('rocky');
rocky.on('draw', function(event) {
// Get the CanvasRenderingContext2D object
var ctx = event.context;
// Clear the screen
ctx.clearRect(0, 0, ctx.canvas.clientWidth, ctx.canvas.clientHeight);
// Determine the width and height of the display
var w = ctx.canvas.unobstructedWidth;
var h = ctx.canvas.unobstructedHeight;
// Current date/time
var d = new Date();
// Set the text color
ctx.fillStyle = 'white';
// Center align the text
ctx.textAlign = 'center';
// Display the time, in the middle of the screen
ctx.fillText(d.toLocaleTimeString(), w / 2, h / 2, w);
});
rocky.on('minutechange', function(event) {
// Display a message in the system logs
console.log("Another minute with your Pebble!");
// Request the screen to be redrawn on next pass
rocky.requestDraw();
});
```
## First Compilation and Installation
^CP^ To compile the watchface, click the 'PLAY' button on the right hand side
of the screen. This will save your file, compile the project and launch your
watchface in the emulator.
^CP^ Click the 'VIEW LOGS' button.
<div class="platform-specific" data-sdk-platform="local">
{% markdown {} %}
To compile the watchface, make sure you have saved your project files, then
run the following command from the project's root directory:
```nc|text
$ pebble build
```
After a successful compilation you will see a message reading `'build' finished
successfully`.
If there are any problems with your code, the compiler will tell you which lines
contain an error, so you can fix them. See
[Troubleshooting and Debugging](#troubleshooting-and-debugging) for further
information.
Now install the watchapp and view the logs on the emulator by running:
```nc|text
$ pebble install --logs --emulator basalt
```
{% endmarkdown %}
</div>
## Congratulations!
You should see a loading bar as the watchface is loaded, shortly followed by
your watchface running in the emulator.

Your logs should also be displaying the message we told it to log with
`console.log()`.
```nc|text
Another minute with your Pebble!
```
> Note: You should prevent execution of the log statements by commenting the
code, if you aren't using them. e.g. `//console.log();`
## Creating an Analog Watchface
In order to draw an analog watchface, we will need to do the following things:
- Subscribe to the `minutechange` event.
- Subscribe to the `draw` event, so we can update the display.
- Obtain the current date and time.
- Clear the display each time we draw on the screen.
- Determine the width and height of the available content area of the screen.
- Use the width and height to determine the center point of the screen.
- Calculate the max length of the watch hands based on the available space.
- Determine the correct angle for minutes and hours.
- Draw the minute and hour hands, outwards from the center point.
### Drawing the Hands
We're going to need to draw two lines, one representing the hour hand, and one
representing the minute hand.
We need to implement a function to draw the hands, to prevent duplicating the
same drawing code for hours and minutes. We're going to use a series of
``CanvasRenderingContext2D`` methods to accomplish the desired effect.
First we need to find the center point in our display:
```js
// Determine the available width and height of the display
var w = ctx.canvas.unobstructedWidth;
var h = ctx.canvas.unobstructedHeight;
// Determine the center point of the display
var cx = w / 2;
var cy = h / 2;
```
Now we know the starting point for the hands (`cx`, `cy`), but we still need to
determine the end point. We can do this with a tiny bit of math:
```js
var x2 = cx + Math.sin(angle) * length;
var y2 = cy - Math.cos(angle) * length;
```
Then we'll use the `ctx` parameter and configure the line width and color of
the hand.
```js
// Configure how we want to draw the hand
ctx.lineWidth = 8;
ctx.strokeStyle = color;
```
Finally we draw the hand, starting from the center of the screen, drawing a
straight line outwards.
```js
// Begin drawing
ctx.beginPath();
// Move to the center point, then draw the line
ctx.moveTo(cx, cy);
ctx.lineTo(x2, y2);
// Stroke the line (output to display)
ctx.stroke();
```
### Putting It All Together
```js
var rocky = require('rocky');
function fractionToRadian(fraction) {
return fraction * 2 * Math.PI;
}
function drawHand(ctx, cx, cy, angle, length, color) {
// Find the end points
var x2 = cx + Math.sin(angle) * length;
var y2 = cy - Math.cos(angle) * length;
// Configure how we want to draw the hand
ctx.lineWidth = 8;
ctx.strokeStyle = color;
// Begin drawing
ctx.beginPath();
// Move to the center point, then draw the line
ctx.moveTo(cx, cy);
ctx.lineTo(x2, y2);
// Stroke the line (output to display)
ctx.stroke();
}
rocky.on('draw', function(event) {
var ctx = event.context;
var d = new Date();
// Clear the screen
ctx.clearRect(0, 0, ctx.canvas.clientWidth, ctx.canvas.clientHeight);
// Determine the width and height of the display
var w = ctx.canvas.unobstructedWidth;
var h = ctx.canvas.unobstructedHeight;
// Determine the center point of the display
// and the max size of watch hands
var cx = w / 2;
var cy = h / 2;
// -20 so we're inset 10px on each side
var maxLength = (Math.min(w, h) - 20) / 2;
// Calculate the minute hand angle
var minuteFraction = (d.getMinutes()) / 60;
var minuteAngle = fractionToRadian(minuteFraction);
// Draw the minute hand
drawHand(ctx, cx, cy, minuteAngle, maxLength, "white");
// Calculate the hour hand angle
var hourFraction = (d.getHours() % 12 + minuteFraction) / 12;
var hourAngle = fractionToRadian(hourFraction);
// Draw the hour hand
drawHand(ctx, cx, cy, hourAngle, maxLength * 0.6, "lightblue");
});
rocky.on('minutechange', function(event) {
// Request the screen to be redrawn on next pass
rocky.requestDraw();
});
```
Now compile and run your project in the emulator to see the results!
## Troubleshooting and Debugging
If your build didn't work, you'll see the error message: `Build Failed`. Let's
take a look at some of the common types of errors:
### Rocky.js Linter
As part of the build process, your Rocky `index.js` file is automatically
checked for errors using a process called
['linting'](https://en.wikipedia.org/wiki/Lint_%28software%29).
The first thing to check is the 'Lint Results' section of the build output.
```nc|text
========== Lint Results: index.js ==========
src/rocky/index.js(7,39): error TS1005: ',' expected.
src/rocky/index.js(9,8): error TS1005: ':' expected.
src/rocky/index.js(9,37): error TS1005: ',' expected.
src/rocky/index.js(7,1): warning TS2346: Supplied parameters do not match any signature of call target.
src/rocky/index.js(7,24): warning TS2304: Cannot find name 'funtion'.
Errors: 3, Warnings: 2
Please fix the issues marked with 'error' above.
```
In the error messages above, we see the filename which contains the error,
followed by the line number and column number where the error occurs. For
example:
```nc|text
Filename: src/rocky/index.js
Line number: 7
Character: 24
Description: Cannot find name 'funtion'.
```
```javascript
rocky.on('minutechange', funtion(event) {
// ...
});
```
As we can see, this error relates to a typo, 'funtion' should be 'function'.
Once this error has been fixed and you run `pebble build` again, you should
see:
```nc|text
========== Lint Results: index.js ==========
Everything looks AWESOME!
```
### Locating Errors Using Logging
So what do we do when the build is successful, but our code isn't functioning as
expected? Logging!
Scatter a breadcrumb trail through your application code, that you can follow as
your application is running. This will help to narrow down the location of
the problem.
```javascript
rocky.on('minutechange', function(event) {
console.log('minutechange fired!');
// ...
});
```
Once you've added your logging statements, rebuild the application and view the
logs:
^CP^ Click the 'PLAY' button on the right hand side of the screen, then click
the 'VIEW LOGS' button.
<div class="platform-specific" data-sdk-platform="local">
{% markdown {} %}
```nc|text
$ pebble build && pebble install --emulator basalt --logs
```
{% endmarkdown %}
</div>
If you find that one of your logging statements hasn't appeared in the log
output, it probably means there is an issue in the preceding code.
### I'm still having problems!
If you've tried the steps above and you're still having problems, there are
plenty of places to get help. You can post your question and code on the
[Pebble Forums](https://forums.pebble.com/c/development) or join our
[Discord Server]({{ site.links.discord_invite }}) and ask for assistance.
## Conclusion
So there we have it, the basic process required to create a brand new Pebble
watchface using JavaScript! To do this we:
1. Created a new Rocky.js project.
2. Included the `'rocky'` library.
3. Subscribed to the `minutechange` event.
4. Subscribed to the `draw` event.
5. Used drawing commands to draw text and lines on the display.
If you have problems with your code, check it against the sample source code
provided using the button below.
[View Source Code >{center,bg-lightblue,fg-white}](https://github.com/pebble-examples/rocky-watchface-tutorial-part1)
## What's Next
If you successfully built and run your application, you should have seen a very
basic watchface that closely mimics the built-in TicToc. In the next tutorial,
we'll use `postMessage` to pass information to the mobile device, and
request weather data from the web.
[Go to Part 2 → >{wide,bg-dark-red,fg-white}](/tutorials/js-watchface-tutorial/part2/) | {
"source": "google/pebble",
"title": "devsite/source/tutorials/js-watchface-tutorial/part1.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/js-watchface-tutorial/part1.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 15608
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: js-watchface
tutorial_part: 2
title: Adding Web Content to a Rocky.js JavaScript Watchface
description: A guide to adding web content to a JavaScript watchface
permalink: /tutorials/js-watchface-tutorial/part2/
menu_section: tutorials
generate_toc: true
platform_choice: true
---
{% include tutorials/rocky-js-warning.html %}
In the [previous tutorial](/tutorials/js-watchface-tutorial/part1), we looked
at the process of creating a basic watchface using Pebble's new JavaScript API.
In this tutorial, we'll extend the example to add weather conditions from the
Internet to our watchface.

We'll be using the JavaScript component `pkjs`, which runs on the user's mobile
device using [PebbleKit JS](/docs/pebblekit-js). This `pkjs` component can be
used to access information from the Internet and process it on the phone. This
`pkjs` environment does not have the same the hardware and memory constraints of
the Pebble.
## First Steps
^CP^ The first thing we'll need to do is add a new JavaScript file to the
project we created in [Part 1](/tutorials/js-watchface-tutorial/part1). Click
'Add New' in the left menu, set the filename to `index.js` and the 'TARGET' to
'PebbleKit JS'.
^LC^ The first thing we'll need to do is edit a file from the project we
created in [Part 1](/tutorials/js-watchface-tutorial/part1). The file is
called `/src/pkjs/index.js` and it is the entry point for the `pkjs` portion
of the application.
This `pkjs` component of our application is capable of sending and receiving
messages with the smartwatch, accessing the user's location, making web
requests, and an assortment of other tasks that are all documented in the
[PebbleKit JS](/docs/pebblekit-js) documentation.
> Although Rocky.js (watch) and `pkjs` (phone) both use JavaScript, they
> have separate APIs and purposes. It is important to understand the differences
> and not attempt to run your code within the wrong component.
## Sending and Receiving Messages
Before we get onto the example, it's important to understand how to send and
receive messages between the Rocky.js component on the smartwatch, and the
`pkjs` component on the mobile device.
### Sending Messages
To send a message from the smartwatch to the mobile device, use the
``rocky.postMessage`` method, which allows you to send an arbitrary JSON
object:
```js
// rocky index.js
var rocky = require('rocky');
// Send a message from the smartwatch
rocky.postMessage({'test': 'hello from smartwatch'});
```
To send a message from the mobile device to the smartwatch, use the
``Pebble.postMessage`` method:
```js
// pkjs index.js
// Send a message from the mobile device
Pebble.postMessage({'test': 'hello from mobile device'});
```
### Message Listeners
We can create a message listener in our smartwatch code using the ``rocky.on``
method:
```js
// rocky index.js
// On the smartwatch, begin listening for a message from the mobile device
rocky.on('message', function(event) {
// Get the message that was passed
console.log(JSON.stringify(event.data));
});
```
We can also create a message listener in our `pkjs` code using the ``Pebble.on``
method:
```js
// pkjs index.js
// On the phone, begin listening for a message from the smartwatch
Pebble.on('message', function(event) {
// Get the message that was passed
console.log(JSON.stringify(event.data));
});
```
## Requesting Location
Our `pkjs` component can access to the location of the user's smartphone. The
Rocky.js component cannot access location information directly, it must request
it from `pkjs`.
^CP^ In order to use this functionality, you must change your project settings
in CloudPebble. Click 'SETTINGS' in the left menu, then tick 'USES LOCATION'.
<div class="platform-specific" data-sdk-platform="local">
{% markdown {} %}
In order to use this functionality, your application must include the
`location` flag in the
[`pebble.capabilities`](/guides/tools-and-resources/app-metadata/)
array of your `package.json` file.
```js
// file: package.json
// ...
"pebble": {
"capabilities": ["location"]
}
// ...
```
{% endmarkdown %}
</div>
Once we've added the `location` flag, we can access GPS coordinates using the
[Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation).
In this example, we're going to request the user's location when we receive the
"fetch" message from the smartwatch.
```js
// pkjs index.js
Pebble.on('message', function(event) {
// Get the message that was passed
var message = event.data;
if (message.fetch) {
navigator.geolocation.getCurrentPosition(function(pos) {
// TODO: fetch weather
}, function(err) {
console.error('Error getting location');
},
{ timeout: 15000, maximumAge: 60000 });
}
});
```
## Web Service Calls
The `pkjs` side of our application can also access the
[XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest)
object. Using this object, developers are able to interact with external web
services.
In this tutorial, we will interface with
[Open Weather Map](http://openweathermap.org/) โ a common weather API used by
the [Pebble Developer Community](https://forums.pebble.com/c/development).
The `XMLHttpRequest` object is quite powerful, but can be intimidating to get
started with. To make things a bit simpler, we'll wrap the object with a helper
function which makes the request, then raises a callback:
```js
// pkjs index.js
function request(url, type, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
callback(this.responseText);
};
xhr.open(type, url);
xhr.send();
}
```
The three arguments we have to provide when calling our `request()` method are
the URL, the type of request (`GET` or `POST`) and a callback for when the
response is received.
### Fetching Weather Data
The URL is specified on the
[OpenWeatherMap API page](http://openweathermap.org/current), and contains the
coordinates supplied by `getCurrentPosition()` (latitude and longitude),
followed by the API key:
{% include guides/owm-api-key-notice.html %}
```js
var myAPIKey = '1234567';
var url = 'http://api.openweathermap.org/data/2.5/weather' +
'?lat=' + pos.coords.latitude +
'&lon=' + pos.coords.longitude +
'&appid=' + myAPIKey;
```
All together, our message handler should now look like the following:
```js
// pkjs index.js
var myAPIKey = '1234567';
Pebble.on('message', function(event) {
// Get the message that was passed
var message = event.data;
if (message.fetch) {
navigator.geolocation.getCurrentPosition(function(pos) {
var url = 'http://api.openweathermap.org/data/2.5/weather' +
'?lat=' + pos.coords.latitude +
'&lon=' + pos.coords.longitude +
'&appid=' + myAPIKey;
request(url, 'GET', function(respText) {
var weatherData = JSON.parse(respText);
//TODO: Send weather to smartwatch
});
}, function(err) {
console.error('Error getting location');
},
{ timeout: 15000, maximumAge: 60000 });
}
});
```
## Finishing Up
Once we receive the weather data from OpenWeatherMap, we need to send it to the
smartwatch using ``Pebble.postMessage``:
```js
// pkjs index.js
// ...
request(url, 'GET', function(respText) {
var weatherData = JSON.parse(respText);
Pebble.postMessage({
'weather': {
// Convert from Kelvin
'celcius': Math.round(weatherData.main.temp - 273.15),
'fahrenheit': Math.round((weatherData.main.temp - 273.15) * 9 / 5 + 32),
'desc': weatherData.weather[0].main
}
});
});
```
On the smartwatch, we'll need to create a message handler to listen for a
`weather` message, and store the information so it can be drawn on screen.
```js
// rocky index.js
var rocky = require('rocky');
// Global object to store weather data
var weather;
rocky.on('message', function(event) {
// Receive a message from the mobile device (pkjs)
var message = event.data;
if (message.weather) {
// Save the weather data
weather = message.weather;
// Request a redraw so we see the information
rocky.requestDraw();
}
});
```
We also need to send the 'fetch' command from the smartwatch to ask for weather
data when the application starts, then every hour:
```js
// rocky index.js
// ...
rocky.on('hourchange', function(event) {
// Send a message to fetch the weather information (on startup and every hour)
rocky.postMessage({'fetch': true});
});
```
Finally, we'll need some new code in our Rocky `draw` handler to display the
temperature and conditions:
```js
// rocky index.js
var rocky = require('rocky');
// ...
function drawWeather(ctx, weather) {
// Create a string describing the weather
//var weatherString = weather.celcius + 'ยบC, ' + weather.desc;
var weatherString = weather.fahrenheit + 'ยบF, ' + weather.desc;
// Draw the text, top center
ctx.fillStyle = 'lightgray';
ctx.textAlign = 'center';
ctx.font = '14px Gothic';
ctx.fillText(weatherString, ctx.canvas.unobstructedWidth / 2, 2);
}
rocky.on('draw', function(event) {
var ctx = event.context;
var d = new Date();
// Clear the screen
ctx.clearRect(0, 0, ctx.canvas.clientWidth, ctx.canvas.clientHeight);
// Draw the conditions (before clock hands, so it's drawn underneath them)
if (weather) {
drawWeather(ctx, weather);
}
// ...
});
```
## Conclusion
So there we have it, we successfully added web content to our JavaScript
watchface! To do this we:
1. Enabled `location` in our `package.json`.
2. Added a `Pebble.on('message', function() {...});` listener in `pkjs`.
3. Retrieved the users current GPS coordinates in `pkjs`.
4. Used `XMLHttpRequest` to query OpenWeatherMap API.
5. Sent the current weather conditions from the mobile device, to the
smartwatch, using `Pebble.postMessage()`.
6. On the smartwatch, we created a `rocky.on('message', function() {...});`
listener to receive the weather data from `pkjs`.
7. We subscribed to the `hourchange` event, to send a message to `pkjs` to
request the weather data when the application starts and every hour.
8. Then finally we drew the weather conditions on the screen as text.
If you have problems with your code, check it against the sample source code
provided using the button below.
[View Source Code >{center,bg-lightblue,fg-white}](https://github.com/pebble-examples/rocky-watchface-tutorial-part2)
## What's Next
We hope you enjoyed this tutorial and that it inspires you to make something
awesome!
Why not let us know what you've created by tweeting
[@pebbledev](https://twitter.com/pebbledev), or join our epic developer
community on [Discord]({{ site.links.discord_invite }}). | {
"source": "google/pebble",
"title": "devsite/source/tutorials/js-watchface-tutorial/part2.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/js-watchface-tutorial/part2.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 11443
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: utils/redirect_permanent
redirect_to: /tutorials/watchface-tutorial/part1/
--- | {
"source": "google/pebble",
"title": "devsite/source/tutorials/watchface-tutorial/index.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/watchface-tutorial/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 665
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: watchface
tutorial_part: 1
title: Build Your Own Watchface in C
description: A guide to making a new Pebble watchface with the Pebble C API
permalink: /tutorials/watchface-tutorial/part1/
menu_section: tutorials
generate_toc: true
platform_choice: true
---
In this tutorial we'll cover the basics of writing a simple watchface with
Pebble's C API. Customizability is at the heart of the Pebble philosophy, so
we'll be sure to add some exciting features for the user!
When we are done this section of the tutorial, you should end up with a brand
new basic watchface looking something like this:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/1-time.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
## First Steps
So, let's get started!
^CP^ Go to [CloudPebble]({{ site.links.cloudpebble }}) and click 'Get Started'
to log in using your Pebble account, or create a new one if you do not already
have one. Next, click 'Create' to create a new project. Give your project a
suitable name, such as 'Tutorial 1' and leave the 'Project Type' as 'Pebble C
SDK', with a 'Template' of 'Empty project', as we will be starting from scratch
to help maximize your understanding as we go.
^LC^ Before you can start the tutorial you will need to have the Pebble SDK
installed. If you haven't done this yet, go to our [download page](/sdk) to grab
the SDK and follow the instructions to install it on your machine. Once you've
done that you can come back here and carry on where you left off.
^LC^ Once you have installed the SDK, navigate to a directory of your choosing
and run `pebble new-project watchface` (where 'watchface' is the name of your
new project) to start a new project and set up all the relevant files.
^CP^ Click 'Create' and you will see the main CloudPebble project screen. The
left menu shows all the relevant links you will need to create your watchface.
Click on 'Settings' and you will see the name you just supplied, along with
several other options. As we are creating a watchface, change the 'App Kind' to
'Watchface'.
^LC^ In an SDK project, all the information about how an app is configured (its
name, author, capabilities and resource listings etc) is stored in a file in the
project root directory called `package.json`. Since this project will be a
watchface, you will need to modify the `watchapp` object in this file to reflect
this:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"watchapp": {
"watchface": true
}
{% endhighlight %}
</div>
The main difference between the two kinds are that watchfaces serve as the
default display on the watch, with the Up and Down buttons allowing use of the
Pebble timeline. This means that these buttons are not available for custom
behavior (Back and Select are also not available to watchfaces). In contrast,
watchapps are launched from the Pebble system menu. These have more capabilities
such as button clicks and menu elements, but we will come to those later.
^CP^ Finally, set your 'Company Name' and we can start to write some code!
^LC^ Finally, set a value for `companyName` and we can start to write some code!
## Watchface Basics
^CP^ Create the first source file by clicking 'Add New' on the left menu,
selecting 'C file' as the type and choosing a suitable name such as 'main.c'.
Click 'Create' and you will be shown the main editor screen.
^LC^ Our first source file is already created for you by the `pebble` command
line tool and lives in the project's `src` directory. By default, this file
contains sample code which you can safely remove, since we will be starting from
scratch. Alternatively, you can avoid this by using the `--simple` flag when
creating the project.
Let's add the basic code segments which are required by every watchapp. The
first of these is the main directive to use the Pebble SDK at the top of the
file like so:
```c
#include <pebble.h>
```
After this first line, we must begin with the recommended app structure,
specifically a standard C `main()` function and two other functions to help us
organize the creation and destruction of all the Pebble SDK elements. This helps
make the task of managing memory allocation and deallocation as simple as
possible. Additionally, `main()` also calls ``app_event_loop()``, which lets the
watchapp wait for system events until it exits.
^CP^ The recommended structure is shown below, and you can use it as the basis
for your own watchface file by copying it into CloudPebble:
^LC^ The recommended structure is shown below, and you can use it as the basis
for your main C file:
```c
#include <pebble.h>
static void init() {
}
static void deinit() {
}
int main(void) {
init();
app_event_loop();
deinit();
}
```
To add the first ``Window``, we first declare a static pointer to a ``Window``
variable, so that we can access it wherever we need to, chiefly in the `init()`
and `deinit()` functions. Add this declaration below `#include`, prefixed with
`s_` to denote its `static` nature (`static` here means it is accessible only
within this file):
```c
static Window *s_main_window;
```
The next step is to create an instance of ``Window`` to assign to this pointer,
which we will do in `init()` using the appropriate Pebble SDK functions. In this
process we also assign two handler functions that provide an additional layer of
abstraction to manage the subsequent creation of the ``Window``'s sub-elements,
in a similar way to how `init()` and `deinit()` perform this task for the
watchapp as a whole. These two functions should be created above `init()` and
must match the following signatures (the names may differ, however):
```c
static void main_window_load(Window *window) {
}
static void main_window_unload(Window *window) {
}
```
With this done, we can complete the creation of the ``Window`` element, making
reference to these two new handler functions that are called by the system
whenever the ``Window`` is being constructed. This process is shown below, and
takes place in `init()`:
```c
static void init() {
// Create main Window element and assign to pointer
s_main_window = window_create();
// Set handlers to manage the elements inside the Window
window_set_window_handlers(s_main_window, (WindowHandlers) {
.load = main_window_load,
.unload = main_window_unload
});
// Show the Window on the watch, with animated=true
window_stack_push(s_main_window, true);
}
```
A good best-practice to learn at this early stage is to match every Pebble SDK
`_create()` function call with the equivalent `_destroy()` function to make sure
all memory used is given back to the system when the app exits. Let's do this
now in `deinit()` for our main ``Window`` element:
```c
static void deinit() {
// Destroy Window
window_destroy(s_main_window);
}
```
We can now compile and run this watchface, but it will not show anything
interesting yet. It is also a good practice to check that our code is still
valid after each iterative change, so let's do this now.
## First Compilation and Installation
^CP^ To compile the watchface, make sure you have saved your C file by clicking
the 'Save' icon on the right of the editor screen and then proceed to the
'Compilation' screen by clicking the appropriate link on the left of the screen.
Click 'Run Build' to start the compilation process and wait for the result.
Hopefully the status should become 'Succeeded', meaning the code is valid and
can be run on the watch.
^LC^ To compile the watchface, make sure you have saved your project files and
then run `pebble build` from the project's root directory. The installable
`.pbw` file will be deposited in the `build` directory. After a successful
compile you will see a message reading `'build' finished successfully`. If there
are any problems with your code, the compiler will tell you which lines are in
error so you can fix them.
In order to install your watchface on your Pebble, first
[setup the Pebble Developer Connection](/guides/tools-and-resources/developer-connection/).
Make sure you are using the latest version of the Pebble app.
^CP^ Click 'Install and Run' and wait for the app to install.
^LC^ Install the watchapp by running `pebble install`, supplying your phone's IP
address with the `--phone` flag. For example: `pebble install
--phone 192.168.1.78`.
<div class="platform-specific" data-sdk-platform="local">
{% markdown {} %}
> Instead of using the --phone flag every time you install, set the PEBBLE_PHONE environment variable:
> `export PEBBLE_PHONE=192.168.1.78` and simply use `pebble install`.
{% endmarkdown %}
</div>
Congratulations! You should see that you have a new item in the watchface menu,
but it is entirely blank!
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/1-blank.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
Let's change that with the next stage towards a basic watchface - the
``TextLayer`` element.
## Showing Some Text
^CP^ Navigate back to the CloudPebble code editor and open your main C file to
continue adding code.
^LC^ Re-open your main C file to continue adding code.
The best way to show some text on a watchface or watchapp
is to use a ``TextLayer`` element. The first step in doing this is to follow a
similar procedure to that used for setting up the ``Window`` with a pointer,
ideally added below `s_main_window`:
```c
static TextLayer *s_time_layer;
```
This will be the first element added to our ``Window``, so we will make the
Pebble SDK function calls to create it in `main_window_load()`. After calling
``text_layer_create()``, we call other functions with plain English names that
describe exactly what they do, which is to help setup layout properties for the
text shown in the ``TextLayer`` including colors, alignment and font size. We
also include a call to ``text_layer_set_text()`` with "00:00" so that we can
verify that the ``TextLayer`` is set up correctly.
The layout parameters will vary depending on the shape of the display. To easily
specify which value of the vertical position is used on each of the round and
rectangular display shapes we use ``PBL_IF_ROUND_ELSE()``. Thus
`main_window_load()` becomes:
```c
static void main_window_load(Window *window) {
// Get information about the Window
Layer *window_layer = window_get_root_layer(window);
GRect bounds = layer_get_bounds(window_layer);
// Create the TextLayer with specific bounds
s_time_layer = text_layer_create(
GRect(0, PBL_IF_ROUND_ELSE(58, 52), bounds.size.w, 50));
// Improve the layout to be more like a watchface
text_layer_set_background_color(s_time_layer, GColorClear);
text_layer_set_text_color(s_time_layer, GColorBlack);
text_layer_set_text(s_time_layer, "00:00");
text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);
// Add it as a child layer to the Window's root layer
layer_add_child(window_layer, text_layer_get_layer(s_time_layer));
}
```
Note the use of SDK values such as ``GColorBlack`` and `FONT_KEY_BITHAM_42_BOLD`
which allow use of built-in features and behavior. These examples here are the
color black and a built in system font. Later we will discuss loading a custom
font file, which can be used to replace this value.
Just like with ``Window``, we must be sure to destroy each element we create. We
will do this in `main_window_unload()`, to keep the management of the
``TextLayer`` completely within the loading and unloading of the ``Window`` it
is associated with. This function should now look like this:
```c
static void main_window_unload(Window *window) {
// Destroy TextLayer
text_layer_destroy(s_time_layer);
}
```
^CP^ This completes the setup of the basic watchface layout. If you return to
'Compilation' and install a new build, you should now see the following:
^LC^ This completes the setup of the basic watchface layout. If you run `pebble
build && pebble install` (with your phone's IP address) for the new build, you
should now see the following:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/1-textlayer-test.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
The final step is to get the current time and display it using the
``TextLayer``. This is done with the ``TickTimerService``.
## Telling the Time
The ``TickTimerService`` is an Event Service that allows access to the current
time by subscribing a function to be run whenever the time changes. Normally
this may be every minute, but can also be every hour, or every second. However,
the latter will incur extra battery costs, so use it sparingly. We can do this
by calling ``tick_timer_service_subscribe()``, but first we must create a
function to give the service to call whenever the time changes, and must match
this signature:
```c
static void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
}
```
This means that whenever the time changes, we are provided with a data structure
of type `struct tm` containing the current time
[in various forms](http://www.cplusplus.com/reference/ctime/tm/), as well as a
constant ``TimeUnits`` value that tells us which unit changed, to allow
filtering of behaviour. With our ``TickHandler`` created, we can register it
with the Event Service in `init()` like so:
```c
// Register with TickTimerService
tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);
```
The logic to update the time ``TextLayer`` will be created in a function called
`update_time()`, enabling us to call it both from the ``TickHandler`` as well as
`main_window_load()` to ensure it is showing a time from the very beginning.
This function will use `strftime()`
([See here for formatting](http://www.cplusplus.com/reference/ctime/strftime/))
to extract the hours and minutes from the `struct tm` data structure and write
it into a character buffer. This buffer is required by ``TextLayer`` to be
long-lived as long as the text is to be displayed, as it is not copied into the
``TextLayer``, but merely referenced. We achieve this by making the buffer
`static`, so it persists across multiple calls to `update_time()`. Therefore
this function should be created before `main_window_load()` and look like this:
```c
static void update_time() {
// Get a tm structure
time_t temp = time(NULL);
struct tm *tick_time = localtime(&temp);
// Write the current hours and minutes into a buffer
static char s_buffer[8];
strftime(s_buffer, sizeof(s_buffer), clock_is_24h_style() ?
"%H:%M" : "%I:%M", tick_time);
// Display this time on the TextLayer
text_layer_set_text(s_time_layer, s_buffer);
}
```
Our ``TickHandler`` follows the correct function signature and contains only a
single call to `update_time()` to do just that:
```c
static void tick_handler(struct tm *tick_time, TimeUnits units_changed) {
update_time();
}
```
Lastly, `init()` should be modified include a call to
`update_time()` after ``window_stack_push()`` to ensure the time is displayed
correctly when the watchface loads:
```c
// Make sure the time is displayed from the start
update_time();
```
Since we can now display the time we can remove the call to
``text_layer_set_text()`` in `main_window_load()`, as it is no longer needed to
test the layout.
Re-compile and re-install the watchface on your Pebble, and it should look like
this:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/1-time.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
## Conclusion
So there we have it, the basic process required to create a brand new Pebble
watchface! To do this we:
1. Created a new Pebble project.
2. Setup basic app structure.
3. Setup a main ``Window``.
4. Setup a ``TextLayer`` to display the time.
5. Subscribed to ``TickTimerService`` to get updates on the time, and wrote
these to a buffer for display in the ``TextLayer``.
If you have problems with your code, check it against the sample source code
provided using the button below.
^CP^ [Edit in CloudPebble >{center,bg-lightblue,fg-white}]({{ site.links.cloudpebble }}ide/gist/9b9d50b990d742a3ae34)
^LC^ [View Source Code >{center,bg-lightblue,fg-white}](https://gist.github.com/9b9d50b990d742a3ae34)
## What's Next?
The next section of the tutorial will introduce adding custom fonts and bitmap
images to your watchface.
[Go to Part 2 → >{wide,bg-dark-red,fg-white}](/tutorials/watchface-tutorial/part2/) | {
"source": "google/pebble",
"title": "devsite/source/tutorials/watchface-tutorial/part1.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/watchface-tutorial/part1.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 18254
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: watchface
tutorial_part: 2
title: Customizing Your Watchface
description: A guide to personalizing your new Pebble watchface
permalink: /tutorials/watchface-tutorial/part2/
generate_toc: true
platform_choice: true
---
In the previous page of the tutorial, you learned how to create a new Pebble
project, set it up as a basic watchface and use ``TickTimerService`` to display
the current time. However, the design was pretty basic, so let's improve it with
some customization!
In order to do this we will be using some new Pebble SDK concepts, including:
- Resource management
- Custom fonts (using ``GFont``)
- Images (using ``GBitmap`` and ``BitmapLayer``)
These will allow us to completely change the look and feel of the watchface. We
will provide some sample materials to use, but once you understand the process
be sure to replace these with your own to truly make it your own! Once we're
done, you should end up with a watchface looking like this:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/2-final.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
## First Steps
To continue from the last part, you can either modify your existing Pebble
project or create a new one, using the code from that project's main `.c` file
as a starting template. For reference, that should look
[something like this](https://gist.github.com/pebble-gists/9b9d50b990d742a3ae34).
^CP^ You can create a new CloudPebble project from this template by
[clicking here]({{ site.links.cloudpebble }}ide/gist/9b9d50b990d742a3ae34).
The result of the first part should look something like this - a basic time
display:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/1-time.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
Let's improve it!
## Adding a Custom Font
^CP^ To add a custom font resource to use for the time display ``TextLayer``,
click 'Add New' on the left of the CloudPebble editor. Set the 'Resource Type'
to 'TrueType font' and upload a font file. Choose an 'Identifier', which is the
value we will use to refer to the font resource in the `.c` file. This must end
with the desired font size, which must be small enough to show a wide time such
as '23:50' in the ``TextLayer``. If it does not fit, you can always return here
to try another size. Click save and the font will be added to your project.
^LC^ App resources (fonts and images etc.) are managed in the `package.json`
file in the project's root directory, as detailed in
[*App Resources*](/guides/app-resources/). All image files and fonts must
reside in subfolders of the `/resources` folder of your project. Below is an
example entry in the `media` array:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"media": [
{
"type": "font",
"name": "FONT_PERFECT_DOS_48",
"file": "fonts/perfect-dos-vga.ttf",
"compatibility":"2.7"
}
]
{% endhighlight %}
</div>
^LC^ In the example above, we would place our `perfect-dos-vga.ttf` file in the
`/resources/fonts/` folder of our project.
A custom font file must be a
[TrueType](http://en.wikipedia.org/wiki/TrueType) font in the `.ttf` file format.
[Here is an example font to use]({{ site.asset_path }}/fonts/getting-started/watchface-tutorial/perfect-dos-vga.ttf)
([source](http://www.dafont.com/perfect-dos-vga-437.font)).
Now we will substitute the system font used before (`FONT_KEY_BITHAM_42_BOLD`)
for our newly imported one.
To do this, we will declare a ``GFont`` globally.
```c
// Declare globally
static GFont s_time_font;
```
Next, we add the creation and substitution of the new ``GFont`` in the existing
call to ``text_layer_set_font()`` in `main_window_load()`. Shown here is an
example identifier used when uploading the font earlier, `FONT_PERFECT_DOS_48`,
which is always pre-fixed with `RESOURCE_ID_`:
```c
void main_window_load() {
// ...
// Create GFont
s_time_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_48));
// Apply to TextLayer
text_layer_set_font(s_time_layer, s_time_font);
// ...
}
```
And finally, safe destruction of the ``GFont`` in `main_window_unload()`:
```c
void main_window_unload() {
// ...
// Unload GFont
fonts_unload_custom_font(s_time_font);
// ...
}
```
^CP^ After re-compiling and re-installing (either by using the green 'Play'
button to the top right of the CloudPebble editor, or by clicking 'Run Build'
and 'Install and Run' on the 'Compilation' screen), the watchface should feature
a much more interesting font.
^LC^ After re-compiling and re-installing with `pebble build && pebble install`,
the watchface should feature a much more interesting font.
An example screenshot is shown below:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/2-custom-font.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
## Adding a Bitmap
The Pebble SDK also allows you to use a 2-color (black and white) bitmap image
in your watchface project. You can ensure that you meet this requirement by
checking the export settings in your graphics package, or by purely using only
white (`#FFFFFF`) and black (`#000000`) in the image's creation. Another
alternative is to use a dithering tool such as
[HyperDither](http://2002-2010.tinrocket.com/software/hyperdither/index.html).
This will be loaded from the watchface's resources into a ``GBitmap`` data
structure before being displayed using a ``BitmapLayer`` element. These two
behave in a similar fashion to ``GFont`` and ``TextLayer``, so let's get
started.
^CP^ The first step is the same as using a custom font; import the bitmap into
CloudPebble as a resource by clicking 'Add New' next to 'Resources' on the left
of the CloudPebble project screen. Ensure the 'Resource Type' is 'Bitmap image',
choose an identifier for the resource and upload your file.
^LC^ You add a bitmap to the `package.json` file in the
[same way](/guides/app-resources/fonts) as a font, except the new `media` array
object will have a `type` of `bitmap`. Below is an example:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
{
"type": "bitmap",
"name": "IMAGE_BACKGROUND",
"file": "images/background.png"
}
{% endhighlight %}
</div>
As before, here is an example bitmap we have created for you to use, which looks
like this:
[]({{ site.asset_path }}/images/getting-started/watchface-tutorial/background.png)
Once this has been added to the project, return to your `.c` file and declare
two more pointers, one each of ``GBitmap`` and ``BitmapLayer`` near the top of
the file:
```c
static BitmapLayer *s_background_layer;
static GBitmap *s_background_bitmap;
```
Now we will create both of these in `main_window_load()`. After both elements
are created, we set the ``BitmapLayer`` to use our ``GBitmap`` and then add it
as a child of the main ``Window`` as we did for the ``TextLayer``.
However, is should be noted that the ``BitmapLayer`` must be added to the
``Window`` before the ``TextLayer``. This will ensure that the text is drawn *on
top of* the image. Otherwise, the text will be drawn behind the image and remain
invisible to us. Here is that process in full, to be as clear as possible:
```c
// Create GBitmap
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);
// Create BitmapLayer to display the GBitmap
s_background_layer = bitmap_layer_create(bounds);
// Set the bitmap onto the layer and add to the window
bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);
layer_add_child(window_layer, bitmap_layer_get_layer(s_background_layer));
```
As always, the final step should be to ensure we free up the memory consumed by
these new elements in `main_window_unload()`:
```c
// Destroy GBitmap
gbitmap_destroy(s_background_bitmap);
// Destroy BitmapLayer
bitmap_layer_destroy(s_background_layer);
```
The final step is to set the background color of the main ``Window`` to match
the background image. Do this in `init()`:
```c
window_set_background_color(s_main_window, GColorBlack);
```
With all this in place, the example background image should nicely frame the
time and match the style of the new custom font. Of course, if you have used
your own font and bitmap (highly recommended!) then your watchface will not look
exactly like this.
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/2-final.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
## Conclusion
After adding a custom font and a background image, our new watchface now looks
much nicer. If you want to go a bit further, try adding a new ``TextLayer`` in
the same way as the time display one to show the current date (hint: look at the
[formatting options](http://www.cplusplus.com/reference/ctime/strftime/)
available for `strftime()`!)
As with last time, you can compare your own code to the example source code
using the button below.
^CP^ [Edit in CloudPebble >{center,bg-lightblue,fg-white}]({{ site.links.cloudpebble }}ide/gist/d216d9e0b840ed296539)
^LC^ [View Source Code >{center,bg-lightblue,fg-white}](https://gist.github.com/d216d9e0b840ed296539)
## What's Next?
The next section of the tutorial will introduce PebbleKit JS for adding
web-based content to your watchface.
[Go to Part 3 → >{wide,bg-dark-red,fg-white}](/tutorials/watchface-tutorial/part3/) | {
"source": "google/pebble",
"title": "devsite/source/tutorials/watchface-tutorial/part2.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/watchface-tutorial/part2.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 10998
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: watchface
tutorial_part: 3
title: Adding Web Content
description: A guide to adding web-based content your Pebble watchface
permalink: /tutorials/watchface-tutorial/part3/
generate_toc: true
platform_choice: true
---
In the previous tutorial parts, we created a simple watchface to tell the time
and then improved it with a custom font and background bitmap. There's a lot you
can do with those elements, such as add more bitmaps, an extra ``TextLayer``
showing the date, but let's aim even higher. This part is longer than the last,
so make sure you have a nice cup of your favourite hot beverage on hand before
embarking!
In this tutorial we will add some extra content to the watchface that is fetched
from the web using [PebbleKit JS](/guides/communication/using-pebblekit-js/).
This part of the SDK allows you to use JavaScript to access the web as well as
the phone's location services and storage. It even allows you to display a
configuration screen to give users options over how they want your watchface or
app to look and run.
By the end of this tutorial we will arrive at a watchface like the one below, in
all its customized glory:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/3-final.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
To continue from the last part, you can either modify your existing Pebble
project or create a new one, using the code from that project's main `.c` file
as a starting template. For reference, that should look
[something like this](https://gist.github.com/pebble-gists/d216d9e0b840ed296539).
^CP^ You can create a new CloudPebble project from this template by
[clicking here]({{ site.links.cloudpebble }}ide/gist/d216d9e0b840ed296539).
## Preparing the Watchface Layout
The content we will be fetching will be the current weather conditions and
temperature from [OpenWeatherMap](http://openweathermap.org). We will need a new
``TextLayer`` to show this extra content. Let's do that now at the top of the C
file, as we did before:
```c
static TextLayer *s_weather_layer;
```
As usual, we then create it properly in `main_window_load()` after the existing
elements. Here is the ``TextLayer`` setup; this should all be familiar to you
from the previous two tutorial parts:
```c
// Create temperature Layer
s_weather_layer = text_layer_create(
GRect(0, PBL_IF_ROUND_ELSE(125, 120), bounds.size.w, 25));
// Style the text
text_layer_set_background_color(s_weather_layer, GColorClear);
text_layer_set_text_color(s_weather_layer, GColorWhite);
text_layer_set_text_alignment(s_weather_layer, GTextAlignmentCenter);
text_layer_set_text(s_weather_layer, "Loading...");
```
We will be using the same font as the time display, but at a reduced font size.
^CP^ To do this, we return to our uploaded font resource and click 'Another
Font. The second font that appears below should be given an 'Identifier' with
`_20` at the end, signifying we now want font size 20 (suitable for the example
font provided).
^LC^ You can add another font in `package.json` by duplicating the first font's
entry in the `media` array and changing the font size indicated in the `name`
field to `_20` or similar. Below is an example showing both fonts:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"media": [
{
"type":"font",
"name":"FONT_PERFECT_DOS_48",
"file":"perfect-dos-vga.ttf",
"compatibility": "2.7"
},
{
"type":"font",
"name":"FONT_PERFECT_DOS_20",
"file":"perfect-dos-vga.ttf",
"compatibility": "2.7"
},
]
{% endhighlight %}
</div>
Now we will load and apply that font as we did last time, beginning with a new
``GFont`` declared at the top of the file:
```c
static GFont s_weather_font;
```
Next, we load the resource and apply it to the new ``TextLayer`` and then add
that as a child layer to the main ``Window``:
```c
// Create second custom font, apply it and add to Window
s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_20));
text_layer_set_font(s_weather_layer, s_weather_font);
layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_weather_layer));
```
Finally, as usual, we add the same destruction calls in `main_window_unload()`
as for everything else:
```c
// Destroy weather elements
text_layer_destroy(s_weather_layer);
fonts_unload_custom_font(s_weather_font);
```
After compiling and installing, your watchface should look something like this:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/3-loading.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
## Preparing AppMessage
The primary method of communication for all Pebble watchapps and watchfaces is
the ``AppMessage`` API. This allows the construction of key-value dictionaries
for transmission between the watch and connected phone. The standard procedure
we will be following for enabling this communication is as follows:
1. Create ``AppMessage`` callback functions to process incoming messages and
errors.
2. Register this callback with the system.
3. Open ``AppMessage`` to allow app communication.
After this process is performed any incoming messages will cause a call to the
``AppMessageInboxReceived`` callback and allow us to react to its contents.
Let's get started!
The callbacks should be placed before they are referred to in the code file, so
a good place is above `init()` where we will be registering them. The function
signature for ``AppMessageInboxReceived`` is shown below:
```c
static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
}
```
We will also create and register three other callbacks so we can see all
outcomes and any errors that may occur, such as dropped messages. These are
reported with calls to ``APP_LOG`` for now, but more detail
[can be gotten from them](http://stackoverflow.com/questions/21150193/logging-enums-on-the-pebble-watch):
```c
static void inbox_dropped_callback(AppMessageResult reason, void *context) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Message dropped!");
}
static void outbox_failed_callback(DictionaryIterator *iterator, AppMessageResult reason, void *context) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Outbox send failed!");
}
static void outbox_sent_callback(DictionaryIterator *iterator, void *context) {
APP_LOG(APP_LOG_LEVEL_INFO, "Outbox send success!");
}
```
With this in place, we will now register the callbacks with the system in
`init()`:
```c
// Register callbacks
app_message_register_inbox_received(inbox_received_callback);
app_message_register_inbox_dropped(inbox_dropped_callback);
app_message_register_outbox_failed(outbox_failed_callback);
app_message_register_outbox_sent(outbox_sent_callback);
```
And finally the third step, opening ``AppMessage`` to allow the watchface to
receive incoming messages, directly below
``app_message_register_inbox_received()``. It is considered best practice to
register callbacks before opening ``AppMessage`` to ensure that no messages are
missed. The code snippet below shows this process using two variables to specify
the inbox and outbox size (in bytes):
```c
// Open AppMessage
const int inbox_size = 128;
const int outbox_size = 128;
app_message_open(inbox_size, outbox_size);
```
> Read
> [*Buffer Sizes*](/guides/pebble-apps/communications/appmessage/#buffer-sizes)
> to learn about using correct buffer sizes for your app.
## Preparing PebbleKit JS
The weather data itself will be downloaded by the JavaScript component of the
watchface, and runs on the connected phone whenever the watchface is opened.
^CP^ To begin using PebbleKit JS, click 'Add New' in the CloudPebble editor,
next to 'Source Files'. Select 'JavaScript file' and choose a file name.
CloudPebble allows any normally valid file name, such as `weather.js`.
^LC^ To begin using PebbleKit JS, add a new file to your project at
`src/pkjs/index.js` to contain your JavaScript code.
To get off to a quick start, we will provide a basic template for using the
PebbleKit JS SDK. This template features two basic event listeners. One is for
the 'ready' event, which fires when the JS environment on the phone is first
available after launch. The second is for the 'appmessage' event, which fires
when an AppMessage is sent from the watch to the phone.
This template is shown below for you to start your JS file:
```js
// Listen for when the watchface is opened
Pebble.addEventListener('ready',
function(e) {
console.log('PebbleKit JS ready!');
}
);
// Listen for when an AppMessage is received
Pebble.addEventListener('appmessage',
function(e) {
console.log('AppMessage received!');
}
);
```
After compiling and installing the watchface, open the app logs.
^CP^ Click the 'View Logs' button on the confirmation dialogue or the
'Compilation' screen if it was already dismissed.
^LC^ You can listen for app logs by running `pebble logs`, supplying your
phone's IP address with the `--phone` switch. For example:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
pebble logs --phone 192.168.1.78
{% endhighlight %}
</div>
^LC^ You can also combine these two commands into one:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
pebble install --logs --phone 192.168.1.78
{% endhighlight %}
</div>
You should see a message matching that set to appear using `console.log()` in
the JS console in the snippet above! This is where any information sent using
``APP_LOG`` in the C file or `console.log()` in the JS file will be shown, and
is very useful for debugging!
## Getting Weather Information
To download weather information from
[OpenWeatherMap.org](http://openweathermap.org), we will perform three steps in
our JS file:
1. Request the user's location from the phone.
2. Perform a call to the OpenWeatherMap API using an `XMLHttpRequest` object,
supplying the location given to us from step 1.
3. Send the information we want from the XHR request response to the watch for
display on our watchface.
^CP^ Firstly, go to 'Settings' and check the 'Uses Location' box at the bottom
of the page. This will allow the watchapp to access the phone's location
services.
^LC^ You will need to add `location` to the `capabilities` array in the
`package.json` file. This will allow the watchapp to access the phone's location
services. This is shown in the code segment below:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"capabilities": ["location"]
{% endhighlight %}
</div>
The next step is simple to perform, and is shown in full below. The method we
are using requires two other functions to use as callbacks for the success and
failure conditions after requesting the user's location. It also requires two
other pieces of information: `timeout` of the request and the `maximumAge` of
the data:
```js
function locationSuccess(pos) {
// We will request the weather here
}
function locationError(err) {
console.log('Error requesting location!');
}
function getWeather() {
navigator.geolocation.getCurrentPosition(
locationSuccess,
locationError,
{timeout: 15000, maximumAge: 60000}
);
}
// Listen for when the watchface is opened
Pebble.addEventListener('ready',
function(e) {
console.log('PebbleKit JS ready!');
// Get the initial weather
getWeather();
}
);
```
Notice that when the `ready` event occurs, `getWeather()` is called, which in
turn calls `getCurrentPosition()`. When this is successful, `locationSuccess()`
is called and provides us with a single argument: `pos`, which contains the
location information we require to make the weather info request. Let's do that
now.
The next step is to assemble and send an `XMLHttpRequest` object to make the
request to OpenWeatherMap.org. To make this easier, we will provide a function
that simplifies its usage. Place this before `locationSuccess()`:
```js
var xhrRequest = function (url, type, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
callback(this.responseText);
};
xhr.open(type, url);
xhr.send();
};
```
The three arguments we have to provide when calling `xhrRequest()` are the URL,
the type of request (`GET` or `POST`, for example) and a callback for when the
response is received. The URL is specified on the OpenWeatherMap API page, and
contains the coordinates supplied by `getCurrentPosition()`, the latitude and
longitude encoded at the end:
{% include guides/owm-api-key-notice.html %}
```js
var url = 'http://api.openweathermap.org/data/2.5/weather?lat=' +
pos.coords.latitude + '&lon=' + pos.coords.longitude + '&appid=' + myAPIKey;
```
The type of the XHR will be a 'GET' request, to *get* information from the
service. We will incorporate the callback into the function call for
readability, and the full code snippet is shown below:
```js
function locationSuccess(pos) {
// Construct URL
var url = 'http://api.openweathermap.org/data/2.5/weather?lat=' +
pos.coords.latitude + '&lon=' + pos.coords.longitude + '&appid=' + myAPIKey;
// Send request to OpenWeatherMap
xhrRequest(url, 'GET',
function(responseText) {
// responseText contains a JSON object with weather info
var json = JSON.parse(responseText);
// Temperature in Kelvin requires adjustment
var temperature = Math.round(json.main.temp - 273.15);
console.log('Temperature is ' + temperature);
// Conditions
var conditions = json.weather[0].main;
console.log('Conditions are ' + conditions);
}
);
}
```
Thus when the location is successfully obtained, `xhrRequest()` is called. When
the response arrives, the JSON object is parsed and the temperature and weather
conditions obtained. To discover the structure of the JSON object we can use
`console.log(responseText)` to see its contents.
To see how we arrived at some of the statements above, such as
`json.weather[0].main`, here is an
[example response](https://gist.github.com/pebble-gists/216e6d5a0f0bd2328509#file-example-response-json)
for London, UK. We can see that by following the JSON structure from our
variable called `json` (which represents the root of the structure) we can
access any of the data items. So to get the wind speed we would access
`json.wind.speed`, and so on.
## Showing Weather on Pebble
The final JS step is to send the weather data back to the watch. To do this we must
pick some appmessage keys to send back. Since we want to display the temperature
and current conditions, we'll create one key for each of those.
^CP^ Firstly, go to the 'Settings' screen, find the 'PebbleKit JS Message Keys'
section and enter some names, like "TEMPERATURE" and "CONDITIONS":
^LC^ You can add your ``AppMessage`` keys in the `messageKeys` object in
`package.json` as shown below for the example keys:
<div class="platform-specific" data-sdk-platform="local">
{% highlight {} %}
"messageKeys": [
"TEMPERATURE",
"CONDITIONS",
]
{% endhighlight %}
</div>
To send the data, we call `Pebble.sendAppMessage()` after assembling the weather
info variables `temperature` and `conditions` into a dictionary. We can
optionally also supply two functions as success and failure callbacks:
```js
// Assemble dictionary using our keys
var dictionary = {
'TEMPERATURE': temperature,
'CONDITIONS': conditions
};
// Send to Pebble
Pebble.sendAppMessage(dictionary,
function(e) {
console.log('Weather info sent to Pebble successfully!');
},
function(e) {
console.log('Error sending weather info to Pebble!');
}
);
```
While we are here, let's add another call to `getWeather()` in the `appmessage`
event listener for when we want updates later, and will send an ``AppMessage``
from the watch to achieve this:
```js
// Listen for when an AppMessage is received
Pebble.addEventListener('appmessage',
function(e) {
console.log('AppMessage received!');
getWeather();
}
);
```
The final step on the Pebble side is to act on the information received from
PebbleKit JS and show the weather data in the ``TextLayer`` we created for this
very purpose. To do this, go back to your C code file and find your
``AppMessageInboxReceived`` implementation (such as our
`inbox_received_callback()` earlier). This will now be modified to process the
received data. When the watch receives an ``AppMessage`` message from the JS
part of the watchface, this callback will be called and we will be provided a
dictionary of data in the form of a `DictionaryIterator` object, as seen in the
callback signature. `MESSAGE_KEY_TEMPERATURE` and `MESSAGE_KEY_CONDITIONS`
will be automatically provided as we specified them in `package.json`.
Before examining the dictionary we add three character
buffers; one each for the temperature and conditions and the other for us to
assemble the entire string. Remember to be generous with the buffer sizes to
prevent overruns:
```c
// Store incoming information
static char temperature_buffer[8];
static char conditions_buffer[32];
static char weather_layer_buffer[32];
```
We then store the incoming information by reading the appropriate `Tuple`s to
the two buffers using `snprintf()`:
```c
// Read tuples for data
Tuple *temp_tuple = dict_find(iterator, MESSAGE_KEY_TEMPERATURE);
Tuple *conditions_tuple = dict_find(iterator, MESSAGE_KEY_CONDITIONS);
// If all data is available, use it
if(temp_tuple && conditions_tuple) {
snprintf(temperature_buffer, sizeof(temperature_buffer), "%dC", (int)temp_tuple->value->int32);
snprintf(conditions_buffer, sizeof(conditions_buffer), "%s", conditions_tuple->value->cstring);
}
```
Lastly within this `if` statement, we assemble the complete string and instruct
the ``TextLayer`` to display it:
```c
// Assemble full string and display
snprintf(weather_layer_buffer, sizeof(weather_layer_buffer), "%s, %s", temperature_buffer, conditions_buffer);
text_layer_set_text(s_weather_layer, weather_layer_buffer);
```
After re-compiling and re-installing you should be presented with a watchface
that looks similar to the one shown below:
{% screenshot_viewer %}
{
"image": "/images/getting-started/watchface-tutorial/3-final.png",
"platforms": [
{"hw": "aplite", "wrapper": "steel-black"},
{"hw": "basalt", "wrapper": "time-red"},
{"hw": "chalk", "wrapper": "time-round-rosegold-14"}
]
}
{% endscreenshot_viewer %}
^CP^ Remember, if the text is too large for the screen, you can reduce the font
size in the 'Resources' section of the CloudPebble editor. Don't forget to
change the constants in the `.c` file to match the new 'Identifier'.
^LC^ Remember, if the text is too large for the screen, you can reduce the font
size in `package.json` for that resource's entry in the `media` array. Don't
forget to change the constants in the `.c` file to match the new resource's
`name`.
An extra step we will perform is to modify the C code to obtain regular weather
updates, in addition to whenever the watchface is loaded. To do this we will
take advantage of a timer source we already have - the ``TickHandler``
implementation, which we have called `tick_handler()`. Let's modify this to get
weather updates every 30 minutes by adding the following code to the end of
`tick_handler()` in our main `.c` file:
```c
// Get weather update every 30 minutes
if(tick_time->tm_min % 30 == 0) {
// Begin dictionary
DictionaryIterator *iter;
app_message_outbox_begin(&iter);
// Add a key-value pair
dict_write_uint8(iter, 0, 0);
// Send the message!
app_message_outbox_send();
}
```
Thanks to us adding a call to `getWeather()` in the `appmessage` JS event
handler earlier, this message send in the ``TickHandler`` will result in new
weather data being downloaded and sent to the watch. Job done!
## Conclusion
Whew! That was quite a long tutorial, but here's all you've learned:
1. Managing multiple font sizes.
2. Preparing and opening ``AppMessage``.
3. Setting up PebbleKit JS for interaction with the web.
4. Getting the user's current location with `navigator.getCurrentPosition()`.
5. Extracting information from a JSON response.
6. Sending ``AppMessage`` to and from the watch.
Using all this it is possible to `GET` and `POST` to a huge number of web
services to display data and control these services.
As usual, you can compare your code to the example code provided using the button
below.
^CP^ [Edit in CloudPebble >{center,bg-lightblue,fg-white}]({{ site.links.cloudpebble }}ide/gist/216e6d5a0f0bd2328509)
^LC^ [View Source Code >{center,bg-lightblue,fg-white}](https://gist.github.com/216e6d5a0f0bd2328509)
## What's Next?
The next section of the tutorial will introduce the Battery Service, and
demonstrate how to add a battery bar to your watchface.
[Go to Part 4 → >{wide,bg-dark-red,fg-white}](/tutorials/watchface-tutorial/part4/) | {
"source": "google/pebble",
"title": "devsite/source/tutorials/watchface-tutorial/part3.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/watchface-tutorial/part3.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 22454
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: watchface
tutorial_part: 4
title: Adding a Battery Bar
description: |
How to add a battery level meter to your watchface.
permalink: /tutorials/watchface-tutorial/part4/
generate_toc: true
---
Another popular feature added to a lot of watchfaces is a battery meter,
enabling users to see the state of their Pebble's battery charge level at a
glance. This is typically implemented as the classic 'battery icon' that fills
up according to the current charge level, but some watchfaces favor the more
minimal approach, which will be implemented here.
This section continues from
[*Part 3*](/tutorials/watchface-tutorial/part3/), so be sure to re-use
your code or start with that finished project.
The state of the battery is obtained using the ``BatteryStateService``. This
service offers two modes of usage - 'peeking' at the current level, or
subscribing to events that take place when the battery state changes. The latter
approach will be adopted here. The battery level percentage will be stored in an
integer at the top of the file:
```c
static int s_battery_level;
```
As with all the Event Services, to receive an event when new battery information
is available, a callback must be registered. Create this callback using the
signature of ``BatteryStateHandler``, and use the provided
``BatteryChargeState`` parameter to store the current charge percentage:
```c
static void battery_callback(BatteryChargeState state) {
// Record the new battery level
s_battery_level = state.charge_percent;
}
```
To enable this function to be called when the battery level changes, subscribe
to updates in `init()`:
```c
// Register for battery level updates
battery_state_service_subscribe(battery_callback);
```
With the subscription in place, the UI can be created. This will take the form
of a ``Layer`` with a ``LayerUpdateProc`` that uses the battery level to draw a
thin, minimalist white meter along the top of the time display.
Create the ``LayerUpdateProc`` that will be used to draw the battery meter:
```c
static void battery_update_proc(Layer *layer, GContext *ctx) {
}
```
Declare this new ``Layer`` at the top of the file:
```c
static Layer *s_battery_layer;
```
Allocate the ``Layer`` in `main_window_load()`, assign it the ``LayerUpdateProc`` that will draw it, and
add it as a child of the main ``Window`` to make it visible:
```c
// Create battery meter Layer
s_battery_layer = layer_create(GRect(14, 54, 115, 2));
layer_set_update_proc(s_battery_layer, battery_update_proc);
// Add to Window
layer_add_child(window_get_root_layer(window), s_battery_layer);
```
To ensure the battery meter is updated every time the charge level changes, mark
it 'dirty' (to ask the system to re-render it at the next opportunity) within
`battery_callback()`:
```c
// Update meter
layer_mark_dirty(s_battery_layer);
```
The final piece of the puzzle is the actual drawing of the battery meter, which
takes place within the ``LayerUpdateProc``. The background of the meter is drawn
to 'paint over' the background image, before the width of the meter's 'bar' is
calculated using the current value as a percentage of the bar's total width
(114px).
The finished version of the update procedure is shown below:
```c
static void battery_update_proc(Layer *layer, GContext *ctx) {
GRect bounds = layer_get_bounds(layer);
// Find the width of the bar (total width = 114px)
int width = (s_battery_level * 114) / 100;
// Draw the background
graphics_context_set_fill_color(ctx, GColorBlack);
graphics_fill_rect(ctx, bounds, 0, GCornerNone);
// Draw the bar
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_fill_rect(ctx, GRect(0, 0, width, bounds.size.h), 0, GCornerNone);
}
```
Lastly, as with the ``TickTimerService``, the ``BatteryStateHandler`` can be
called manually in `init()` to display an inital value:
```c
// Ensure battery level is displayed from the start
battery_callback(battery_state_service_peek());
```
Don't forget to free the memory used by the new battery meter:
```c
layer_destroy(s_battery_layer);
```
With this new feature in place, the watchface will now display the watch's
battery charge level in a minimalist fashion that integrates well with the
existing design style.

## What's Next?
In the next, and final, section of this tutorial, we'll use the Connection Service
to notify the user when their Pebble smartwatch disconnects from their phone.
[Go to Part 5 → >{wide,bg-dark-red,fg-white}](/tutorials/watchface-tutorial/part5/) | {
"source": "google/pebble",
"title": "devsite/source/tutorials/watchface-tutorial/part4.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/watchface-tutorial/part4.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 5250
} |
---
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
layout: tutorials/tutorial
tutorial: watchface
tutorial_part: 5
title: Vibrate on Disconnect
description: |
How to add bluetooth connection alerts to your watchface.
permalink: /tutorials/watchface-tutorial/part5/
generate_toc: true
platform_choice: true
---
The final popular watchface addition explored in this tutorial series
is the concept of using the Bluetooth connection service to alert the user
when their watch connects or disconnects. This can be useful to know when the
watch is out of range and notifications will not be received, or to let the user
know that they might have walked off somewhere without their phone.
This section continues from
[*Part 4*](/tutorials/watchface-tutorial/part4), so be sure to
re-use your code or start with that finished project.
In a similar manner to both the ``TickTimerService`` and
``BatteryStateService``, the events associated with the Bluetooth connection are
given to developers via subscriptions, which requires an additional callback -
the ``ConnectionHandler``. Create one of these in the format given below:
```c
static void bluetooth_callback(bool connected) {
}
```
The subscription to Bluetooth-related events is added in `init()`:
```c
// Register for Bluetooth connection updates
connection_service_subscribe((ConnectionHandlers) {
.pebble_app_connection_handler = bluetooth_callback
});
```
The indicator itself will take the form of the following 'Bluetooth
disconnected' icon that will be displayed when the watch is disconnected, and
hidden when reconnected. Save the image below for use in this project:
<img style="background-color: #CCCCCC;" src="/assets/images/tutorials/intermediate/bt-icon.png"</img>
{% platform cloudpebble %}
Add this icon to your project by clicking 'Add New' under 'Resources' in
the left hand side of the editor. Specify the 'Resource Type' as 'Bitmap Image',
upload the file for the 'File' field. Give it an 'Identifier' such as
`IMAGE_BT_ICON` before clicking 'Save'.
{% endplatform %}
{% platform local %}
Add this icon to your project by copying the above icon image to the `resources`
project directory, and adding a new JSON object to the `media` array in
`package.json` such as the following:
```js
{
"type": "bitmap",
"name": "IMAGE_BT_ICON",
"file": "bt-icon.png"
},
```
{% endplatform %}
This icon will be loaded into the app as a ``GBitmap`` for display in a
``BitmapLayer`` above the time display. Declare both of these as pointers at the
top of the file, in addition to the existing variables of these types:
```c
static BitmapLayer *s_background_layer, *s_bt_icon_layer;
static GBitmap *s_background_bitmap, *s_bt_icon_bitmap;
```
Allocate both of the new objects in `main_window_load()`, then set the
``BitmapLayer``'s bitmap as the new icon ``GBitmap``:
```c
// Create the Bluetooth icon GBitmap
s_bt_icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BT_ICON);
// Create the BitmapLayer to display the GBitmap
s_bt_icon_layer = bitmap_layer_create(GRect(59, 12, 30, 30));
bitmap_layer_set_bitmap(s_bt_icon_layer, s_bt_icon_bitmap);
layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(s_bt_icon_layer));
```
As usual, ensure that the memory allocated to create these objects is also freed
in `main_window_unload()`:
```c
gbitmap_destroy(s_bt_icon_bitmap);
bitmap_layer_destroy(s_bt_icon_layer);
```
With the UI in place, the implementation of the ``BluetoothConnectionHandler``
can be finished. Depending on the state of the connection when an event takes
place, the indicator icon is hidden or unhidden as required. A distinct
vibration is also triggered if the watch becomes disconnected, to differentiate
the feedback from that of a notification or phone call:
```c
static void bluetooth_callback(bool connected) {
// Show icon if disconnected
layer_set_hidden(bitmap_layer_get_layer(s_bt_icon_layer), connected);
if(!connected) {
// Issue a vibrating alert
vibes_double_pulse();
}
}
```
Upon initialization, the app will display the icon unless a re-connection event
occurs, and the current state is evaluated. Manually call the handler in
`main_window_load()` to display the correct initial state:
```c
// Show the correct state of the BT connection from the start
bluetooth_callback(connection_service_peek_pebble_app_connection());
```
With this last feature in place, running the app and disconnecting the Bluetooth
connection will cause the new indicator to appear, and the watch to vibrate
twice.

^CP^ You can create a new CloudPebble project from the completed project by
[clicking here]({{ site.links.cloudpebble }}ide/gist/ddd15cbe8b0986fda407).
^LC^ You can see the finished project source code in
[this GitHub Gist](https://gist.github.com/pebble-gists/ddd15cbe8b0986fda407).
## What's Next?
Now that you've successfully built a feature rich watchface, it's time to
[publish it](/guides/appstore-publishing/publishing-an-app/)! | {
"source": "google/pebble",
"title": "devsite/source/tutorials/watchface-tutorial/part5.md",
"url": "https://github.com/google/pebble/blob/main/devsite/source/tutorials/watchface-tutorial/part5.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 5617
} |
Flash Memory Drivers
--------------------
Flash memory access is exposed through two separate APIs. The main API, defined
in `flash.h` and implemented in `flash_api.c`, is used almost everywhere. There
is also an alternate API used exclusively for performing core dumps, implemented
in `cd_flash_driver.c`. The alternate API is carefully implemented to be usable
regardless of how messed up the system state is in by not relying on any OS
services.
The flash APIs are written to be agnostic to the specific type of flash used.
They are written against the generic low-level driver interface defined in
`flash_impl.h`. Each low-level driver is specific to a combination of
flash memory part and microcontroller interface. The low-level drivers make no
use of OS services so that they can be used for both the main and core dump
driver APIs. | {
"source": "google/pebble",
"title": "src/fw/drivers/flash/README.md",
"url": "https://github.com/google/pebble/blob/main/src/fw/drivers/flash/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 841
} |
The files in this directory are used to test the override functionality of the
test infrastructure, and are `#include`'ed by
[`test_test_infra.c`](../../../test_test_infra.c). | {
"source": "google/pebble",
"title": "tests/overrides/default/_test/README.md",
"url": "https://github.com/google/pebble/blob/main/tests/overrides/default/_test/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 175
} |
### About Curie BSP port
[Intelยฎ Curie BSP](https://github.com/CurieBSP/main/blob/master/README.rst) is the SDK that will help you developing software on Curie based boards, for example with the [Arduino 101 board (AKA Genuino 101)](https://www.arduino.cc/en/Main/ArduinoBoard101).
This folder contains necessary files to integrate JerryScript with Intelยฎ Curie BSP, so that JavaScript can run on Arduino 101 board (AKA Genuino 101).
### How to build
#### 1. Preface
Curie BSP only support Ubuntu GNU/Linux as host OS envirenment.
Necessary hardwares
* [FlySwatter2 JTAG debugger](https://www.tincantools.com/wiki/Flyswatter2)
* [ARM-JTAG-20-10](https://www.amazon.com/PACK-ARM-JTAG-20-10-Micro-JTAG-adapter/dp/B010ATK9OC/ref=sr_1_1?ie=UTF8&qid=1469635131&sr=8-1&keywords=ARM+Micro+JTAG+Connector)
* [USB to TTL Serial Cable](https://www.adafruit.com/products/954)
#### 2. Prepare Curie BSP
You can refer to a detailed document [Curie BSP](https://github.com/CurieBSP/main/releases). But, we summary the main steps below:
##### 1. Get repo:
```
mkdir ~/bin
wget http://commondatastorage.googleapis.com/git-repo-downloads/repo -O ~/bin/repo
chmod a+x ~/bin/repo
```
##### 2. In ``~/.bashrc`` add:
```
PATH=$PATH:~/bin
```
##### 3. Create your directory for CurieBSP (eg. Curie_BSP):
```
mkdir Curie_BSP && cd $_
```
##### 4. Initialize your repo:
```
repo init -u https://github.com/CurieBSP/manifest
```
##### 5. Download the sources files:
```
repo sync -j 5 -d
```
##### 6. Get toolchain (compilation/debug):
Download [issm-toolchain-linux-2016-05-12.tar.gz](https://software.intel.com/en-us/articles/issm-toolchain-only-download), and uncompress it.
**TOOLCHAIN_DIR** environment variable needs to match the toolchain destination folder
You can use the command:``export TOOLCHAIN_DIR='path to files of the toolchain'``
Or you can just uncompress the toolchain tarball and copy the contents (`licensing readme.txt tools version.txt`) into `wearable_device_sw/external/toolchain`.
##### 7. Get BLE firmware:
Download [curie-ble-v3.1.1.tar.gz]( https://registrationcenter.intel.com/en/forms/?productid=2783) and uncompress the retrieved package into ``wearable_device_sw/packages`` folder
You will first register in the web page. Then you will receive an email where is a download link. Click the link in the mail, choose the `curie-ble-v3.1.1.tar.gz (118 KB)` and download.
##### 8. Get tools to flash the device:
[https://01.org/android-ia/downloads/intel-platform-flash-tool-lite](https://01.org/android-ia/downloads/intel-platform-flash-tool-lite)
#### 3. Build JerryScript and Curie BSP
##### 1. Generate makefiles
Run the Python script ``setup.py`` in ``jerryscript/targets/curie_bsp/`` with the full path or relative path of the ``Curie_BSP``:
```
python setup.py <path of Curie_BSP>
```
##### 2. One time setup. It will check/download/install the necessary tools, and must be run only once.
In the directory ``Curie_BSP``
```
make -C wearable_device_sw/projects/curie_bsp_jerry/ one_time_setup
```
##### 3. In the directory ``Curie_BSP``
```
mkdir out && cd $_
make -f ../wearable_device_sw/projects/curie_bsp_jerry/Makefile setup
make image
```
##### 4. Connect JTAG Debugger and TTL Serial Cable to Arduino 101 as below:

##### 5. Flash the firmware
```
make flash FLASH_CONFIG=jtag_full
```
#### 4. Serial terminal
Assume the serial port is ``ttyUSB0`` in ``/dev`` directory, we can type command ``screen ttyUSB0 115200`` to open a serial terminal.
After the board boot successfully, you should see something like this:
```
Quark SE ID 16 Rev 0 A0
ARC Core state: 0000400
BOOT TARGET: 0
6135|QRK| CFW| INFO| GPIO service init in progress..
6307|ARC|MAIN| INFO| BSP init done
6315|ARC| CFW| INFO| ADC service init in progress..
6315|ARC| CFW| INFO| GPIO service init in progress...
6315|ARC| CFW| INFO| GPIO service init in progress...
6315|ARC|MAIN| INFO| CFW init done
```
To test the JavaScript command, you should add characters ``js e `` to the beginning of the JavaScript command, like this:
``js e print ('Hello World!');``
It is the uart command format of Curie BSP. `js` is cmd group, `e` is cmd name, which is short for eval, and `print ('Hello World!');` is the cmd parameters, which is the JavaScript code we want to run.
You can see the result through the screen:
```
js e print ('Hello World!');js e 1 ACK
Hello World!
undefined
js e 1 OK
```
`js e 1 ACK` and `js e 1 OK` are debug info of Curie BSP uart commands, which mean it receive and execute the command sucessfully. `Hello World!` is the printed content. `undefined` is the return value of the statement `print ('Hello World!')`. | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/curie_bsp/README.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/curie_bsp/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 4677
} |
### About
Files in this folder (embedding/esp8266) are copied from
`examples/project_template` of `esp_iot_rtos_sdk` and modified for JerryScript.
You can view online from
[this](https://github.com/espressif/esp_iot_rtos_sdk/tree/master/examples/project_template) page.
### How to build JerryScript for ESP8266
#### 1. SDK
Follow [this](./docs/ESP-PREREQUISITES.md) page to setup build environment
#### 2. Patch ESP-SDK for JerryScript
Follow [this](./docs/ESP-PATCHFORJERRYSCRIPT.md) page to patch for JerryScript building.
Below is a summary after SDK patch is applied.
#### 3. Building JerryScript
```
cd ~/harmony/jerryscript
# clean build
make -f ./targets/esp8266/Makefile.esp8266 clean
# or just normal build
make -f ./targets/esp8266/Makefile.esp8266
```
Output files should be placed at $BIN_PATH
#### 4. Flashing for ESP8266 ESP-01 board (WiFi Module)
Steps are for `ESP8266 ESP-01(WiFi)` board. Others may vary.
Refer http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family page.
##### 4.1 GPIO0 and GPIO2
Before flashing you need to follow the steps.
1. Power off ESP8266
2. Connect GPIO0 to GND and GPIO2 to VCC
3. Power on ESP8266
4. Flash
##### 4.2 Flashing
```
make -f ./targets/esp8266/Makefile.esp8266 flash
```
Default USB device is `/dev/ttyUSB0`. If you have different one, give with `USBDEVICE`, like;
```
USBDEVICE=/dev/ttyUSB1 make -f ./targets/esp8266/Makefile.esp8266 flash
```
### 5. Running
1. Power off
2. Disonnect(float) both GPIO0 and GPIO2
3. Power on
Sample program here works with LED and a SW with below connection.
* Connect GPIO2 to a LED > 4K resistor > GND
* Connect GPIO0 between VCC > 4K resistor and GND
If GPIO0 is High then LED is turned on longer. If L vice versa.
### 6. Optimizing initial RAM usage (ESP8266 specific)
The existing open source gcc compiler with Xtensa support stores const(ants) in
the same limited RAM where our code needs to run.
It is possible to force the compiler to 1)store a constant into ROM and also 2) read it from there thus saving 1.1) RAM.
It will require two things though:
1. To add the attribute JERRY_CONST_DATA to your constant. For example
```C
static const lit_magic_size_t lit_magic_string_sizes[] =
```
can be modified to
```C
static const lit_magic_size_t lit_magic_string_sizes[] JERRY_CONST_DATA =
```
That is already done to some constants in jerry-core.
1.1) Below is a short list:
Bytes | Name
-------- | ---------
928 | magic_strings$2428
610 | vm_decode_table
424 | unicode_letter_interv_sps
235 | cbc_flags
232 | lit_magic_string_sizes
212 | unicode_letter_interv_len
196 | unicode_non_letter_ident_
112 | unicode_letter_chars
Which frees 2949 bytes in RAM.
2. To compile your code with compiler that supports the `-mforce-l32` parameter. You can check if your compiler is
supporting that parameter by calling:
```bash
xtensa-lx106-elf-gcc --help=target | grep mforce-l32
```
If the command above does not provide a result then you will need to upgrade your compiler. | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/esp8266/readme.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/esp8266/readme.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 3009
} |
This folder contains files to run JerryScript in mbed / for:
* Freedom-K64F (k64)
* Discovery-STM32F4 (stm32f4)
* Discovery-STM32F429ZI (stm32f429i)
* Nucleo-F401RE (nucleo)
####Yotta
You need to install yotta before proceeding. Please visit [Yotta docs page](http://yottadocs.mbed.com/#installing-on-linux).
####Cross-compiler
For cross-compilation the GCC 5.2.1 is suggested to be used. All the supported targets were tested with this version. If you don't have any GCC compiler installed, please visit [this](https://launchpad.net/gcc-arm-embedded/+download) page to download GCC 5.2.1.
####How to build a target
Navigate to your JerryScript root folder (after you cloned this repository into the targets folder) and use the following command:
```
make -f targets/mbed/Makefile.mbed board=$(TARGET)
```
Where the `$(TARGET)` is one of the following options: `k64f`, `stm32f4`, `stm32f429i` or `nucleo`.
This command will create a new folder for your target and build the jerryscript and mbed OS into that folder.
####How to build a completely new target
If you want to build a new target (which is not available in this folder) you have to modify the makefile.
You have to add the new board name to the `TARGET_LIST` and you have to add a new branch with the new `YOTTA_TARGET` and a new `TARGET_DIR` path (if it neccessary) to the if at the top in the Makefile (just as you see right now).
There is a little code snippet:
```
ifeq ($(TARGET), k64f)
YOTTA_TARGET = frdm-k64f-gcc
TARGET_DIR ?= /media/$(USER)/MBED
else ifeq ($(TARGET), stm32f4)
YOTTA_TARGET =
```
Basically, you can create a new target in this way (If the mbed OS support your board).
#####Let's get into the details!
1. The next rule is the `jerry` rule. This rule builds the JerryScript and copy the output files into the target libjerry folder. Two files will be generated at `targets/mbed/libjerry`:
* libjerrycore.a
* libfdlibm.a
You can run this rule with the following command:
- `make -f targets/mbed/Makefile.mbed board=$(TARGET) jerry`
2. The next rule is the `js2c`. This rule calls a `js2c.py` python script from the `jerryscript/targets/tools` and creates the JavaScript builtin file into the `targets/mbed/source/` folder. This file is the `jerry_targetjs.h`. You can run this rule with the follwoing command:
- `make -f targets/mbed/Makefile.mbed board=$(TARGET) js2c`
3. The last rule is the `yotta`. This rule sets the yotta target and install the mbed-drivers module, install the dependencies for the mbed OS and finaly creates the mbed binary file. The binary file will be genrated at `targets/mbed/build/$(YOTTA_TARGET)/source/jerry.bin`. You can run this rule with the following command:
- `make -f targets/mbed/Makefile.mbed board=$(TARGET) yotta`
4. Optional rule: `clean`. It removes the build folder from the mbed and jerry. You can run this rule with this command:
- `make -f targets/mbed/Makefile.mbed board=$(TARGET) clean`
#####Flashing
When the build is finished you can flash the binary into your board if you want. In case of ST boards you have to install the `st-link` software. Please visit [this page](https://github.com/texane/stlink) to install STLink-v2.
You can flash your binary into your board with the following command:
```
make -f targets/mbed/Makefile.mbed board=$(TARGET) flash
```
The flash rule grabs the binary and copies it to the mounted board or use the STLink-v2 to flash.
When the status LED of the board stops blinking, press RESET button on the board to execute JerryScript led flashing sample program in js folder.
###Note
If you use an STM32F4 board your build will stop with missing header errors. To fix this error please visit to [this page](http://browser.sed.hu/blog/20160407/how-run-javascripts-jerryscript-mbed) and read about the fix in the `New target for STM32F4` block. | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/mbed/readme.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/mbed/readme.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 3853
} |
# JerryScript with mbed OS 5
TL;DR? jump straight to [quickstart](#quick-start)
## Introduction
This directory contains the necessary code to build JerryScript for devices
capable of running mbed OS 5. It has been tested with the following boards
so far:
- [Nordic Semiconductor NRF52 Development Kit](https://developer.mbed.org/platforms/Nordic-nRF52-DK/)
- [NXP Freedom K64F](https://developer.mbed.org/platforms/FRDM-K64F/)
- [STM NUCLEO F401RE](https://developer.mbed.org/platforms/ST-Nucleo-F401RE/)
- [Silicon Labs EFM32 Giant Gecko](https://developer.mbed.org/platforms/EFM32-Giant-Gecko/)
## Features
### Peripheral Drivers
Peripheral Drivers are intended as a 1-to-1 mapping to mbed C++ APIs, with a few
differences (due to differences between JavaScript and C++ like lack of operator
overloading).
- [DigitalOut](https://docs.mbed.com/docs/mbed-os-api-reference/en/5.1/APIs/io/DigitalOut/)
- [InterruptIn](https://docs.mbed.com/docs/mbed-os-api-reference/en/5.1/APIs/io/InterruptIn/)
- [I2C](https://docs.mbed.com/docs/mbed-os-api-reference/en/5.1/APIs/interfaces/digital/I2C/)
- setInterval and setTimeout using [mbed-event](https://github.com/ARMmbed/mbed-events)
## Dependencies
### mbed CLI
mbed CLI is used as the build tool for mbed OS 5. You can find out how to install
it in the [official documentation](https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/dev_tools/cli/#installing-mbed-cli).
### arm-none-eabi-gcc
arm-none-eabi-gcc is the only currently tested compiler for jerryscript on mbed,
and instructions for building can be found as part of the mbed-cli installation
instructions above.
### make
make is used to automate the process of fetching dependencies, and making sure that
mbed-cli is called with the correct arguments.
### (optional) jshint
jshint is used to statically check your JavaScript code, as part of the build process.
This ensures that pins you are using in your code are available on your chosen target
platform.
## Quick Start
Once you have all of your dependencies installed, you can build the project as follows:
```bash
git clone https://github.com/Samsung/jerryscript
cd jerryscript/targets/mbedos5
make getlibs
# NRF52 Development Kit:
make BOARD=NRF52_DK
# FRDM K64F
make BOARD=K64F
```
The produced file (in .build/**[BOARD]**/GCC_ARM) can then be uploaded to your board, and will
run when you press reset.
If you make a modification to main.js, you can simply rerun make, and it will remember your
previous choice of board:
```bash
make
``` | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/mbedos5/README.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/mbedos5/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2517
} |
### About
This folder contains files to run JerryScript on
[STM32F4-Discovery board](http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/stm32f4discovery.html) with [NuttX](http://nuttx.org/)
### How to build
#### 1. Setting up the build environment for STM32F4-Discovery board
Clone JerryScript and NuttX into jerry-nuttx directory
```
mkdir jerry-nuttx
cd jerry-nuttx
git clone https://github.com/Samsung/jerryscript.git
git clone https://bitbucket.org/nuttx/nuttx.git
git clone https://bitbucket.org/nuttx/apps.git
git clone https://github.com/texane/stlink.git
```
The following directory structure is created after these commands
```
jerry-nuttx
+ apps
+ jerryscript
| + targets
| + nuttx-stm32f4
+ nuttx
+ stlink
```
#### 2. Adding JerryScript as an interpreter for NuttX
```
cd apps/interpreters
mkdir jerryscript
cp ../../jerryscript/targets/nuttx-stm32f4/* ./jerryscript/
```
#### 3. Configure NuttX
```
# assuming you are in jerry-nuttx folder
cd nuttx/tools
# configure NuttX USB console shell
./configure.sh stm32f4discovery/usbnsh
cd ..
# might require to run "make menuconfig" twice
make menuconfig
```
We must set the following options:
* Change `Build Setup -> Build Host Platform` from _Windows_ to _Linux_
* Enable `System Type -> FPU support`
* Enable `Library Routines -> Standard Math library`
* Enable `Application Configuration -> Interpreters -> JerryScript`
#### 4. Build JerryScript for NuttX
```
# assuming you are in jerry-nuttx folder
cd nuttx/
make
```
#### 5. Flashing
Connect Mini-USB for power supply and connect Micro-USB for `NSH` console.
To configure `stlink` utility for flashing, follow the instructions [here](https://github.com/texane/stlink#build-from-sources).
To flash,
```
# assuming you are in nuttx folder
sudo ../stlink/build/st-flash write nuttx.bin 0x8000000
```
### Running JerryScript
You can use `minicom` for terminal program, or any other you may like, but set
baud rate to `115200`.
```
sudo minicom --device=/dev/ttyACM0 --baud=115200
```
You may have to press `RESET` on the board and press `Enter` keys on the console
several times to make `nsh` prompt to appear.
If the prompt shows like this,
```
NuttShell (NSH)
nsh>
nsh>
nsh>
```
please set `Add Carriage Ret` option by `CTRL-A` > `Z` > `U` at the console,
if you're using `minicom`.
Run `jerry` with javascript file(s)
```
NuttShell (NSH)
nsh> jerry full_path/any.js
```
Without argument it prints:
```
nsh> jerry
No input files, running a hello world demo:
Hello world 5 times from JerryScript
``` | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/nuttx-stm32f4/README.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/nuttx-stm32f4/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2716
} |
### About
This folder contains files to run JerryScript on RIOT-OS with STM32F4-Discovery board.
### How to build
#### 1. Preface
1, Directory structure
Assume `harmony` as the path to the projects to build.
The folder tree related would look like this.
```
harmony
+ jerryscript
| + targets
| + riot-stm32f4
+ RIOT
```
2, Target board
Assume [STM32F4-Discovery with BB](http://www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/LN1199/PF255417)
as the target board.
#### 2. Prepare RIOT-OS
Follow [this](https://www.riot-os.org/#download) page to get the RIOT-OS source.
Follow the [Inroduction](https://github.com/RIOT-OS/RIOT/wiki/Introduction) wiki site and also check that you can flash the stm32f4-board.
#### 3. Build JerryScript for RIOT-OS
```
# assume you are in harmony folder
cd jerryscript
make -f ./targets/riot-stm32f4/Makefile.riot
```
This will generate the following libraries:
```
/build/bin/release.riotstm32f4/librelease.jerry-core.a
/build/bin/release.riotstm32f4/librelease.jerry-libm.lib.a
```
This will copy one library files to `targets/riot-stm32f4/bin` folder:
```
libjerrycore.a
```
This will create a hex file in the `targets/riot-stm32f4/bin` folder:
```
riot_jerry.elf
```
#### 4. Flashing
```
make -f ./targets/riot-stm32f4/Makefile.riot flash
```
For how to flash the image with other alternative way can be found here:
[Alternative way to flash](https://github.com/RIOT-OS/RIOT/wiki/Board:-STM32F4discovery#alternative-way-to-flash)
#### 5. Cleaning
To clean the build result:
```
make -f ./targets/riot-stm32f4/Makefile.riot clean
```
### 5. Running JerryScript Hello World! example
You may have to press `RESET` on the board after the flash.
You can use `minicom` for terminal program, and if the prompt shows like this:
```
main(): This is RIOT! (Version: ****)
You are running RIOT on a(n) stm32f4discovery board.
This board features a(n) stm32f4 MCU.
```
please set `Add Carriage Ret` option by `CTRL-A` > `Z` > `U` at the console, if you're using `minicom`.
Help will provide a list of commands:
```
> help
```
The `test` command will run the test example, which contains the following script code:
```
print ('Hello, World!');
``` | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/riot-stm32f4/README.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/riot-stm32f4/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2341
} |
### About
This folder contains files to integrate JerryScript with Zephyr RTOS to
run on a number of supported boards (like
[Arduino 101 / Genuino 101](https://www.arduino.cc/en/Main/ArduinoBoard101),
[Zephyr Arduino 101](https://www.zephyrproject.org/doc/board/arduino_101.html)).
### How to build
#### 1. Preface
1. Directory structure
Assume `harmony` as the path to the projects to build.
The folder tree related would look like this.
```
harmony
+ jerryscript
| + targets
| + zephyr
+ zephyr-project
```
2. Target boards/emulations
Following Zephyr boards were tested: qemu_x86, qemu_cortex_m3, arduino_101,
frdm_k64f.
#### 2. Prepare Zephyr
Follow [this](https://www.zephyrproject.org/doc/getting_started/getting_started.html) page to get
the Zephyr source and configure the environment.
If you just start with Zephyr, you may want to follow "Building a Sample
Application" section in the doc above and check that you can flash your
target board.
Remember to source the Zephyr environment as explained in the zephyr documenation:
```
cd zephyr-project
source zephyr-env.sh
export ZEPHYR_GCC_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=<sdk installation directory>
```
#### 3. Build JerryScript for Zephyr
The easiest way is to build and run on a QEMU emulator:
For x86 architecture:
```
make -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_x86 qemu
```
For ARM (Cortex-M) architecture:
```
make -f ./targets/zephyr/Makefile.zephyr BOARD=qemu_cortex_m3 qemu
```
#### 4. Build for Arduino 101
```
# assume you are in harmony folder
cd jerryscript
make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory
```
This will generate the following libraries:
```
./build/arduino_101_factory/librelease-cp_minimal.jerry-core.a
./build/arduino_101_factory/librelease-cp_minimal.jerry-libm.lib.a
./build/arduino_101_factory/librelease.external-cp_minimal-entry.a
```
The final Zephyr image will be located here:
```
./build/arduino_101_factory/zephyr/zephyr.strip
```
#### 5. Flashing
Details on how to flash the image can be found here:
[Flashing image](https://www.zephyrproject.org/doc/board/arduino_101.html)
(or similar page for other supported boards).
To be able to use this demo in hardware you will need the serial console
which will be generating output to Pins 0 & 1.
You will need a 3.3v TTL to RS232, please follow the zephyr documentation on it.
Some examples of building the software
```
make -f ./targets/zephyr/Makefile.zephyr BOARD=<board> clean
```
- Not using a Jtag and having a factory stock Arduino 101.
You can follow the Zephyr instructions to flash using the dfu-util command
or use this helper:
```
make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory dfu-x86
```
Make sure you have the factory bootloader in your device to use this method or it will not flash.
- Using JTAG
There is a helper function to flash using the JTAG and Flywatter2

```
make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory flash
```
<warning> Careful if you flash the BOARD arduino_101, you will lose the bootloader
and you will have to follow the zephyr documentation to get it back from
the backup we all know you did at the setup. </warning>
#### 6. Serial terminal
Test command line in a serial terminal.
You should see something similar to this:
```
JerryScript build: Aug 12 2016 17:12:55
JerryScript API 1.0
Zephyr version 1.4.0
js>
```
Run the example javascript command test function
```
js> var test=0; for (t=100; t<1000; t++) test+=t; print ('Hi JS World! '+test);
Hi JS World! 494550
```
Try a more complex function:
```
js> function hello(t) {t=t*10;return t}; print("result"+hello(10.5));
``` | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/zephyr/README.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/zephyr/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 3755
} |
Docker files
------------
This folder contains docker files that are used in testing nanopb automatically
on various platforms.
By default they take the newest master branch code from github.
To build tests for a single target, use for example:
docker build ubuntu1804
To build tests for all targets, use:
./build_all.sh | {
"source": "google/pebble",
"title": "third_party/nanopb/tests/docker_images/README.md",
"url": "https://github.com/google/pebble/blob/main/third_party/nanopb/tests/docker_images/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 334
} |
Application-layer PULSEv2 Protocols
=================================== | {
"source": "google/pebble",
"title": "python_libs/pebble-commander/pebble/commander/apps/README.md",
"url": "https://github.com/google/pebble/blob/main/python_libs/pebble-commander/pebble/commander/apps/README.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 71
} |
#### Apply patch to ESP8266 SDK
As `iram` is quite small to fit all the codes but linker tries to put it there.
To force JerryScript codes to be placed at the `irom` section,
need to change the order and tell the linker as below;
```
diff --git a/ld/eagle.app.v6.common.ld b/ld/eagle.app.v6.common.ld
index caf8e32..dadaceb 100644
--- a/ld/eagle.app.v6.common.ld
+++ b/ld/eagle.app.v6.common.ld
@@ -151,6 +151,21 @@ SECTIONS
} >dram0_0_seg :dram0_0_bss_phdr
/* __stack = 0x3ffc8000; */
+ .irom0.text : ALIGN(4)
+ {
+ _irom0_text_start = ABSOLUTE(.);
+ *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
+ *(.literal.* .text.*)
+ _irom0_text_end = ABSOLUTE(.);
+
+ _jerry_text_start = ABSOLUTE(.);
+ *\libjerryentry.a:*(.text*)
+ *\libjerrycore.a:*(.text*)
+ *\libjerrylibm.a:*(.text*)
+ _jerry_text_end = ABSOLUTE(.);
+
+ } >irom0_0_seg :irom0_0_phdr
+
.text : ALIGN(4)
{
_stext = .;
@@ -199,13 +214,6 @@ SECTIONS
_lit4_end = ABSOLUTE(.);
} >iram1_0_seg :iram1_0_phdr
- .irom0.text : ALIGN(4)
- {
- _irom0_text_start = ABSOLUTE(.);
- *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
- *(.literal.* .text.*)
- _irom0_text_end = ABSOLUTE(.);
- } >irom0_0_seg :irom0_0_phdr
}
/* get ROM code address */
diff --git a/ld/eagle.app.v6.ld b/ld/eagle.app.v6.ld
index 3e7ec1b..4a9ab5b 100644
--- a/ld/eagle.app.v6.ld
+++ b/ld/eagle.app.v6.ld
@@ -26,7 +26,7 @@ MEMORY
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
- irom0_0_seg : org = 0x40240000, len = 0x3C000
+ irom0_0_seg : org = 0x40240000, len = 0xB0000
}
INCLUDE "../ld/eagle.app.v6.common.ld"
```
Second file is to modify `irom` size so that it can hold all the codes and data.
This can be done by giving another `SPI_SIZE_MAP`.
For now, I'll use this manual modification.
#### Need to get setjmp / longjmp
Extract and copy from the SDK.
```
cd ~/harmony/jerryscript/targets/esp8266/libs
ar -xv $SDK_PATH/lib/libcirom.a lib_a-setjmp.o
``` | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/esp8266/docs/ESP-PATCHFORJERRYSCRIPT.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/esp8266/docs/ESP-PATCHFORJERRYSCRIPT.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 2235
} |
#### Preparation
##### Accessories
You need,
* 3.3V power supply. You can use bread board power (+5V, +3.3V). I used LM317 like this;
* Use [LM317](http://www.ti.com/lit/ds/symlink/lm317.pdf)
* R1 = 330 Ohm, R2 = 545 Ohm (1K + 1.2K in parallel)
* 5V 2A adaptor
* USB to RS-232 Serial + RS-232 Serial to Digital or USB-to-RS232 TTL converter
#### Toolchain
Reference [Toolchain](https://github.com/esp8266/esp8266-wiki/wiki/Toolchain) page.
I've slightly changed the step to use SDK from Espressif official SDK
(https://github.com/espressif/esp_iot_rtos_sdk)
##### Toolchain:
dependencies for x86
```
sudo apt-get install git autoconf build-essential gperf \
bison flex texinfo libtool libncurses5-dev wget \
gawk libc6-dev-i386 python-serial libexpat-dev
sudo mkdir /opt/Espressif
sudo chown $USER /opt/Espressif/
```
dependencies for x64
```
sudo apt-get install git autoconf build-essential gperf \
bison flex texinfo libtool libncurses5-dev wget \
gawk libc6-dev-amd64 python-serial libexpat-dev
sudo mkdir /opt/Espressif
sudo chown $USER /opt/Espressif/
```
crosstool-NG
```
cd /opt/Espressif
git clone -b lx106-g++-1.21.0 git://github.com/jcmvbkbc/crosstool-NG.git
cd crosstool-NG
./bootstrap && ./configure --prefix=`pwd` && make && make install
./ct-ng xtensa-lx106-elf
./ct-ng build
```
add path to environment file such as `.profile`
```
PATH=$PWD/builds/xtensa-lx106-elf/bin:$PATH
```
##### Espressif SDK: use Espressif official
```
cd /opt/Esprissif
git clone https://github.com/espressif/ESP8266_RTOS_SDK.git ESP8266_RTOS_SDK.git
ln -s ESP8266_RTOS_SDK.git ESP8266_SDK
cd ESP8266_SDK
git checkout -b jerry a2b413ad2996450fe2f173b6afab243f6e1249aa
```
We use SDK 1.2.0 version which has stdlib.h and others. Latest 1.3.0 version,
as of writing this document, doesn't have it.
(If anyone knows how to use latest version, please add an issue or send a PR.)
set two environment variables such as in .profile
```
export SDK_PATH=/opt/Espressif/ESP8266_SDK
export BIN_PATH=(to output folder path)
```
##### Xtensa libraries and headers:
```
cd /opt/Espressif/ESP8266_SDK
wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a
```
##### ESP image tool
```
cd /opt/Espressif
wget -O esptool_0.0.2-1_i386.deb https://github.com/esp8266/esp8266-wiki/raw/master/deb/esptool_0.0.2-1_i386.deb
sudo dpkg -i esptool_0.0.2-1_i386.deb
```
##### ESP upload tool
```
cd /opt/Espressif
git clone https://github.com/themadinventor/esptool esptool-py
sudo ln -s $PWD/esptool-py/esptool.py crosstool-NG/builds/xtensa-lx106-elf/bin/esptool.py
```
#### Test writing with Blinky example
##### Get the source
found one example that works with SDK V1.2 (which is based on FreeRTOS, as of writing)
* https://github.com/mattcallow/esp8266-sdk/tree/master/rtos_apps/01blinky
##### Compile
Read `2A-ESP8266__IOT_SDK_User_Manual_EN` document in
[this](http://bbs.espressif.com/viewtopic.php?f=51&t=1024) link.
It's configured 2048KB flash
```
BOOT=new APP=1 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=5 make
BOOT=new APP=2 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=5 make
```
or old way... this works not sure this is ok.
```
make BOOT=new APP=0 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=2
```
##### Flashing
* power off ESP8266 board
* connect GPIO0 to GND, connect GPIO2 to VCC
* power on
* write
```
sudo /opt/Espressif/esptool-py/esptool.py \
--port /dev/ttyUSB0 write_flash \
0x00000 $SDK_PATH/bin/"boot_v1.4(b1).bin" \
0x01000 $BIN_PATH/upgrade/user1.2048.new.5.bin \
0x101000 $BIN_PATH/upgrade/user2.2048.new.5.bin \
0x3FE000 $SDK_PATH/bin/blank.bin \
0x3FC000 $SDK_PATH/bin/esp_init_data_default.bin
```
_change `/dev/ttyUSB1` to whatever you have._
or the old way...this works not sure this is ok.
```
cd $BIN_PATH
sudo /opt/Espressif/esptool-py/esptool.py \
--port /dev/ttyUSB0 write_flash \
0x00000 eagle.flash.bin 0x40000 eagle.irom0text.bin
```
* power off
* disconnect GPIO0 so that it is floating
* connect GPIO2 with serial of 470 Ohm + LED and to GND
* power On
LED should blink on and off every second | {
"source": "google/pebble",
"title": "third_party/jerryscript/targets/esp8266/docs/ESP-PREREQUISITES.md",
"url": "https://github.com/google/pebble/blob/main/third_party/jerryscript/targets/esp8266/docs/ESP-PREREQUISITES.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 4084
} |
# Health Algorithms
## Step Counting
The step counting algorithm uses input from the accelerometer sensor to detect when the user is walking and how many steps have been taken. The accelerometer measures acceleration in each of 3 axes: x, y, and z. A perfectly still watch resting flat on a table will have 1G (1 โGravityโ) of acceleration in the z direction (due to gravity) and 0Gโs in both the x and y axes. If you tilt the watch on its side for example, the z reading will go to 0 and then either x or y will show +/-1G (depending on which of the 4 sides you tilt it to). During watch movement, the x, y, and z readings will vary over time due to the watchโs changing orientation to gravity as well as the acceleration of the watch when it changes direction or speed. The pattern of these variations in the accelerometer readings over time can be used to detect if, and how fast, the user is stepping.
There are generally two dominant signals that show up in the accelerometer readings when a person is walking or running. The first is the signal due to your feet hitting the ground. This signal shows up as a spike in the accelerometer readings each time a foot hits the ground and will be more or less pronounced depending on the cushioning of your shoes, the type of flooring, etc. Another signal that can show up is from the arm swinging motion, and the strength of this will vary depending on the userโs walking style, whether their hand is in their pocket or not, whether they are carrying something, etc.
Of these two signals, the foot fall one is the most reliable since a user will not always be swinging their arms when walking. The goal of the step tracking algorithm is to isolate and detect this foot fall signal, while not getting confused by other signals (arm swings, random arm movements, etc.).
An overall outline of the approach taken by the stepping algorithm (glossing over the details for now) is as follows:
1. Separate the accelerometer sensor readings into 5 second epochs.
2. For each 5 second epoch, compute an FFT (Fast Fourier Transform) to get the energy of the signal at different frequencies (called the _spectral density_)
3. Examine the FFT output using a set of heuristics to identify the foot fall signal (if present) and its frequency.
4. The frequency of the foot fall signal (if present) is outputted as the number of steps taken in that epoch.
As an example, if the FFT of a 5 second epoch shows a significant amount of foot fall signal at a frequency of 2Hz, we can assume the person has walked 10 steps (2Hz x 5 seconds) in that epoch.
### Example Data
The following figure shows an example of the raw accelerometer data of a five-second epoch when a user is walking 10 steps. The x, y, and z axis signals are each shown in a different color. In this plot, there is a fairly evident five-cycle rhythm in the red and green axes, which happens to be the arm swing signal (for every 2 steps taken, only 1 full arm swing cycle occurs). The ten-cycle foot fall signal however is difficult to see in this particular sample because the arm swing is so strong.

The spectral density of that same walk sample, showing the amount of energy present at different frequencies, is shown in the following figure (this particular plot was generated from a sample longer than 5 seconds, so will be less noisy than any individual 5 second epoch). Here, the spectral density of the x, y, and z axes as well as the combined signal are each plotted in a different color. The _combined_ signal is computed as the magnitude of the x, y, and z spectral density at each frequency:
combined[f] = sqrt(x[f]^2 + y[f]^2 + z[f]^2)
_Note that the y axis on this plot is not simply Power, but rather โPower / Average Powerโ, where โAverage Powerโ is the average power of that particular signal._

You can see in the above spectral density plot that the dominant frequency in this example is 1Hz, corresponding to the 5 arm swings that occurred in these 5 seconds.
There are also several smaller peaks at the following frequencies:
- ~.25Hz: non-stepping signal, most likely random arm movements
- 2Hz: stepping frequency + 2nd harmonic of arm swing
- 3Hz: 3rd harmonic of arm swing
- 4Hz: 2nd harmonic of steps + 4th harmonic of arm swing
- 5Hz: 5th harmonic of arm swing
- 8Hz: 4th harmonic of steps
The logic used to pull out and identify the stepping signal from the spectral density output will be described later, but first we have to introduce the concept of VMC, or Vector Magnitude Counts.
### VMC
VMC, or Vector Magnitude Counts, is a measure of the overall amount of movement in the watch over time. When the watch is perfectly still, the VMC will be 0 and greater amounts of movement result in higher VMC numbers. Running, for example results in a higher VMC than walking.
The VMC computation in Pebble Health was developed in conjunction with the Stanford Wearables lab and has been calibrated to match the VMC numbers produced by the [Actigraph](http://www.actigraphcorp.com/product-category/activity-monitors/) wrist-worn device. The Actigraph is commonly used today for medical research studies. The Stanford Wearables lab will be publishing the VMC computation used in the Pebble Health algorithm and this transparency of the algorithm will enable the Pebble to be used for medical research studies as well.
VMC is computed using the formula below. Before the accelerometer readings are incorporated into this computation however, each axisโ signal is run through a bandpass filter with a design of 0.25Hz to 1.75Hz.

The following pseudo code summarizes the VMC calculation for N samples worth of data in each axis. The accelerometer is sampled at 25 samples per second in the Health algorithm, so the VMC calculation for 1 secondโs worth of data would process 25 samples from each axis. The _bandpass\_filter_ method referenced in this pseudo code is a convolution filter with a frequency response of 0.25 to 1.75Hz:
for each axis in x, y, z:
axis_sum[axis] = 0
for each sample in axis from 0 to N:
filtered_sample = bandpass_filter(sample,
filter_state)
axis_sum[axis] += abs(filtered_sample)
VMC = scaling_factor * sqrt(axis_sum[x]^2
+ axis_sum[y]^2
+ axis_sum[z]^2)
The step algorithm makes use of a VMC that is computed over each 5-second epoch. In addition to this 5-second VMC, the algorithm also computes a VMC over each minute of data. It saves this 1-minute VMC to persistent storage and sends it to data logging as well so that it will eventually get pushed to the phone and saved to a server. The 1-minute VMC values stored in persistent storage can be accessed by 3rd party apps through the Health API. It is these 1-minute VMC values that are designed to match the Actigraph computations and are most useful to medical researcher studies.
### Step Identification
As mentioned above, accelerometer data is processed in chunks of 5 seconds (one epoch) at a time. For each epoch, we use the combined spectral density (FFT output) and the 5-second VMC as inputs to the step identification logic.
#### Generating the FFT output
The accelerometer is sampled at 25Hz, so each 5 second epoch comprises 125 samples in each axis. An FFT must have an input width which is a power of 2, so for each axis, we subtract the mean and then 0-extend to get 128 samples before computing the FFT for that axis.
An FFT of a real signal with 128 samples produces 128 outputs that represent 64 different frequencies. For each frequency, the FFT produces a real and an imaginary component (thus the 128 outputs for 64 different frequencies). The absolute value of the real and imaginary part denote the amplitude at a particular frequency, while the angle represents the phase of that frequency. It is the amplitude of each frequency that we are interested in, so we compute sqrt(real^2 + imag^2) of each frequency to end up with just 64 outputs.
Once the 64 values for each of the 3 axes have been computed, we combine them to get the overall energy at each frequency as follows:
for i = 0 to 63:
energy[i] = sqrt(amp_x[i]^2 + amp_y[i]^2 + amp_z[i]^2)
In this final array of 64 elements, element 0 represents the DC component (0 Hz), element 1 represents a frequency of 1 cycle per epoch (1 / 5s = 0.2Hz), element 2 represents a frequency of 2 cycles per epoch (2 / 5s = 0.4Hz), etc. If the user is walking at a rate of 9 steps every 5 seconds, then a spike will appear at index 9 in this array (9 / 5s = 1.8Hz).
As an example, the following shows the FFT output of a user walking approximately 9 steps in an epoch (with very little arm swing):

#### Determining the stepping frequency
Once the FFT output and VMC have been obtained, we search for the most likely stepping frequency. The naive approach is to simply locate the frequency with the highest amplitude among all possible stepping frequencies. That would work fine for the example just shown above where there is a clear peak at index 9 of the FFT, which happens to be the stepping frequency.
However, for some users the arm swinging signal can be as large or larger than the stepping signal, and happens to be at half the stepping frequency. If a user is walking at a quick pace, the arm swinging signal could easily be misinterpreted as the stepping signal of a slow walk. The following is the FFT of such an example. The stepping signal shows up at indices 9 and 10, but there is a larger peak at the arm-swing frequency at index 5.

To deal with these possible confusions between arm-swing and stepping signals, the VMC is used to narrow down which range of frequencies the stepping is likely to fall in. Based on the VMC level, we search one of three different ranges of frequencies to find which frequency has the most energy and is the likely stepping frequency. When the VMC is very low, we search through a range of frequencies that represent a slow walk, and for higher VMCs we search through ranges of frequencies that represent faster walks or runs.
Once we find a stepping frequency candidate within the expected range, we further refine the choice by factoring in the harmonics of the stepping/arm swinging. Occasionally, a max signal in the stepping range does not represent the actual stepping rate - it might be off by one or two indices due to noise in the signal, or it might be very close in value to the neighboring frequency, making it hard to determine which is the optimal one to use. This is evident in the arm-swinging output shown above where the energy at index 9 is very close to the energy at index 10.
As mentioned earlier, we often see significant energy at the harmonics of both the arm-swinging and the stepping frequency. A harmonic is an integer multiple of the fundamental frequency (i.e. a stepping frequency of 2 Hz will result in harmonics at 4Hz, 6Hz, 8Hz, etc.). To further refine the stepping frequency choice, we evaluate all possible stepping frequencies near the first candidate (+/- 2 indices on each side) and add in the energy of the harmonics for each. For each evaluation, we add up the energy of that stepping frequency, the arm energy that would correspond to that stepping frequency (the energy at half the stepping frequency), and the 2nd thru 5th harmonics of both the stepping and arm-swinging frequencies. Among these 5 different candidate stepping frequencies, we then choose the one that ended up with the most energy overall.
At the end of this process, we have the most likely stepping frequency, **if** the user is indeed walking. The next step is to determine whether or not the user is in fact walking or not.
#### Classifying step vs non-step epochs
In order to classify an epoch as walking or non-walking, we compute and check a number of metrics from the FFT output.
The first such metric is the _walking score_ which is the sum of the energy in the stepping related frequencies (signal energy) divided by the sum of energy of all frequencies (total energy). The signal energy includes the stepping frequency, arm-swing frequency, and each of their harmonics. If a person is indeed walking, the majority of the signal will appear at these signal frequencies, yielding a high walking score.
The second constraint that the epoch must pass is that the VMC must be above a _minimum stepping VMC_ threshold. A higher threshold is used if the detected stepping rate is higher.
The third constraint that the epoch must pass is that the amount of energy in the very low frequency components must be relatively low. To evaluate this constraint, the amount of energy in the low frequency components (indices 0 through 4) is summed and then divided by the signal energy (computed above). If this ratio is below a set _low frequency ratio_ threshold, the constraint is satisfied. The example below is typical of many epochs that are non-stepping epochs - a large amount of the energy appears in the very low frequency area.

The fourth and final constraint that the epoch must pass is that the energy in the high frequencies must be relatively low. To evaluate this constraint, the amount of energy in the high frequency components (index 50 and above) is summed and then divided by the signal energy. If this ratio is below a set _high frequency ratio_ threshold, the constraint is satisfied. This helps to avoid counting driving epochs as stepping epochs. In many instances, the vibration of the engine in a car will show up as energy at these high frequencies as shown in the following diagram.

#### Partial Epochs
If the user starts or ends a walk in the middle of an epoch, the epoch will likely not pass the checks for a full fledged stepping epoch and these steps will therefore not get counted. To adjust for this undercounting, the algorithm introduces the concept of _partial epochs_.
The required _walking score_ and _minimum VMC_ are lower for a partial epoch vs. a normal epoch and there are no constraints on the low or high frequency signal ratios. To detect if an epoch is a _partial epoch_ we only check that the _walking score_ is above the _partial epoch walking score_ threshold and that the VMC is above the _partial epoch minimum VMC_ threshold.
If we detect a partial epoch, and either the prior or next epoch were classified as a stepping epoch, we add in half the number of steps that were detected in the adjacent stepping epoch. This helps to average out the undercounting that would normally occur at the start and end of a walk. For a very short walk that is less than 2 epochs long though, there is still a chance that no steps at all would be counted.
----
## Sleep Tracking
The sleep tracking algorithm uses the minute-level VMC values and minute-level average orientation of the watch to determine if/when the user is sleeping and whether or not the user is in โrestfulโ sleep.
The minute-level VMC was described above. It gives a measure of the overall amount of movement seen by the watch in each minute.
The average orientation is a quantized (currently 8 bits) indication of the 3-D angle of the watch. It is computed once per minute based on the average accelerometer reading seen in each of the 3 axes. The angle of the watch in the X-Y plane is computed and quantized into the lower 4 bits and the angle of that vector with the Z-axis is then quantized and stored in the upper 4 bits.
### Sleep detection
The following discussion uses the term _sleep minute_. To determine if a minute is a _sleep minute_, we perform a convolution of the VMC values around that minute (using the 4 minutes immediately before and after the given minute) to generate a _filtered VMC_ and compare the _filtered VMC_ value to a threshold. If the result is below a determined sleep threshold, we count it as a _sleep minute_.
A rough outline of the sleep algorithm is as follows.
1. Sleep is entered if there are at least 5 _sleep minutes_ in a row.
2. Sleep continues until there are at least 11 non-_sleep minutes_ in a row.
3. If there were at least 60 minutes between the above sleep enter and sleep exit times, it is counted as a valid sleep session.
There are some exceptions to the above rules however:
- After sleep has been entered, if we see any minute with an exceptionally high _filtered VMC_, we end the sleep session immediately.
- If it is early in the sleep session (the first 60 minutes), we require 14 non-_sleep minutes_ in a row to consider the user as awake instead of 11.
- If at least 80% of the minutes have slight movement in them (even if each one is not high enough to make it a non-_sleep minute_), we consider the user awake.
- If we detect that the watch was not being worn during the above time (see below), we invalidate the sleep session.
#### Restful sleep
Once we detect a sleep session using the above logic, we make another pass through that same data to see if there are any periods within that session that might be considered as _restful sleep_.
A _restful sleep minute_ is a minute where the _filtered VMC_ is below the _restful sleep minute_ threshold (this is lower than the normal _sleep minute_ threshold).
1. Restful sleep is entered if there are at least 20 _restful sleep minutes_ in a row.
2. Restful sleep continues until there is at least 1 minute that is not a _restful sleep minute_.
### Detecting not-worn
Without some additional logic in place, the above rules would think a user is in a sleep session if the watch is not being worn. This is because there would be no movement and the VMC values would all be 0, or at least very low.
Once we detect a possible sleep session, we run that same data through the โnot-wornโ detection logic to determine if the watch was not being worn during that time. This is a set of heuristics that are designed to distinguish not-worn from sleep.
The following description uses the term _not worn minute_. A _not worn minute_ is a minute where **either** of the following is true:
- The VMC (the raw VMC, not _filtered VMC_) is below the _not worn_ threshold and the average orientation is same as it was the prior minute
- The watch is charging
If we see **both** of the following, we assume the watch is not being worn:
1. There are at least 100 _not worn_ minutes in a row in the sleep session
2. The _not worn_ section from #1 starts within 20 minutes of the start of the candidate sleep session and ends within 10 minutes of the end of the candidate sleep session.
The 100 minute required run length for _not worn_ might seem long, but it is not uncommon to see valid restful sleep sessions for a user that approach 100 minutes in length.
The orientation check is useful for situations where a watch is resting on a table, but encounters an occasional vibration due to floor or table shaking. This vibration shows up as a non-zero VMC and can look like the occasional movements that are normal during sleep. During actual sleep however, it is more likely that the user will change positions and end up at a different orientation on the next minute.
----
## System Integration
The following sections discuss how the step and sleep tracking algorithms are integrated into the firmware.
### Code organization
The core of the Health support logic is implemented in the activity service, which is in the `src/fw/services/normal/activity` directory. The 3rd party API, which calls into the activity service, is implemented in `src/fw/applib/health_service.c.`
The activity service implements the step and sleep algorithms and all of the supporting logic required to integrate the algorithms into the system. It has the following directory structure:
src/fw/services/normal/activity
activity.c
activity_insights.c
kraepelin/
kraepelin_algorithm.c
activity_algorithm_kraepelin.c
- **activity.c** This is the main module for the activity service. It implements the API for the activity service and the high level glue layer around the underlying step and sleep algorithms. This module contains only algorithm agnostic code and should require minimal changes if an alternative implementation for step or sleep tracking is incorporated in the future.
- **activity\_insights.c** This module implements the logic for generating Health timeline pins and notifications.
- **kraepelin** This subdirectory contains the code for the Kraepelin step and sleep algorithm, which is the name given to the current set of algorithms described in this document. This logic is broken out from the generic interface code in activity.c to make it easier to substitute in alternative algorithm implementations in the future if need be.
- **kraepelin\_algorithm.c** The core step and sleep algorithm code. This module is intended to be operating system agnostic and contains minimal calls to external functions. This module originated from open source code provided by the Stanford Wearables Lab.
- **kraepelin/activity\_algorightm\_kraepelin.c** This module wraps the core algorithm code found in `kraepelin_algorithm.c` to make it conform to the internal activity service algorithm API expected by activity.c. An alternative algorithm implementation would just need to implement this same API in order for it to be accessible from `activity.c`. This modules handles all memory allocations, persistent storage management, and other system integration functions for the raw algorithm code found in kraepelin\_algorithm.c.
The 3rd party Health API is implemented in `src/fw/applib/health_service.c`. The `health_service.c` module implements the โuser landโ logic for the Health API and makes calls into the activity service (which runs in privileged mode) to access the raw step and sleep data.
### Step Counting
The `activity.c` module asks the algorithm implementation `activity_algorithm_kraepelin.c` what accel sampling rate it requires and handles all of the logic required to subscribe to the accel service with that sampling rate. All algorithmic processing (both step and sleep) in the activity service is always done from the KernelBG task, so `activity.c` subscribes to the accel service from a KernelBG callback and provides the accel service a callback method which is implemented in `activity.c`.
When `activity.cโs` accel service callback is called, it simply passes the raw accel data onto the underlying algorithmโs accel data handler implemented `activity_algorithm_kraepelin.c`. This handler in turn calls into the core algorithm code in `kraepelin_algorithm.c` to execute the raw step algorithm code and increments total steps by the number of steps returned by that method. Since the step algorithm in `kraepelin_algorithm.c` is based on five-second epochs and the accel service callback gets called once a second (25 samples per second), the call into `kraepelin_algorithm.c` will only return a non-zero step count value once every 5 times it is called.
Whenever a call is made to `activity.c` to get the total number of steps accumulated so far, `activity.c` will ask the `activity_algorithm_kraepelin.c` module for that count. The `activity_algorithm_kraepelin.c` module maintains that running count directly and returns it without needing to call into the raw algorithm code.
At midnight of each day, `activity.c` will make a call into `activity_algorithm_kraeplin.c` to reset the running count of steps back to 0.
### Sleep processing
For sleep processing, the `activity_algorithm_kraepelin.c` module has a much bigger role than it does for step processing. The core sleep algorithm in `kraepelin_algorithm.c` simply expects an array of VMC and average orientation values (one each per minute) and from that it identifies where the sleep sessions are. It is the role of `activity_algorithm_kraepelin.c` to build up this array of VMC values for the core algorithm and it does this by fetching the stored VMC and orientation values from persistent storage. The `activity_algorithm_kraepelin.c` module includes logic that periodically captures the VMC and orientation for each minute from the core algorithm module and saves those values to persistent storage for this purpose as well as for retrieval by the 3rd party API call that can be used by an app or worker to fetch historical minute-level values.
Currently, `activity.c` asks `activity_algorithm_kraepelin.c` to recompute sleep every 15 minutes. When asked to recompute sleep, `activity_algorithm_kraepelin.c` fetches the last 36 hours of VMC and orientation data from persistent storage and passes that array of values to the core sleep algorithm. When we compute sleep for the current day, we include all sleep sessions that *end* after midnight of the current day, so they may have started sometime before midnight. Including 36 hours of minute data means that, if asked to compute sleep at 11:59pm for example, we can go as far back as a sleep session that started at 6pm the prior day.
To keep memory requirements to a minimum, we encode each minute VMC value into a single byte for purposes of recomputing sleep. The raw VMC values that we store in persistent storage are 16-bit values, so we take the square root of each 16-bit value to compress it into a single byte. The average orientation is also encoded as a single byte. The 36 hours of minute data therefore requires that an array of 36 \* 60 \* 2 (4320) bytes be temporarily allocated and passed to the core sleep algorithm logic.
The core sleep logic in `kraepelin_algorithm.c` does not have any concept of what timestamp corresponds to each VMC value in the array, it only needs to describe the sleep sessions in terms of indices into the array. It is the role of `activity_algorithm_kraepelin.c` to translate these indices into actual UTC time stamps for use by the activity service.
## Algorithm Development and Testing
There is a full set of unit tests in `tests/fw/services/activity` for testing the step and sleep algorithms. These tests run captured sample data through the `kraepelin_algorithm.c` algorithm code to verify the expected number of steps or sleep sessions.
### Step Algorithm Testing
For testing the step algorithm, raw accel data is fed into the step algorithm. This raw accel data is stored in files as raw tuples of x, y z, accelerometer readings and can be found in the `tests/fixtures/activity/step_samples` directory.
Although these files have the C syntax, they are not compiled but are read in and parsed by the unit tests at run-time. Each sample in each file contains meta-data that tells the unit test the expected number of steps for that sample, which is used to determine if the test passes or not.
To capture these samples, the activity service has a special mode that can be turned on for raw sample capture and the `Activity Demo` app has an item in its debug menu for turning on this mode. When this mode is turned on, the activity service saves raw samples to data logging, and at the same time, also captures the raw sample data to the Pebble logs as base64 encoded binary data. Capturing the accel data to the logs makes it super convenient to pull that data out of the watch simply by issuing a support request from the mobile app.
The `tools/activity/parse_activity_data_logging_records.py` script can be used to parse the raw accel samples out of a log file that was captured as part of a support request or from a binary file containing the data logging records captured via data logging. This tool outputs a text file, in C syntax, that can be used directly by the step tracking unit tests.
The unit test that processes all of the step samples in `tests/fixtures/activity/step_samples` insures that the number of steps computed by the algorithm for each sample is within the allowed minimum and maximum for that sample (as defined by the meta data included in each sample file). It also computes an overall error amount across all sample files and generates a nice summary report for reference purposes. When tuning the algorithm, these summary reports can be used to easily compare results for various potential changes.
### Sleep Algorithm Testing
For testing the sleep algorithm, minute-by-minute VMC values are fed into the algorithm code. The set of sample sleep files used by the unit tests are found in the `tests/fixtures/activity/sleep_samples` directory. As is the case for the step samples, these files are parsed by the unit tests at run-time even though they are in C syntax.
To capture these samples, the activity service has a special call that will result in a dump of the contents of the last 36 hours of minute data to the Pebble logs. The `Activity Demo` app has an item in its debug menu for triggering this call. When this call is made, the activity service will fetch the last 36 hours of minute data from persistent storage, base64 encode it, and put it into the Pebble logs so that it can be easily retrieved using a support request from the mobile app.
As is the case for step data, the `tools/activity/parse_activity_data_logging_records.py` script can also be used to extract the minute data out of a support request log file and will in turn generate a text file that can be directly parsed by the sleep algorithm unit tests.
Each sleep sample file contains meta data in it that provides upper and lower bounds for each of the sleep metrics that can be computed by the algorithm (total amount of sleep, total amount of restful sleep, sleep start time, sleep end time, etc.). These metrics are checked by the unit tests to determine if each sample passes.
Note that the minute-by-minute VMC values can always be captured up to 36 hours **after** a sleep issue has been discovered on the watch since the watch is always storing these minute statistics in persistent storage. In contrast, turning on capture of raw accel data for a step algorithm issue must be done before the user starts the activity since capturing raw accel data is too expensive (memory and power-wise) to leave on all the time. | {
"source": "google/pebble",
"title": "src/fw/services/normal/activity/docs/index.md",
"url": "https://github.com/google/pebble/blob/main/src/fw/services/normal/activity/docs/index.md",
"date": "2025-01-21T21:11:59",
"stars": 4407,
"description": "This is the latest version of the internal repository from Pebble Technology providing the software to run on Pebble watches. Proprietary source code has been removed from this repository and it will not compile as-is. This is for information only.",
"file_size": 30384
} |
# Welcome Contributors
We welcome contributions to enhance DeepClaude's capabilities and improve its performance. To report bugs, create a [GitHub issue](https://github.com/getasterisk/deepclaude/issues).
> Before contributing, read through the existing issues and pull requests to see if someone else is already working on something similar. That way you can avoid duplicating efforts.
To contribute, please follow these steps:
1. Fork the DeepClaude repository on GitHub.
2. Create a new branch for your feature or bug fix.
3. Make your changes and ensure that the code passes all tests.
4. Submit a pull request describing your changes and their benefits.
### Pull Request Guidelines
When submitting a pull request, please follow these guidelines:
1. **Title**: please include following prefixes:
- `Feature:` for new features
- `Fix:` for bug fixes
- `Docs:` for documentation changes
- `Refactor:` for code refactoring
- `Improve:` for performance improvements
- `Other:` for other changes
for example:
- `Feature: added new feature to the code`
- `Fix: fixed the bug in the code`
2. **Description**: Provide a clear and detailed description of your changes in the pull request. Explain the problem you are solving, the approach you took, and any potential side effects or limitations of your changes.
3. **Documentation**: Update the relevant documentation to reflect your changes. This includes the README file, code comments, and any other relevant documentation.
4. **Dependencies**: If your changes require new dependencies, ensure that they are properly documented and added to the `Cargo.toml` or `package.json` files.
5. if the pull request does not meet the above guidelines, it may be closed without merging.
**Note**: Please ensure that you have the latest version of the code before creating a pull request. If you have an existing fork, just sync your fork with the latest version of the DeepClaude repository.
Please adhere to the coding conventions, maintain clear documentation, and provide thorough testing for your contributions. | {
"source": "getAsterisk/deepclaude",
"title": "CONTRIBUTING.md",
"url": "https://github.com/getAsterisk/deepclaude/blob/main/CONTRIBUTING.md",
"date": "2025-01-26T16:25:41",
"stars": 4263,
"description": "A high-performance LLM inference API and Chat UI that integrates DeepSeek R1's CoT reasoning traces with Anthropic Claude models.",
"file_size": 2098
} |
MIT License
Copyright (c) 2025 Mufeed VH / Asterisk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. | {
"source": "getAsterisk/deepclaude",
"title": "LICENSE.md",
"url": "https://github.com/getAsterisk/deepclaude/blob/main/LICENSE.md",
"date": "2025-01-26T16:25:41",
"stars": 4263,
"description": "A high-performance LLM inference API and Chat UI that integrates DeepSeek R1's CoT reasoning traces with Anthropic Claude models.",
"file_size": 1077
} |
<div align="center">
<h1>DeepClaude ๐ฌ๐ง </h1>
<img src="frontend/public/deepclaude.png" width="300">
Harness the power of DeepSeek R1's reasoning and Claude's creativity and code generation capabilities with a unified API and chat interface.
[](https://github.com/getasterisk/deepclaude/blob/main/LICENSE.md)
[](https://www.rust-lang.org/)
[](https://deepclaude.asterisk.so)
[Getting Started](#getting-started) โข
[Features](#features) โข
[API Usage](#api-usage) โข
[Documentation](#documentation) โข
[Self-Hosting](#self-hosting) โข
[Contributing](#contributing)
</div>
## Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Why R1 + Claude?](#why-r1--claude)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [API Usage](#api-usage)
- [Basic Example](#basic-example)
- [Streaming Example](#streaming-example)
- [Configuration Options](#configuration-options)
- [Self-Hosting](#self-hosting)
- [Security](#security)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgments](#acknowledgments)
## Overview
DeepClaude is a high-performance LLM inference API that combines DeepSeek R1's Chain of Thought (CoT) reasoning capabilities with Anthropic Claude's creative and code generation prowess. It provides a unified interface for leveraging the strengths of both models while maintaining complete control over your API keys and data.
## Features
๐ **Zero Latency** - Instant responses with R1's CoT followed by Claude's response in a single stream, powered by a high-performance Rust API
๐ **Private & Secure** - End-to-end security with local API key management. Your data stays private
โ๏ธ **Highly Configurable** - Customize every aspect of the API and interface to match your needs
๐ **Open Source** - Free and open-source codebase. Contribute, modify, and deploy as you wish
๐ค **Dual AI Power** - Combine DeepSeek R1's reasoning with Claude's creativity and code generation
๐ **Managed BYOK API** - Use your own API keys with our managed infrastructure for complete control
## Why R1 + Claude?
DeepSeek R1's CoT trace demonstrates deep reasoning to the point of an LLM experiencing "metacognition" - correcting itself, thinking about edge cases, and performing quasi Monte Carlo Tree Search in natural language.
However, R1 lacks in code generation, creativity, and conversational skills. Claude 3.5 Sonnet excels in these areas, making it the perfect complement. DeepClaude combines both models to provide:
- R1's exceptional reasoning and problem-solving capabilities
- Claude's superior code generation and creativity
- Fast streaming responses in a single API call
- Complete control with your own API keys
## Getting Started
### Prerequisites
- Rust 1.75 or higher
- DeepSeek API key
- Anthropic API key
### Installation
1. Clone the repository:
```bash
git clone https://github.com/getasterisk/deepclaude.git
cd deepclaude
```
2. Build the project:
```bash
cargo build --release
```
### Configuration
Create a `config.toml` file in the project root:
```toml
[server]
host = "127.0.0.1"
port = 3000
[pricing]
# Configure pricing settings for usage tracking
```
## API Usage
See [API Docs](https://deepclaude.chat)
### Basic Example
```python
import requests
response = requests.post(
"http://127.0.0.1:1337/",
headers={
"X-DeepSeek-API-Token": "<YOUR_DEEPSEEK_API_KEY>",
"X-Anthropic-API-Token": "<YOUR_ANTHROPIC_API_KEY>"
},
json={
"messages": [
{"role": "user", "content": "How many 'r's in the word 'strawberry'?"}
]
}
)
print(response.json())
```
### Streaming Example
```python
import asyncio
import json
import httpx
async def stream_response():
async with httpx.AsyncClient() as client:
async with client.stream(
"POST",
"http://127.0.0.1:1337/",
headers={
"X-DeepSeek-API-Token": "<YOUR_DEEPSEEK_API_KEY>",
"X-Anthropic-API-Token": "<YOUR_ANTHROPIC_API_KEY>"
},
json={
"stream": True,
"messages": [
{"role": "user", "content": "How many 'r's in the word 'strawberry'?"}
]
}
) as response:
response.raise_for_status()
async for line in response.aiter_lines():
if line:
if line.startswith('data: '):
data = line[6:]
try:
parsed_data = json.loads(data)
if 'content' in parsed_data:
content = parsed_data.get('content', '')[0]['text']
print(content, end='',flush=True)
else:
print(data, flush=True)
except json.JSONDecodeError:
pass
if __name__ == "__main__":
asyncio.run(stream_response())
```
## Configuration Options
The API supports extensive configuration through the request body:
```json
{
"stream": false,
"verbose": false,
"system": "Optional system prompt",
"messages": [...],
"deepseek_config": {
"headers": {},
"body": {}
},
"anthropic_config": {
"headers": {},
"body": {}
}
}
```
## Self-Hosting
DeepClaude can be self-hosted on your own infrastructure. Follow these steps:
1. Configure environment variables or `config.toml`
2. Build the Docker image or compile from source
3. Deploy to your preferred hosting platform
## Security
- No data storage or logged
- BYOK (Bring Your Own Keys) architecture
- Regular security audits and updates
## Contributing
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on:
- Code of Conduct
- Development process
- Submitting pull requests
- Reporting issues
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.
## Acknowledgments
DeepClaude is a free and open-source project by [Asterisk](https://asterisk.so/). Special thanks to:
- DeepSeek for their incredible R1 model
- Anthropic for Claude's capabilities
- The open-source community for their continuous support
---
<div align="center">
Made with โค๏ธ by <a href="https://asterisk.so">Asterisk</a>
</div> | {
"source": "getAsterisk/deepclaude",
"title": "README.md",
"url": "https://github.com/getAsterisk/deepclaude/blob/main/README.md",
"date": "2025-01-26T16:25:41",
"stars": 4263,
"description": "A high-performance LLM inference API and Chat UI that integrates DeepSeek R1's CoT reasoning traces with Anthropic Claude models.",
"file_size": 6665
} |
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## Learn More
To learn more about Next.js, take a look at the following resources:
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## Deploy on Vercel
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. | {
"source": "getAsterisk/deepclaude",
"title": "frontend/README.md",
"url": "https://github.com/getAsterisk/deepclaude/blob/main/frontend/README.md",
"date": "2025-01-26T16:25:41",
"stars": 4263,
"description": "A high-performance LLM inference API and Chat UI that integrates DeepSeek R1's CoT reasoning traces with Anthropic Claude models.",
"file_size": 1449
} |
# g1: Using Llama-3.1 70b on Groq to create o1-like reasoning chains
[Video Demo](https://github.com/user-attachments/assets/db2a221f-f8eb-48c3-b5a7-8399c6300243)
This is an early prototype of using prompting strategies to improve the LLM's reasoning capabilities through o1-like reasoning chains. This allows the LLM to "think" and solve logical problems that usually otherwise stump leading models. Unlike o1, all the reasoning tokens are shown, and the app uses an open source model.
g1 is experimental and being open sourced to help inspire the open source community to develop new strategies to produce o1-like reasoning. This experiment helps show the power of prompting reasoning in visualized steps, not a comparison to or full replication of o1, which uses different techniques. OpenAI's o1 is instead trained with large-scale reinforcement learning to reason using Chain of Thought, achieving state-of-the-art performance on complex PhD-level problems.
g1 demonstrates the potential of prompting alone to overcome straightforward LLM logic issues like the Strawberry problem, allowing existing open source models to benefit from dynamic reasoning chains and an improved interface for exploring them.
### How it works
g1 powered by Llama3.1-70b creates reasoning chains, in principle a dynamic Chain of Thought, that allows the LLM to "think" and solve some logical problems that usually otherwise stump leading models.
At each step, the LLM can choose to continue to another reasoning step, or provide a final answer. Each step is titled and visible to the user. The system prompt also includes tips for the LLM. There is a full explanation under Prompt Breakdown, but a few examples are asking the model to โinclude exploration of alternative answersโ and โuse at least 3 methods to derive the answerโ.
The reasoning ability of the LLM is therefore improved through combining Chain-of-Thought with the requirement to try multiple methods, explore alternative answers, question previous draft solutions, and consider the LLMโs limitations. This alone, without any training, is sufficient to achieve ~70% accuracy on the Strawberry problem (n=10, "How many Rs are in strawberry?"). Without prompting, Llama-3.1-70b had 0% accuracy and ChatGPT-4o had 30% accuracy.
### Examples
> [!IMPORTANT]
> g1 is not perfect, but it can perform significantly better than LLMs out-of-the-box. From initial testing, g1 accurately solves simple logic problems 60-80% of the time that usually stump LLMs. However, accuracy has yet to be formally evaluated. See examples below.
##### How many Rs are in strawberry?
Prompt: How many Rs are in strawberry?
Result:

---
Prompt: Which is larger, .9 or .11?
Result:

### Quickstart
To use the Streamlit UI, follow these instructions:
~~~
python3 -m venv venv
~~~
~~~
source venv/bin/activate
~~~
~~~
pip3 install -r requirements.txt
~~~
~~~
export GROQ_API_KEY=gsk...
~~~
~~~
streamlit run app.py
~~~
---
Alternatively, follow these additional instructions to use the Gradio UI:
~~~
cd gradio
~~~
~~~
pip3 install -r requirements.txt
~~~
~~~
python3 app.py
~~~
### Prompting Strategy
The prompt is as follows:
```
You are an expert AI assistant that explains your reasoning step by step. For each step, provide a title that describes what you're doing in that step, along with the content. Decide if you need another step or if you're ready to give the final answer. Respond in JSON format with 'title', 'content', and 'next_action' (either 'continue' or 'final_answer') keys. USE AS MANY REASONING STEPS AS POSSIBLE. AT LEAST 3. BE AWARE OF YOUR LIMITATIONS AS AN LLM AND WHAT YOU CAN AND CANNOT DO. IN YOUR REASONING, INCLUDE EXPLORATION OF ALTERNATIVE ANSWERS. CONSIDER YOU MAY BE WRONG, AND IF YOU ARE WRONG IN YOUR REASONING, WHERE IT WOULD BE. FULLY TEST ALL OTHER POSSIBILITIES. YOU CAN BE WRONG. WHEN YOU SAY YOU ARE RE-EXAMINING, ACTUALLY RE-EXAMINE, AND USE ANOTHER APPROACH TO DO SO. DO NOT JUST SAY YOU ARE RE-EXAMINING. USE AT LEAST 3 METHODS TO DERIVE THE ANSWER. USE BEST PRACTICES.
Example of a valid JSON response:
json
{
"title": "Identifying Key Information",
"content": "To begin solving this problem, we need to carefully examine the given information and identify the crucial elements that will guide our solution process. This involves...",
"next_action": "continue"
}
```
#### Breakdown
First, a persona is added:
> You are an expert AI assistant that explains your reasoning step by step.
Then, instructions to describe the expected step-by-step reasoning process while titling each reasoning step. This includes the ability for the LLM to decide if another reasoning step is needed or if the final answer can be provided.
> For each step, provide a title that describes what you're doing in that step, along with the content. Decide if you need another step or if you're ready to give the final answer.
JSON formatting is introduced with an example provided later.
> Respond in JSON format with 'title', 'content', and 'next_action' (either 'continue' or 'final_answer') keys.
In all-caps to improve prompt compliance by emphasizing the importance of the instruction, a set of tips and best practices are included.
1. Use as many reasoning steps as possible. At least 3. -> This ensures the LLM actually takes the time to think first, and results usually in about 5-10 steps.
2. Be aware of your limitations as an llm and what you can and cannot do. -> This helps the LLM remember to use techniques which produce better results, like breaking "strawberry" down into individual letters before counting.
3. Include exploration of alternative answers. Consider you may be wrong, and if you are wrong in your reasoning, where it would be. -> A large part of the gains seem to come from the LLM re-evaluating its initial response to ensure it logically aligns with the problem.
4. When you say you are re-examining, actually re-examine, and use another approach to do so. Do not just say you are re-examining. -> This encourages the prevention of the LLM just saying it re-examined a problem without actually trying a new approach.
5. Use at least 3 methods to derive the answer. -> This helps the LLM come to the right answer by trying multiple methods to derive it.
6. Use best practices. -> This is as simple as the "Do better" prompts which improve LLM code output. By telling the LLM to use best practices, or do better, it generally performs better!
> USE AS MANY REASONING STEPS AS POSSIBLE. AT LEAST 3. BE AWARE OF YOUR LIMITATIONS AS AN LLM AND WHAT YOU CAN AND CANNOT DO. IN YOUR REASONING, INCLUDE EXPLORATION OF ALTERNATIVE ANSWERS. CONSIDER YOU MAY BE WRONG, AND IF YOU ARE WRONG IN YOUR REASONING, WHERE IT WOULD BE. FULLY TEST ALL OTHER POSSIBILITIES. YOU CAN BE WRONG. WHEN YOU SAY YOU ARE RE-EXAMINING, ACTUALLY RE-EXAMINE, AND USE ANOTHER APPROACH TO DO SO. DO NOT JUST SAY YOU ARE RE-EXAMINING. USE AT LEAST 3 METHODS TO DERIVE THE ANSWER. USE BEST PRACTICES.
Finally, after the problem is added as a user message, an assistant message is loaded to provide a standardized starting point for the LLM's generation.
> Assistant: Thank you! I will now think step by step following my instructions, starting at the beginning after decomposing the problem
### Top Forks
* Huggingface Spaces Demo: [](https://huggingface.co/spaces/xylin/g1-demo)
* Mult1: Using multiple AI providers to create o1-like reasoning chains ([GitHub Repository](https://github.com/tcsenpai/multi1))
* thinkR: o1 like chain of thoughts with local LLMs in R ([GitHub Repository](https://github.com/eonurk/thinkR))
### Credits
This app was developed by [Benjamin Klieger](https://x.com/benjaminklieger). | {
"source": "bklieger-groq/g1",
"title": "README.md",
"url": "https://github.com/bklieger-groq/g1/blob/main/README.md",
"date": "2024-09-13T21:20:48",
"stars": 4187,
"description": "g1: Using Llama-3.1 70b on Groq to create o1-like reasoning chains",
"file_size": 7908
} |
### g1 with Tool Use
Check out g1 with Tool Use! Including web access with Exa.ai, calculator with Wolfram Alpha, and code executor in Python.
It is recommended to set up your virtual environment in the root folder and run the app.py from there using:
~~~
streamlit run tool-use/app.py
~~~
Also, ensure you have downloaded the new pip dependency: ```exa-py``` | {
"source": "bklieger-groq/g1",
"title": "tool-use/README.md",
"url": "https://github.com/bklieger-groq/g1/blob/main/tool-use/README.md",
"date": "2024-09-13T21:20:48",
"stars": 4187,
"description": "g1: Using Llama-3.1 70b on Groq to create o1-like reasoning chains",
"file_size": 362
} |
# How I Stay Sane Implementing Stripe
> [!NOTE]
> **Update (2025-02-07)**
> Stripe invited me to speak with the CEO at their company-wide all hands meeting. They were super receptive to my feedback, and I see a bright future where none of this is necessary. Until then, I still think this is the best way to set up payments in your SaaS apps.
I have set up Stripe far too many times. I've never enjoyed it. I've talked to the Stripe team about the shortcomings and they say they'll fix them...eventually.
Until then, this is how I recommend setting up Stripe. I don't cover everything - check out [things that are still your problem](#things-that-are-still-your-problem) for clarity on what I'm NOT helping with.
> If you want to stay sane implementing file uploads, check out my product [UploadThing](https://uploadthing.com/).
### Pre-requirements
- TypeScript
- Some type of JS backend
- Working auth (that is verified on your JS backend)
- A KV store (I use Redis, usually [Upstash](https://upstash.com/?utm_source=theo), but any KV will work)
### General philosophy
IMO, the biggest issue with Stripe is the "split brain" it inherently introduces to your code base. When a customer checks out, the "state of the purchase" is in Stripe. You're then expected to track the purchase in your own database via webhooks.
There are [over 258 event types](https://docs.stripe.com/api/events/types). They all have different amounts of data. The order you get them is not guaranteed. None of them should be trusted. It's far too easy to have a payment be failed in stripe and "subscribed" in your app.
These partial updates and race conditions are obnoxious. I recommend avoiding them entirely. My solution is simple: _a single `syncStripeDataToKV(customerId: string)` function that syncs all of the data for a given Stripe customer to your KV_.
The following is how I (mostly) avoid getting Stripe into these awful split states.
## The Flow
This is a quick overview of the "flow" I recommend. More detail below. Even if you don't copy my specific implementation, you should read this. _I promise all of these steps are necessary. Skipping any of them will make life unnecessarily hard_
1. **FRONTEND:** "Subscribe" button should call a `"generate-stripe-checkout"` endpoint onClick
1. **USER:** Clicks "subscribe" button on your app
1. **BACKEND:** Create a Stripe customer
1. **BACKEND:** Store binding between Stripe's `customerId` and your app's `userId`
1. **BACKEND:** Create a "checkout session" for the user
- With the return URL set to a dedicated `/success` route in your app
1. **USER:** Makes payment, subscribes, redirects back to `/success`
1. **FRONTEND:** On load, triggers a `syncAfterSuccess` function on backend (hit an API, server action, rsc on load, whatever)
1. **BACKEND:** Uses `userId` to get Stripe `customerId` from KV
1. **BACKEND:** Calls `syncStripeDataToKV` with `customerId`
1. **FRONTEND:** After sync succeeds, redirects user to wherever you want them to be :)
1. **BACKEND:** On [_all relevant events_](#events-i-track), calls `syncStripeDataToKV` with `customerId`
This might seem like a lot. That's because it is. But it's also the simplest Stripe setup I've ever seen work.
Let's go into the details on the important parts here.
### Checkout flow
The key is to make sure **you always have the customer defined BEFORE YOU START CHECKOUT**. The ephemerality of "customer" is a straight up design flaw and I have no idea why they built Stripe like this.
Here's an adapted example from how we're doing it in [T3 Chat](https://t3.chat).
```ts
export async function GET(req: Request) {
const user = auth(req);
// Get the stripeCustomerId from your KV store
let stripeCustomerId = await kv.get(`stripe:user:${user.id}`);
// Create a new Stripe customer if this user doesn't have one
if (!stripeCustomerId) {
const newCustomer = await stripe.customers.create({
email: user.email,
metadata: {
userId: user.id, // DO NOT FORGET THIS
},
});
// Store the relation between userId and stripeCustomerId in your KV
await kv.set(`stripe:user:${user.id}`, newCustomer.id);
stripeCustomerId = newCustomer.id;
}
// ALWAYS create a checkout with a stripeCustomerId. They should enforce this.
const checkout = await stripe.checkout.sessions.create({
customer: stripeCustomerId,
success_url: "https://t3.chat/success",
...
});
```
### syncStripeDataToKV
This is the function that syncs all of the data for a given Stripe customer to your KV. It will be used in both your `/success` endpoint and in your `/api/stripe` webhook handler.
The Stripe api returns a ton of data, much of which can not be serialized to JSON. I've selected the "most likely to be needed" chunk here for you to use, and there's a [type definition later in the file](#custom-stripe-subscription-type).
Your implementation will vary based on if you're doing subscriptions or one-time purchases. The example below is with subcriptions (again from [T3 Chat](https://t3.chat)).
```ts
// The contents of this function should probably be wrapped in a try/catch
export async function syncStripeDataToKV(customerId: string) {
// Fetch latest subscription data from Stripe
const subscriptions = await stripe.subscriptions.list({
customer: customerId,
limit: 1,
status: "all",
expand: ["data.default_payment_method"],
});
if (subscriptions.data.length === 0) {
const subData = { status: "none" };
await kv.set(`stripe:customer:${customerId}`, subData);
return subData;
}
// If a user can have multiple subscriptions, that's your problem
const subscription = subscriptions.data[0];
// Store complete subscription state
const subData = {
subscriptionId: subscription.id,
status: subscription.status,
priceId: subscription.items.data[0].price.id,
currentPeriodEnd: subscription.current_period_end,
currentPeriodStart: subscription.current_period_start,
cancelAtPeriodEnd: subscription.cancel_at_period_end,
paymentMethod:
subscription.default_payment_method &&
typeof subscription.default_payment_method !== "string"
? {
brand: subscription.default_payment_method.card?.brand ?? null,
last4: subscription.default_payment_method.card?.last4 ?? null,
}
: null,
};
// Store the data in your KV
await kv.set(`stripe:customer:${customerId}`, subData);
return subData;
}
```
### `/success` endpoint
> [!NOTE]
> While this isn't 'necessary', there's a good chance your user will make it back to your site before the webhooks do. It's a nasty race condition to handle. Eagerly calling syncStripeDataToKV will prevent any weird states you might otherwise end up in
This is the page that the user is redirected to after they complete their checkout. For the sake of simplicity, I'm going to implement it as a `get` route that redirects them. In my apps, I do this with a server component and Suspense, but I'm not going to spend the time explaining all that here.
```ts
export async function GET(req: Request) {
const user = auth(req);
const stripeCustomerId = await kv.get(`stripe:user:${user.id}`);
if (!stripeCustomerId) {
return redirect("/");
}
await syncStripeDataToKV(stripeCustomerId);
return redirect("/");
}
```
Notice how I'm not using any of the `CHECKOUT_SESSION_ID` stuff? That's because it sucks and it encourages you to implement 12 different ways to get the Stripe state. Ignore the siren calls. Have a SINGLE `syncStripeDataToKV` function. It will make your life easier.
### `/api/stripe` (The Webhook)
This is the part everyone hates the most. I'm just gonna dump the code and justify myself later.
```ts
export async function POST(req: Request) {
const body = await req.text();
const signature = (await headers()).get("Stripe-Signature");
if (!signature) return NextResponse.json({}, { status: 400 });
async function doEventProcessing() {
if (typeof signature !== "string") {
throw new Error("[STRIPE HOOK] Header isn't a string???");
}
const event = stripe.webhooks.constructEvent(
body,
signature,
process.env.STRIPE_WEBHOOK_SECRET!
);
waitUntil(processEvent(event));
}
const { error } = await tryCatch(doEventProcessing());
if (error) {
console.error("[STRIPE HOOK] Error processing event", error);
}
return NextResponse.json({ received: true });
}
```
> [!NOTE]
> If you are using Next.js Pages Router, make sure you turn this on. Stripe expects the body to be "untouched" so it can verify the signature.
>
> ```ts
> export const config = {
> api: {
> bodyParser: false,
> },
> };
> ```
### `processEvent`
This is the function called in the endpoint that actually takes the Stripe event and updates the KV.
```ts
async function processEvent(event: Stripe.Event) {
// Skip processing if the event isn't one I'm tracking (list of all events below)
if (!allowedEvents.includes(event.type)) return;
// All the events I track have a customerId
const { customer: customerId } = event?.data?.object as {
customer: string; // Sadly TypeScript does not know this
};
// This helps make it typesafe and also lets me know if my assumption is wrong
if (typeof customerId !== "string") {
throw new Error(
`[STRIPE HOOK][CANCER] ID isn't string.\nEvent type: ${event.type}`
);
}
return await syncStripeDataToKV(customerId);
}
```
### Events I Track
If there are more I should be tracking for updates, please file a PR. If they don't affect subscription state, I do not care.
```ts
const allowedEvents: Stripe.Event.Type[] = [
"checkout.session.completed",
"customer.subscription.created",
"customer.subscription.updated",
"customer.subscription.deleted",
"customer.subscription.paused",
"customer.subscription.resumed",
"customer.subscription.pending_update_applied",
"customer.subscription.pending_update_expired",
"customer.subscription.trial_will_end",
"invoice.paid",
"invoice.payment_failed",
"invoice.payment_action_required",
"invoice.upcoming",
"invoice.marked_uncollectible",
"invoice.payment_succeeded",
"payment_intent.succeeded",
"payment_intent.payment_failed",
"payment_intent.canceled",
];
```
### Custom Stripe subscription type
```ts
export type STRIPE_SUB_CACHE =
| {
subscriptionId: string | null;
status: Stripe.Subscription.Status;
priceId: string | null;
currentPeriodStart: number | null;
currentPeriodEnd: number | null;
cancelAtPeriodEnd: boolean;
paymentMethod: {
brand: string | null; // e.g., "visa", "mastercard"
last4: string | null; // e.g., "4242"
} | null;
}
| {
status: "none";
};
```
## More Pro Tips
Gonna slowly drop more things here as I remember them.
### DISABLE "CASH APP PAY".
I'm convinced this is literally just used by scammers. over 90% of my cancelled transactions are Cash App Pay.

### ENABLE "Limit customers to one subscription"
This is a really useful hidden setting that has saved me a lot of headaches and race conditions. Fun fact: this is the ONLY way to prevent someone from being able to check out twice if they open up two checkout sessions ๐ More info [in Stripe's docs here](https://docs.stripe.com/payments/checkout/limit-subscriptions)
## Things that are still your problem
While I have solved a lot of stuff here, in particular the "subscription" flows, there are a few things that are still your problem. Those include...
- Managing `STRIPE_SECRET_KEY` and `STRIPE_PUBLISHABLE_KEY` env vars for both testing and production
- Managing `STRIPE_PRICE_ID`s for all subscription tiers for dev and prod (I can't believe this is still a thing)
- Exposing sub data from your KV to your user (a dumb endpoint is probably fine)
- Tracking "usage" (i.e. a user gets 100 messages per month)
- Managing "free trials"
...the list goes on
Regardless, I hope you found some value in this doc. | {
"source": "t3dotgg/stripe-recommendations",
"title": "README.md",
"url": "https://github.com/t3dotgg/stripe-recommendations/blob/main/README.md",
"date": "2025-01-11T06:44:42",
"stars": 4113,
"description": "How to implement Stripe without going mad",
"file_size": 12142
} |
<!-- markdownlint-disable first-line-h1 -->
<!-- markdownlint-disable html -->
<!-- markdownlint-disable no-duplicate-header -->
<div align="center">
<img src="images/logo.svg" width="60%" alt="DeepSeek AI" />
</div>
<hr>
<div align="center">
<a href="https://www.deepseek.com/" target="_blank">
<img alt="Homepage" src="images/badge.svg" />
</a>
<a href="https://huggingface.co/spaces/deepseek-ai/deepseek-vl2-small" target="_blank">
<img alt="Chat" src="https://img.shields.io/badge/๐ค%20Chat-DeepSeek%20VL-536af5?color=536af5&logoColor=white" />
</a>
<a href="https://huggingface.co/deepseek-ai" target="_blank">
<img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DeepSeek%20AI-ffc107?color=ffc107&logoColor=white" />
</a>
</div>
<div align="center">
<a href="https://discord.gg/Tc7c45Zzu5" target="_blank">
<img alt="Discord" src="https://img.shields.io/badge/Discord-DeepSeek%20AI-7289da?logo=discord&logoColor=white&color=7289da" />
</a>
<a href="images/qr.jpeg" target="_blank">
<img alt="Wechat" src="https://img.shields.io/badge/WeChat-DeepSeek%20AI-brightgreen?logo=wechat&logoColor=white" />
</a>
<a href="https://twitter.com/deepseek_ai" target="_blank">
<img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-deepseek_ai-white?logo=x&logoColor=white" />
</a>
</div>
<div align="center">
<a href="LICENSE-CODE">
<img alt="Code License" src="https://img.shields.io/badge/Code_License-MIT-f5de53?&color=f5de53">
</a>
<a href="LICENSE-MODEL">
<img alt="Model License" src="https://img.shields.io/badge/Model_License-Model_Agreement-f5de53?&color=f5de53">
</a>
</div>
<p align="center">
<a href="https://github.com/deepseek-ai/DeepSeek-VL2/tree/main?tab=readme-ov-file#3-model-download"><b>๐ฅ Model Download</b></a> |
<a href="https://github.com/deepseek-ai/DeepSeek-VL2/tree/main?tab=readme-ov-file#4-quick-start"><b>โก Quick Start</b></a> |
<a href="https://github.com/deepseek-ai/DeepSeek-VL2/tree/main?tab=readme-ov-file#5-license"><b>๐ License</b></a> |
<a href="https://github.com/deepseek-ai/DeepSeek-VL2/tree/main?tab=readme-ov-file#6-citation"><b>๐ Citation</b></a> <br>
<a href="./DeepSeek_VL2_paper.pdf"><b>๐ Paper Link</b></a> |
<a href="https://arxiv.org/abs/2412.10302"><b>๐ Arxiv Paper Link</b></a> |
<a href="https://huggingface.co/spaces/deepseek-ai/deepseek-vl2-small"><b>๐๏ธ Demo</b></a>
</p>
## 1. Introduction
Introducing DeepSeek-VL2, an advanced series of large Mixture-of-Experts (MoE) Vision-Language Models that significantly improves upon its predecessor, DeepSeek-VL. DeepSeek-VL2 demonstrates superior capabilities across various tasks, including but not limited to visual question answering, optical character recognition, document/table/chart understanding, and visual grounding. Our model series is composed of three variants: DeepSeek-VL2-Tiny, DeepSeek-VL2-Small and DeepSeek-VL2, with 1.0B, 2.8B and 4.5B activated parameters respectively.
DeepSeek-VL2 achieves competitive or state-of-the-art performance with similar or fewer activated parameters compared to existing open-source dense and MoE-based models.
[DeepSeek-VL2: Mixture-of-Experts Vision-Language Models for Advanced Multimodal Understanding]()
Zhiyu Wu*, Xiaokang Chen*, Zizheng Pan*, Xingchao Liu*, Wen Liu**, Damai Dai, Huazuo Gao, Yiyang Ma, Chengyue Wu, Bingxuan Wang, Zhenda Xie, Yu Wu, Kai Hu, Jiawei Wang, Yaofeng Sun, Yukun Li, Yishi Piao, Kang Guan, Aixin Liu, Xin Xie, Yuxiang You, Kai Dong, Xingkai Yu, Haowei Zhang, Liang Zhao, Yisong Wang, Chong Ruan*** (* Equal Contribution, ** Project Lead, *** Corresponding author)

## 2. Release
โ
<b>2025-2-6</b>: Naive Implemented Gradio Demo on Huggingface Space [deepseek-vl2-small](https://huggingface.co/spaces/deepseek-ai/deepseek-vl2-small).
โ
<b>2024-12-25</b>: Gradio Demo Example, Incremental Prefilling and VLMEvalKit Support.
โ
<b>2024-12-13</b>: DeepSeek-VL2 family released, including <code>DeepSeek-VL2-tiny</code>, <code>DeepSeek-VL2-small</code>, <code>DeepSeek-VL2</code>.
## 3. Model Download
We release the DeepSeek-VL2 family, including <code>DeepSeek-VL2-tiny</code>, <code>DeepSeek-VL2-small</code>, <code>DeepSeek-VL2</code>.
To support a broader and more diverse range of research within both academic and commercial communities.
Please note that the use of this model is subject to the terms outlined in [License section](#5-license).
### Huggingface
| Model | Sequence Length | Download |
|--------------|-----------------|-----------------------------------------------------------------------------|
| DeepSeek-VL2-tiny | 4096 | [๐ค Hugging Face](https://huggingface.co/deepseek-ai/deepseek-vl2-tiny) |
| DeepSeek-VL2-small | 4096 | [๐ค Hugging Face](https://huggingface.co/deepseek-ai/deepseek-vl2-small) |
| DeepSeek-VL2 | 4096 | [๐ค Hugging Face](https://huggingface.co/deepseek-ai/deepseek-vl2) |
## 4. Quick Start
### Installation
On the basis of `Python >= 3.8` environment, install the necessary dependencies by running the following command:
```shell
pip install -e .
```
### Simple Inference Example with One Image
**Note: You may need 80GB GPU memory to run this script with deepseek-vl2-small and even larger for deepseek-vl2.**
```python
import torch
from transformers import AutoModelForCausalLM
from deepseek_vl2.models import DeepseekVLV2Processor, DeepseekVLV2ForCausalLM
from deepseek_vl2.utils.io import load_pil_images
# specify the path to the model
model_path = "deepseek-ai/deepseek-vl2-tiny"
vl_chat_processor: DeepseekVLV2Processor = DeepseekVLV2Processor.from_pretrained(model_path)
tokenizer = vl_chat_processor.tokenizer
vl_gpt: DeepseekVLV2ForCausalLM = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()
## single image conversation example
## Please note that <|ref|> and <|/ref|> are designed specifically for the object localization feature. These special tokens are not required for normal conversations.
## If you would like to experience the grounded captioning functionality (responses that include both object localization and reasoning), you need to add the special token <|grounding|> at the beginning of the prompt. Examples could be found in Figure 9 of our paper.
conversation = [
{
"role": "<|User|>",
"content": "<image>\n<|ref|>The giraffe at the back.<|/ref|>.",
"images": ["./images/visual_grounding_1.jpeg"],
},
{"role": "<|Assistant|>", "content": ""},
]
# load images and prepare for inputs
pil_images = load_pil_images(conversation)
prepare_inputs = vl_chat_processor(
conversations=conversation,
images=pil_images,
force_batchify=True,
system_prompt=""
).to(vl_gpt.device)
# run image encoder to get the image embeddings
inputs_embeds = vl_gpt.prepare_inputs_embeds(**prepare_inputs)
# run the model to get the response
outputs = vl_gpt.language.generate(
inputs_embeds=inputs_embeds,
attention_mask=prepare_inputs.attention_mask,
pad_token_id=tokenizer.eos_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id,
max_new_tokens=512,
do_sample=False,
use_cache=True
)
answer = tokenizer.decode(outputs[0].cpu().tolist(), skip_special_tokens=False)
print(f"{prepare_inputs['sft_format'][0]}", answer)
```
And the output is something like:
```
<|User|>: <image>
<|ref|>The giraffe at the back.<|/ref|>.
<|Assistant|>: <|ref|>The giraffe at the back.<|/ref|><|det|>[[580, 270, 999, 900]]<|/det|><๏ฝendโofโsentence๏ฝ>
```
### Simple Inference Example with Multiple Images
**Note: You may need 80GB GPU memory to run this script with deepseek-vl2-small and even larger for deepseek-vl2.**
```python
import torch
from transformers import AutoModelForCausalLM
from deepseek_vl2.models import DeepseekVLV2Processor, DeepseekVLV2ForCausalLM
from deepseek_vl2.utils.io import load_pil_images
# specify the path to the model
model_path = "deepseek-ai/deepseek-vl2-tiny"
vl_chat_processor: DeepseekVLV2Processor = DeepseekVLV2Processor.from_pretrained(model_path)
tokenizer = vl_chat_processor.tokenizer
vl_gpt: DeepseekVLV2ForCausalLM = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()
# multiple images/interleaved image-text
conversation = [
{
"role": "<|User|>",
"content": "This is image_1: <image>\n"
"This is image_2: <image>\n"
"This is image_3: <image>\n Can you tell me what are in the images?",
"images": [
"images/multi_image_1.jpeg",
"images/multi_image_2.jpeg",
"images/multi_image_3.jpeg",
],
},
{"role": "<|Assistant|>", "content": ""}
]
# load images and prepare for inputs
pil_images = load_pil_images(conversation)
prepare_inputs = vl_chat_processor(
conversations=conversation,
images=pil_images,
force_batchify=True,
system_prompt=""
).to(vl_gpt.device)
# run image encoder to get the image embeddings
inputs_embeds = vl_gpt.prepare_inputs_embeds(**prepare_inputs)
# run the model to get the response
outputs = vl_gpt.language.generate(
inputs_embeds=inputs_embeds,
attention_mask=prepare_inputs.attention_mask,
pad_token_id=tokenizer.eos_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id,
max_new_tokens=512,
do_sample=False,
use_cache=True
)
answer = tokenizer.decode(outputs[0].cpu().tolist(), skip_special_tokens=False)
print(f"{prepare_inputs['sft_format'][0]}", answer)
```
And the output is something like:
```
<|User|>: This is image_1: <image>
This is image_2: <image>
This is image_3: <image>
Can you tell me what are in the images?
<|Assistant|>: The images show three different types of vegetables. Image_1 features carrots, which are orange with green tops. Image_2 displays corn cobs, which are yellow with green husks. Image_3 contains raw pork ribs, which are pinkish-red with some marbling.<๏ฝendโofโsentence๏ฝ>
```
### Simple Inference Example with Incremental Prefilling
**Note: We use incremental prefilling to inference within 40GB GPU using deepseek-vl2-small.**
```python
import torch
from transformers import AutoModelForCausalLM
from deepseek_vl2.models import DeepseekVLV2Processor, DeepseekVLV2ForCausalLM
from deepseek_vl2.utils.io import load_pil_images
# specify the path to the model
model_path = "deepseek-ai/deepseek-vl2-small"
vl_chat_processor: DeepseekVLV2Processor = DeepseekVLV2Processor.from_pretrained(model_path)
tokenizer = vl_chat_processor.tokenizer
vl_gpt: DeepseekVLV2ForCausalLM = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
vl_gpt = vl_gpt.to(torch.bfloat16).cuda().eval()
# multiple images/interleaved image-text
conversation = [
{
"role": "<|User|>",
"content": "This is image_1: <image>\n"
"This is image_2: <image>\n"
"This is image_3: <image>\n Can you tell me what are in the images?",
"images": [
"images/multi_image_1.jpeg",
"images/multi_image_2.jpeg",
"images/multi_image_3.jpeg",
],
},
{"role": "<|Assistant|>", "content": ""}
]
# load images and prepare for inputs
pil_images = load_pil_images(conversation)
prepare_inputs = vl_chat_processor(
conversations=conversation,
images=pil_images,
force_batchify=True,
system_prompt=""
).to(vl_gpt.device)
with torch.no_grad():
# run image encoder to get the image embeddings
inputs_embeds = vl_gpt.prepare_inputs_embeds(**prepare_inputs)
# incremental_prefilling when using 40G GPU for vl2-small
inputs_embeds, past_key_values = vl_gpt.incremental_prefilling(
input_ids=prepare_inputs.input_ids,
images=prepare_inputs.images,
images_seq_mask=prepare_inputs.images_seq_mask,
images_spatial_crop=prepare_inputs.images_spatial_crop,
attention_mask=prepare_inputs.attention_mask,
chunk_size=512 # prefilling size
)
# run the model to get the response
outputs = vl_gpt.generate(
inputs_embeds=inputs_embeds,
input_ids=prepare_inputs.input_ids,
images=prepare_inputs.images,
images_seq_mask=prepare_inputs.images_seq_mask,
images_spatial_crop=prepare_inputs.images_spatial_crop,
attention_mask=prepare_inputs.attention_mask,
past_key_values=past_key_values,
pad_token_id=tokenizer.eos_token_id,
bos_token_id=tokenizer.bos_token_id,
eos_token_id=tokenizer.eos_token_id,
max_new_tokens=512,
do_sample=False,
use_cache=True,
)
answer = tokenizer.decode(outputs[0][len(prepare_inputs.input_ids[0]):].cpu().tolist(), skip_special_tokens=False)
print(f"{prepare_inputs['sft_format'][0]}", answer)
```
And the output is something like:
```
<|User|>: This is image_1: <image>
This is image_2: <image>
This is image_3: <image>
Can you tell me what are in the images?
<|Assistant|>: The first image contains carrots. The second image contains corn. The third image contains meat.<๏ฝendโofโsentence๏ฝ>
```
### Full Inference Example
```shell
# without incremental prefilling
CUDA_VISIBLE_DEVICES=0 python inference.py --model_path "deepseek-ai/deepseek-vl2"
# with incremental prefilling, when using 40G GPU for vl2-small
CUDA_VISIBLE_DEVICES=0 python inference.py --model_path "deepseek-ai/deepseek-vl2-small" --chunk_size 512
```
### Gradio Demo
* Install the necessary dependencies:
```shell
pip install -e .[gradio]
```
* then run the following command:
```shell
# vl2-tiny, 3.37B-MoE in total, activated 1B, can be run on a single GPU < 40GB
CUDA_VISIBLE_DEVICES=2 python web_demo.py \
--model_name "deepseek-ai/deepseek-vl2-tiny" \
--port 37914
# vl2-small, 16.1B-MoE in total, activated 2.4B
# If run on A100 40GB GPU, you need to set the `--chunk_size 512` for incremental prefilling for saving memory and it might be slow.
# If run on > 40GB GPU, you can ignore the `--chunk_size 512` for faster response.
CUDA_VISIBLE_DEVICES=2 python web_demo.py \
--model_name "deepseek-ai/deepseek-vl2-small" \
--port 37914 \
--chunk_size 512
# # vl27.5-MoE in total, activated 4.2B
CUDA_VISIBLE_DEVICES=2 python web_demo.py \
--model_name "deepseek-ai/deepseek-vl2" \
--port 37914
```
* **Important**: This is a basic and native demo implementation without any deployment optimizations, which may result in slower performance. For production environments, consider using optimized deployment solutions, such as vllm, sglang, lmdeploy, etc. These optimizations will help achieve faster response times and better cost efficiency.
## 5. License
This code repository is licensed under [MIT License](./LICENSE-CODE). The use of DeepSeek-VL2 models is subject to [DeepSeek Model License](./LICENSE-MODEL). DeepSeek-VL2 series supports commercial use.
## 6. Citation
```
@misc{wu2024deepseekvl2mixtureofexpertsvisionlanguagemodels,
title={DeepSeek-VL2: Mixture-of-Experts Vision-Language Models for Advanced Multimodal Understanding},
author={Zhiyu Wu and Xiaokang Chen and Zizheng Pan and Xingchao Liu and Wen Liu and Damai Dai and Huazuo Gao and Yiyang Ma and Chengyue Wu and Bingxuan Wang and Zhenda Xie and Yu Wu and Kai Hu and Jiawei Wang and Yaofeng Sun and Yukun Li and Yishi Piao and Kang Guan and Aixin Liu and Xin Xie and Yuxiang You and Kai Dong and Xingkai Yu and Haowei Zhang and Liang Zhao and Yisong Wang and Chong Ruan},
year={2024},
eprint={2412.10302},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2412.10302},
}
```
## 7. Contact
If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]). | {
"source": "deepseek-ai/DeepSeek-VL2",
"title": "README.md",
"url": "https://github.com/deepseek-ai/DeepSeek-VL2/blob/main/README.md",
"date": "2024-12-13T04:55:41",
"stars": 4036,
"description": "DeepSeek-VL2: Mixture-of-Experts Vision-Language Models for Advanced Multimodal Understanding",
"file_size": 16023
} |
<p align="center">
<img src="./assets/logo/็ฝๅบ.png" width="400" />
</p>
<p align="center">
<a href="https://map-yue.github.io/">Demo ๐ถ</a> | ๐ <a href="">Paper (coming soon)</a>
<br>
<a href="https://huggingface.co/m-a-p/YuE-s1-7B-anneal-en-cot">YuE-s1-7B-anneal-en-cot ๐ค</a> | <a href="https://huggingface.co/m-a-p/YuE-s1-7B-anneal-en-icl">YuE-s1-7B-anneal-en-icl ๐ค</a> | <a href="https://huggingface.co/m-a-p/YuE-s1-7B-anneal-jp-kr-cot">YuE-s1-7B-anneal-jp-kr-cot ๐ค</a>
<br>
<a href="https://huggingface.co/m-a-p/YuE-s1-7B-anneal-jp-kr-icl">YuE-s1-7B-anneal-jp-kr-icl ๐ค</a> | <a href="https://huggingface.co/m-a-p/YuE-s1-7B-anneal-zh-cot">YuE-s1-7B-anneal-zh-cot ๐ค</a> | <a href="https://huggingface.co/m-a-p/YuE-s1-7B-anneal-zh-icl">YuE-s1-7B-anneal-zh-icl ๐ค</a>
<br>
<a href="https://huggingface.co/m-a-p/YuE-s2-1B-general">YuE-s2-1B-general ๐ค</a> | <a href="https://huggingface.co/m-a-p/YuE-upsampler">YuE-upsampler ๐ค</a>
</p>
---
Our model's name is **YuE (ไน)**. In Chinese, the word means "music" and "happiness." Some of you may find words that start with Yu hard to pronounce. If so, you can just call it "yeah." We wrote a song with our model's name, see [here](assets/logo/yue.mp3).
YuE is a groundbreaking series of open-source foundation models designed for music generation, specifically for transforming lyrics into full songs (lyrics2song). It can generate a complete song, lasting several minutes, that includes both a catchy vocal track and accompaniment track. YuE is capable of modeling diverse genres/languages/vocal techniques. Please visit the [**Demo Page**](https://map-yue.github.io/) for amazing vocal performance.
## News and Updates
* ๐ Join Us on Discord! [](https://discord.gg/ssAyWMnMzu)
* **2025.02.17 ๐ซถ** Now YuE supports music continuation and Google Colab! See [YuE-extend by Mozer](https://github.com/Mozer/YuE-extend).
* **2025.02.07 ๐** Get YuE for Windows on [pinokio](https://pinokio.computer).
* **2025.01.30 ๐ฅ Inference Update**: We now support dual-track ICL mode! You can prompt the model with a reference song, and it will generate a new song in a similar style (voice cloning [demo by @abrakjamson](https://x.com/abrakjamson/status/1885932885406093538), music style transfer [demo by @cocktailpeanut](https://x.com/cocktailpeanut/status/1886456240156348674), etc.). Try it out! ๐ฅ๐ฅ๐ฅ P.S. Be sure to check out the demos firstโthey're truly impressive.
* **2025.01.30 ๐ฅ Announcement: A New Era Under Apache 2.0 ๐ฅ**: We are thrilled to announce that, in response to overwhelming requests from our community, **YuE** is now officially licensed under the **Apache 2.0** license. We sincerely hope this marks a watershed momentโakin to what Stable Diffusion and LLaMA have achieved in their respective fieldsโfor music generation and creative AI. ๐๐๐
* **2025.01.29 ๐**: We have updated the license description. we **ENCOURAGE** artists and content creators to sample and incorporate outputs generated by our model into their own works, and even monetize them. The only requirement is to credit our name: **YuE by HKUST/M-A-P** (alphabetic order).
* **2025.01.28 ๐ซถ**: Thanks to Fahd for creating a tutorial on how to quickly get started with YuE. Here is his [demonstration](https://www.youtube.com/watch?v=RSMNH9GitbA).
* **2025.01.26 ๐ฅ**: We have released the **YuE** series.
<br>
---
## TODOs๐
- [ ] Release paper to Arxiv.
- [ ] Example finetune code for enabling BPM control using ๐ค Transformers.
- [ ] Support stemgen mode https://github.com/multimodal-art-projection/YuE/issues/21
- [ ] Support llama.cpp https://github.com/ggerganov/llama.cpp/issues/11467
- [ ] Support transformers tensor parallel. https://github.com/multimodal-art-projection/YuE/issues/7
- [ ] Online serving on huggingface space.
- [ ] Support vLLM and sglang https://github.com/multimodal-art-projection/YuE/issues/66
- [x] Support Colab: [YuE-extend by Mozer](https://github.com/Mozer/YuE-extend)
- [x] Support gradio interface. https://github.com/multimodal-art-projection/YuE/issues/1
- [x] Support dual-track ICL mode.
- [x] Fix "instrumental" naming bug in output files. https://github.com/multimodal-art-projection/YuE/pull/26
- [x] Support seeding https://github.com/multimodal-art-projection/YuE/issues/20
- [x] Allow `--repetition_penalty` to customize repetition penalty. https://github.com/multimodal-art-projection/YuE/issues/45
---
## Hardware and Performance
### **GPU Memory**
YuE requires significant GPU memory for generating long sequences. Below are the recommended configurations:
- **For GPUs with 24GB memory or less**: Run **up to 2 sessions** to avoid out-of-memory (OOM) errors. Thanks to the community, there are [YuE-exllamav2](https://github.com/sgsdxzy/YuE-exllamav2) and [YuEGP](https://github.com/deepbeepmeep/YuEGP) for those with limited GPU resources. While both enhance generation speed and coherence, they may compromise musicality. (P.S. Better prompts & ICL help!)
- **For full song generation** (many sessions, e.g., 4 or more): Use **GPUs with at least 80GB memory**. i.e. H800, A100, or multiple RTX4090s with tensor parallel.
To customize the number of sessions, the interface allows you to specify the desired session count. By default, the model runs **2 sessions** (1 verse + 1 chorus) to avoid OOM issue.
### **Execution Time**
On an **H800 GPU**, generating 30s audio takes **150 seconds**.
On an **RTX 4090 GPU**, generating 30s audio takes approximately **360 seconds**.
---
## ๐ช Windows Users Quickstart
- For a **one-click installer**, use [Pinokio](https://pinokio.computer).
- To use **Gradio with Docker**, see: [YuE-for-Windows](https://github.com/sdbds/YuE-for-windows)
## ๐ง Linux/WSL Users Quickstart
For a **quick start**, watch this **video tutorial** by Fahd: [Watch here](https://www.youtube.com/watch?v=RSMNH9GitbA).
If you're new to **machine learning** or the **command line**, we highly recommend watching this video first.
To use a **GUI/Gradio** interface, check out:
- [YuE-exllamav2-UI](https://github.com/WrongProtocol/YuE-exllamav2-UI)
- [YuEGP](https://github.com/deepbeepmeep/YuEGP)
- [YuE-Interface](https://github.com/alisson-anjos/YuE-Interface)
### 1. Install environment and dependencies
Make sure properly install flash attention 2 to reduce VRAM usage.
```bash
# We recommend using conda to create a new environment.
conda create -n yue python=3.8 # Python >=3.8 is recommended.
conda activate yue
# install cuda >= 11.8
conda install pytorch torchvision torchaudio cudatoolkit=11.8 -c pytorch -c nvidia
pip install -r <(curl -sSL https://raw.githubusercontent.com/multimodal-art-projection/YuE/main/requirements.txt)
# For saving GPU memory, FlashAttention 2 is mandatory.
# Without it, long audio may lead to out-of-memory (OOM) errors.
# Be careful about matching the cuda version and flash-attn version
pip install flash-attn --no-build-isolation
```
### 2. Download the infer code and tokenizer
```bash
# Make sure you have git-lfs installed (https://git-lfs.com)
# if you don't have root, see https://github.com/git-lfs/git-lfs/issues/4134#issuecomment-1635204943
sudo apt update
sudo apt install git-lfs
git lfs install
git clone https://github.com/multimodal-art-projection/YuE.git
cd YuE/inference/
git clone https://huggingface.co/m-a-p/xcodec_mini_infer
```
### 3. Run the inference
Now generate music with **YuE** using ๐ค Transformers. Make sure your step [1](#1-install-environment-and-dependencies) and [2](#2-download-the-infer-code-and-tokenizer) are properly set up.
Note:
- Set `--run_n_segments` to the number of lyric sections if you want to generate a full song. Additionally, you can increase `--stage2_batch_size` based on your available GPU memory.
- You may customize the prompt in `genre.txt` and `lyrics.txt`. See prompt engineering guide [here](#prompt-engineering-guide).
- You can increase `--stage2_batch_size` to speed up the inference, but be careful for OOM.
- LM ckpts will be automatically downloaded from huggingface.
```bash
# This is the CoT mode.
cd YuE/inference/
python infer.py \
--cuda_idx 0 \
--stage1_model m-a-p/YuE-s1-7B-anneal-en-cot \
--stage2_model m-a-p/YuE-s2-1B-general \
--genre_txt ../prompt_egs/genre.txt \
--lyrics_txt ../prompt_egs/lyrics.txt \
--run_n_segments 2 \
--stage2_batch_size 4 \
--output_dir ../output \
--max_new_tokens 3000 \
--repetition_penalty 1.1
```
We also support music in-context-learning (provide a reference song), there are 2 types: single-track (mix/vocal/instrumental) and dual-track.
Note:
- ICL requires a different ckpt, e.g. `m-a-p/YuE-s1-7B-anneal-en-icl`.
- Music ICL generally requires a 30s audio segment. The model will write new songs with similar style of the provided audio, and may improve musicality.
- Dual-track ICL works better in general, requiring both vocal and instrumental tracks.
- For single-track ICL, you can provide a mix, vocal, or instrumental track.
- You can separate the vocal and instrumental tracks using [python-audio-separator](https://github.com/nomadkaraoke/python-audio-separator) or [Ultimate Vocal Remover GUI](https://github.com/Anjok07/ultimatevocalremovergui).
```bash
# This is the dual-track ICL mode.
# To turn on dual-track mode, enable `--use_dual_tracks_prompt`
# and provide `--vocal_track_prompt_path`, `--instrumental_track_prompt_path`,
# `--prompt_start_time`, and `--prompt_end_time`
# The ref audio is taken from GTZAN test set.
cd YuE/inference/
python infer.py \
--cuda_idx 0 \
--stage1_model m-a-p/YuE-s1-7B-anneal-en-icl \
--stage2_model m-a-p/YuE-s2-1B-general \
--genre_txt ../prompt_egs/genre.txt \
--lyrics_txt ../prompt_egs/lyrics.txt \
--run_n_segments 2 \
--stage2_batch_size 4 \
--output_dir ../output \
--max_new_tokens 3000 \
--repetition_penalty 1.1 \
--use_dual_tracks_prompt \
--vocal_track_prompt_path ../prompt_egs/pop.00001.Vocals.mp3 \
--instrumental_track_prompt_path ../prompt_egs/pop.00001.Instrumental.mp3 \
--prompt_start_time 0 \
--prompt_end_time 30
```
```bash
# This is the single-track (mix/vocal/instrumental) ICL mode.
# To turn on single-track ICL, enable `--use_audio_prompt`,
# and provide `--audio_prompt_path` , `--prompt_start_time`, and `--prompt_end_time`.
# The ref audio is taken from GTZAN test set.
cd YuE/inference/
python infer.py \
--cuda_idx 0 \
--stage1_model m-a-p/YuE-s1-7B-anneal-en-icl \
--stage2_model m-a-p/YuE-s2-1B-general \
--genre_txt ../prompt_egs/genre.txt \
--lyrics_txt ../prompt_egs/lyrics.txt \
--run_n_segments 2 \
--stage2_batch_size 4 \
--output_dir ../output \
--max_new_tokens 3000 \
--repetition_penalty 1.1 \
--use_audio_prompt \
--audio_prompt_path ../prompt_egs/pop.00001.mp3 \
--prompt_start_time 0 \
--prompt_end_time 30
```
---
## Prompt Engineering Guide
The prompt consists of three parts: genre tags, lyrics, and ref audio.
### Genre Tagging Prompt
1. An example genre tagging prompt can be found [here](prompt_egs/genre.txt).
2. A stable tagging prompt usually consists of five components: genre, instrument, mood, gender, and timbre. All five should be included if possible, separated by space (space delimiter).
3. Although our tags have an open vocabulary, we have provided the top 200 most commonly used [tags](./top_200_tags.json). It is recommended to select tags from this list for more stable results.
3. The order of the tags is flexible. For example, a stable genre tagging prompt might look like: "inspiring female uplifting pop airy vocal electronic bright vocal vocal."
4. Additionally, we have introduced the "Mandarin" and "Cantonese" tags to distinguish between Mandarin and Cantonese, as their lyrics often share similarities.
### Lyrics Prompt
1. An example lyric prompt can be found [here](prompt_egs/lyrics.txt).
2. We support multiple languages, including but not limited to English, Mandarin Chinese, Cantonese, Japanese, and Korean. The default top language distribution during the annealing phase is revealed in [issue 12](https://github.com/multimodal-art-projection/YuE/issues/12#issuecomment-2620845772). A language ID on a specific annealing checkpoint indicates that we have adjusted the mixing ratio to enhance support for that language.
3. The lyrics prompt should be divided into sessions, with structure labels (e.g., [verse], [chorus], [bridge], [outro]) prepended. Each session should be separated by 2 newline character "\n\n".
4. **DONOT** put too many words in a single segment, since each session is around 30s (`--max_new_tokens 3000` by default).
5. We find that [intro] label is less stable, so we recommend starting with [verse] or [chorus].
6. For generating music with no vocal (instrumental only), see [issue 18](https://github.com/multimodal-art-projection/YuE/issues/18).
### Audio Prompt
1. Audio prompt is optional. Providing ref audio for ICL usually increase the good case rate, and result in less diversity since the generated token space is bounded by the ref audio. CoT only (no ref) will result in a more diverse output.
2. We find that dual-track ICL mode gives the best musicality and prompt following.
3. Use the chorus part of the music as prompt will result in better musicality.
4. Around 30s audio is recommended for ICL.
5. For music continuation, see [YuE-extend by Mozer](https://github.com/Mozer/YuE-extend). Also supports Colab.
---
## License Agreement \& Disclaimer
- The YuE model (including its weights) is now released under the **Apache License, Version 2.0**. We do not make any profit from this model, and we hope it can be used for the betterment of human creativity.
- **Use & Attribution**:
- We encourage artists and content creators to freely incorporate outputs generated by YuE into their own works, including commercial projects.
- We encourage attribution to the modelโs name (โYuE by HKUST/M-A-Pโ), especially for public and commercial use.
- **Originality & Plagiarism**: It is the sole responsibility of creators to ensure that their works, derived from or inspired by YuE outputs, do not plagiarize or unlawfully reproduce existing material. We strongly urge users to perform their own due diligence to avoid copyright infringement or other legal violations.
- **Recommended Labeling**: When uploading works to streaming platforms or sharing them publicly, we **recommend** labeling them with terms such as: โAI-generatedโ, โYuE-generated", โAI-assistedโ or โAI-auxiliatedโ. This helps maintain transparency about the creative process.
- **Disclaimer of Liability**:
- We do not assume any responsibility for the misuse of this model, including (but not limited to) illegal, malicious, or unethical activities.
- Users are solely responsible for any content generated using the YuE model and for any consequences arising from its use.
- By using this model, you agree that you understand and comply with all applicable laws and regulations regarding your generated content.
---
## Acknowledgements
The project is co-lead by HKUST and M-A-P (alphabetic order). Also thanks moonshot.ai, bytedance, 01.ai, and geely for supporting the project.
A friendly link to HKUST Audio group's [huggingface space](https://huggingface.co/HKUSTAudio).
We deeply appreciate all the support we received along the way. Long live open-source AI!
---
## Citation
If you find our paper and code useful in your research, please consider giving a star :star: and citation :pencil: :)
```BibTeX
@misc{yuan2025yue,
title={YuE: Open Music Foundation Models for Full-Song Generation},
author={Ruibin Yuan and Hanfeng Lin and Shawn Guo and Ge Zhang and Jiahao Pan and Yongyi Zang and Haohe Liu and Xingjian Du and Xeron Du and Zhen Ye and Tianyu Zheng and Yinghao Ma and Minghao Liu and Lijun Yu and Zeyue Tian and Ziya Zhou and Liumeng Xue and Xingwei Qu and Yizhi Li and Tianhao Shen and Ziyang Ma and Shangda Wu and Jun Zhan and Chunhui Wang and Yatian Wang and Xiaohuan Zhou and Xiaowei Chi and Xinyue Zhang and Zhenzhu Yang and Yiming Liang and Xiangzhou Wang and Shansong Liu and Lingrui Mei and Peng Li and Yong Chen and Chenghua Lin and Xie Chen and Gus Xia and Zhaoxiang Zhang and Chao Zhang and Wenhu Chen and Xinyu Zhou and Xipeng Qiu and Roger Dannenberg and Jiaheng Liu and Jian Yang and Stephen Huang and Wei Xue and Xu Tan and Yike Guo},
howpublished={\url{https://github.com/multimodal-art-projection/YuE}},
year={2025},
note={GitHub repository}
}
```
<br> | {
"source": "multimodal-art-projection/YuE",
"title": "README.md",
"url": "https://github.com/multimodal-art-projection/YuE/blob/main/README.md",
"date": "2025-01-23T06:21:58",
"stars": 4018,
"description": "YuE: Open Full-song Music Generation Foundation Model, something similar to Suno.ai but open",
"file_size": 16736
} |
# Open Canvas
[TRY IT OUT HERE](https://opencanvas.langchain.com/)

Open Canvas is an open source web application for collaborating with agents to better write documents. It is inspired by [OpenAI's "Canvas"](https://openai.com/index/introducing-canvas/), but with a few key differences.
1. **Open Source**: All the code, from the frontend, to the content generation agent, to the reflection agent is open source and MIT licensed.
2. **Built in memory**: Open Canvas ships out of the box with a [reflection agent](https://langchain-ai.github.io/langgraphjs/tutorials/reflection/reflection/) which stores style rules and user insights in a [shared memory store](https://langchain-ai.github.io/langgraphjs/concepts/memory/). This allows Open Canvas to remember facts about you across sessions.
3. **Start from existing documents**: Open Canvas allows users to start with a blank text, or code editor in the language of their choice, allowing you to start the session with your existing content, instead of being forced to start with a chat interaction. We believe this is an ideal UX because many times you will already have some content to start with, and want to iterate on-top of it.
## Features
- **Memory**: Open Canvas has a built in memory system which will automatically generate reflections and memories on you, and your chat history. These are then included in subsequent chat interactions to give a more personalized experience.
- **Custom quick actions**: Custom quick actions allow you to define your own prompts which are tied to your user, and persist across sessions. These then can be easily invoked through a single click, and apply to the artifact you're currently viewing.
- **Pre-built quick actions**: There are also a series of pre-built quick actions for common writing and coding tasks that are always available.
- **Artifact versioning**: All artifacts have a "version" tied to them, allowing you to travel back in time and see previous versions of your artifact.
- **Code, Markdown, or both**: The artifact view allows for viewing and editing both code, and markdown. You can even have chats which generate code, and markdown artifacts, and switch between them.
- **Live markdown rendering & editing**: Open Canvas's markdown editor allows you to view the rendered markdown while you're editing, without having to toggle back and fourth.
## Setup locally
This guide will cover how to setup and run Open Canvas locally. If you prefer a YouTube video guide, check out [this video](https://youtu.be/sBzcQYPMekc).
### Prerequisites
Open Canvas requires the following API keys and external services:
#### Package Manager
- [Yarn](https://yarnpkg.com/)
#### APIs
- [OpenAI API key](https://platform.openai.com/signup/)
- [Anthropic API key](https://console.anthropic.com/)
- (optional) [Google GenAI API key](https://aistudio.google.com/apikey)
- (optional) [Fireworks AI API key](https://fireworks.ai/login)
- (optional) [Groq AI API key](https://groq.com) - audio/video transcription
- (optional) [FireCrawl API key](https://firecrawl.dev) - web scraping
- (optional) [ExaSearch API key](https://exa.ai) - web search
#### Authentication
- [Supabase](https://supabase.com/) account for authentication
#### LangGraph Server
- [LangGraph CLI](https://langchain-ai.github.io/langgraph/cloud/reference/cli/) for running the graph locally
#### LangSmith
- [LangSmith](https://smith.langchain.com/) for tracing & observability
### Installation
First, clone the repository:
```bash
git clone https://github.com/langchain-ai/open-canvas.git
cd open-canvas
```
Next, install the dependencies:
```bash
yarn install
```
After installing dependencies, copy the `.env.example` files in `apps/web` and `apps/agents` contents into `.env` and set the required values:
```bash
cd apps/web/
cp .env.example .env
```
```bash
cd apps/agents/
cp .env.example .env
```
Then, setup authentication with Supabase.
### Setup Authentication
After creating a Supabase account, visit your [dashboard](https://supabase.com/dashboard/projects) and create a new project.
Next, navigate to the `Project Settings` page inside your project, and then to the `API` tag. Copy the `Project URL`, and `anon public` project API key. Paste them into the `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` environment variables in the `.env` file.
After this, navigate to the `Authentication` page, and the `Providers` tab. Make sure `Email` is enabled (also ensure you've enabled `Confirm Email`). You may also enable `GitHub`, and/or `Google` if you'd like to use those for authentication. (see these pages for documentation on how to setup each provider: [GitHub](https://supabase.com/docs/guides/auth/social-login/auth-github), [Google](https://supabase.com/docs/guides/auth/social-login/auth-google))
#### Test authentication
To verify authentication works, run `yarn dev` and visit [localhost:3000](http://localhost:3000). This should redirect you to the [login page](http://localhost:3000/auth/login). From here, you can either login with Google or GitHub, or if you did not configure these providers, navigate to the [signup page](http://localhost:3000/auth/signup) and create a new account with an email and password. This should then redirect you to a conformation page, and after confirming your email you should be redirected to the [home page](http://localhost:3000).
### Setup LangGraph Server
The first step to running Open Canvas locally is to build the application. This is because Open Canvas uses a monorepo setup, and requires workspace dependencies to be build so other packages/apps can access them.
Run the following command from the root of the repository:
```bash
yarn build
```
Now we'll cover how to setup and run the LangGraph server locally.
Navigate to `apps/agents` and run `yarn dev` (this runs `npx @langchain/langgraph-cli dev --port 54367`).
```
Ready!
- ๐ API: http://localhost:54367
- ๐จ Studio UI: https://smith.langchain.com/studio?baseUrl=http://localhost:54367
```
After your LangGraph server is running, execute the following command inside `apps/web` to start the Open Canvas frontend:
```bash
yarn dev
```
On initial load, compilation may take a little bit of time.
Then, open [localhost:3000](http://localhost:3000) with your browser and start interacting!
## LLM Models
Open Canvas is designed to be compatible with any LLM model. The current deployment has the following models configured:
- **Anthropic Claude 3 Haiku ๐ค**: Haiku is Anthropic's fastest model, great for quick tasks like making edits to your document. Sign up for an Anthropic account [here](https://console.anthropic.com/).
- **Fireworks Llama 3 70B ๐ฆ**: Llama 3 is a SOTA open source model from Meta, powered by [Fireworks AI](https://fireworks.ai/). You can sign up for an account [here](https://fireworks.ai/login).
- **OpenAI GPT 4o Mini ๐จ**: GPT 4o Mini is OpenAI's newest, smallest model. You can sign up for an API key [here](https://platform.openai.com/signup/).
If you'd like to add a new model, follow these simple steps:
1. Add to or update the model provider variables in `packages/shared/src/models.ts`.
2. Install the necessary package for the provider (e.g. `@langchain/anthropic`) inside `apps/agents`.
3. Update the `getModelConfig` function in `apps/agents/src/agent/utils.ts` to include an `if` statement for your new model name and provider.
4. Manually test by checking you can:
> - 4a. Generate a new artifact
> - 4b. Generate a followup message (happens automatically after generating an artifact)
> - 4c. Update an artifact via a message in chat
> - 4d. Update an artifact via a quick action
> - 4e. Repeat for text/code (ensure both work)
### Local Ollama models
Open Canvas supports calling local LLMs running on Ollama. This is not enabled in the hosted version of Open Canvas, but you can use this in your own local/deployed Open Canvas instance.
To use a local Ollama model, first ensure you have [Ollama](https://ollama.com) installed, and a model that supports tool calling pulled (the default model is `llama3.3`).
Next, start the Ollama server by running `ollama run llama3.3`.
Then, set the `NEXT_PUBLIC_OLLAMA_ENABLED` environment variable to `true`, and the `OLLAMA_API_URL` environment variable to the URL of your Ollama server (defaults to `http://host.docker.internal:11434`. If you do not set a custom port when starting your Ollama server, you should not need to set this environment variable).
> [!NOTE]
> Open source LLMs are typically not as good at instruction following as proprietary models like GPT-4o or Claude Sonnet. Because of this, you may experience errors or unexpected behavior when using local LLMs.
## Troubleshooting
Below are some common issues you may run into if running Open Canvas yourself:
- **I have the LangGraph server running successfully, and my client can make requests, but no text is being generated:** This can happen if you start & connect to multiple different LangGraph servers locally in the same browser. Try clearing the `oc_thread_id_v2` cookie and refreshing the page. This is because each unique LangGraph server has its own database where threads are stored, so a thread ID from one server will not be found in the database of another server.
- **I'm getting 500 network errors when I try to make requests on the client:** Ensure you have the LangGraph server running, and you're making requests to the correct port. You can specify the port to use by passing the `--port <PORT>` flag to the `npx @langchain/langgraph-cli dev` command, and you can set the URL to make requests to by either setting the `LANGGRAPH_API_URL` environment variable, or by changing the fallback value of the `LANGGRAPH_API_URL` variable in `constants.ts`.
- **I'm getting "thread ID not found" error toasts when I try to make requests on the client:** Ensure you have the LangGraph server running, and you're making requests to the correct port. You can specify the port to use by passing the `--port <PORT>` flag to the `npx @langchain/langgraph-cli dev` command, and you can set the URL to make requests to by either setting the `LANGGRAPH_API_URL` environment variable, or by changing the fallback value of the `LANGGRAPH_API_URL` variable in `constants.ts`.
- **`Model name is missing in config.` error is being thrown when I make requests:** This error occurs when the `customModelName` is not specified in the config. You can resolve this by setting the `customModelName` field inside `config.configurable` to the name of the model you want to use when invoking the graph. See [this doc](https://langchain-ai.github.io/langgraphjs/how-tos/configuration/) on how to use configurable fields in LangGraph.
## Roadmap
### Features
Below is a list of features we'd like to add to Open Canvas in the near future:
- **Render React in the editor**: Ideally, if you have Open Canvas generate React (or HTML) code, we should be able to render it live in the editor. **Edit**: This is in the planning stage now!
- **Multiple assistants**: Users should be able to create multiple assistants, each having their own memory store.
- **Give assistants custom 'tools'**: Once we've implemented `RemoteGraph` in LangGraph.js, users should be able to give assistants access to call their own graphs as tools. This means you could customize your assistant to have access to current events, your own personal knowledge graph, etc.
Do you have a feature request? Please [open an issue](https://github.com/langchain-ai/open-canvas/issues/new)!
### Contributing
We'd like to continue developing and improving Open Canvas, and want your help!
To start, there are a handful of GitHub issues with feature requests outlining improvements and additions to make the app's UX even better.
There are three main labels:
- `frontend`: This label is added to issues which are UI focused, and do not require much if any work on the agent(s).
- `ai`: This label is added to issues which are focused on improving the LLM agent(s).
- `fullstack`: This label is added to issues which require touching both the frontend and agent code.
If you have questions about contributing, please reach out to me via email: `brace(at)langchain(dot)dev`. For general bugs/issues with the code, please [open an issue on GitHub](https://github.com/langchain-ai/open-canvas/issues/new). | {
"source": "langchain-ai/open-canvas",
"title": "README.md",
"url": "https://github.com/langchain-ai/open-canvas/blob/main/README.md",
"date": "2024-10-03T19:53:14",
"stars": 3978,
"description": "๐ A better UX for chat, writing content, and coding with LLMs.",
"file_size": 12432
} |
# Open Canvas
[TRY IT OUT HERE](https://opencanvas.langchain.com/)

Open Canvas is an open source web application for collaborating with agents to better write documents. It is inspired by [OpenAI's "Canvas"](https://openai.com/index/introducing-canvas/), but with a few key differences.
1. **Open Source**: All the code, from the frontend, to the content generation agent, to the reflection agent is open source and MIT licensed.
2. **Built in memory**: Open Canvas ships out of the box with a [reflection agent](https://langchain-ai.github.io/langgraphjs/tutorials/reflection/reflection/) which stores style rules and user insights in a [shared memory store](https://langchain-ai.github.io/langgraphjs/concepts/memory/). This allows Open Canvas to remember facts about you across sessions.
3. **Start from existing documents**: Open Canvas allows users to start with a blank text, or code editor in the language of their choice, allowing you to start the session with your existing content, instead of being forced to start with a chat interaction. We believe this is an ideal UX because many times you will already have some content to start with, and want to iterate on-top of it.
## Features
- **Memory**: Open Canvas has a built in memory system which will automatically generate reflections and memories on you, and your chat history. These are then included in subsequent chat interactions to give a more personalized experience.
- **Custom quick actions**: Custom quick actions allow you to define your own prompts which are tied to your user, and persist across sessions. These then can be easily invoked through a single click, and apply to the artifact you're currently viewing.
- **Pre-built quick actions**: There are also a series of pre-built quick actions for common writing and coding tasks that are always available.
- **Artifact versioning**: All artifacts have a "version" tied to them, allowing you to travel back in time and see previous versions of your artifact.
- **Code, Markdown, or both**: The artifact view allows for viewing and editing both code, and markdown. You can even have chats which generate code, and markdown artifacts, and switch between them.
- **Live markdown rendering & editing**: Open Canvas's markdown editor allows you to view the rendered markdown while you're editing, without having to toggle back and fourth.
## Setup locally
This guide will cover how to setup and run Open Canvas locally. If you prefer a YouTube video guide, check out [this video](https://youtu.be/sBzcQYPMekc).
### Prerequisites
Open Canvas requires the following API keys and external services:
#### Package Manager
- [Yarn](https://yarnpkg.com/)
#### LLM APIs
- [OpenAI API key](https://platform.openai.com/signup/)
- [Anthropic API key](https://console.anthropic.com/)
- (optional) [Google GenAI API key](https://aistudio.google.com/apikey)
- (optional) [Fireworks AI API key](https://fireworks.ai/login)
#### Authentication
- [Supabase](https://supabase.com/) account for authentication
#### LangGraph Server
- [LangGraph CLI](https://langchain-ai.github.io/langgraph/cloud/reference/cli/) for running the graph locally
#### LangSmith
- [LangSmith](https://smith.langchain.com/) for tracing & observability
### Installation
First, clone the repository:
```bash
git clone https://github.com/langchain-ai/open-canvas.git
cd open-canvas
```
Next, install the dependencies:
```bash
yarn install
```
After installing dependencies, copy the `.env.example` file contents into `.env` and set the required values:
```bash
cp .env.example .env
```
Then, setup authentication with Supabase.
### Setup Authentication
After creating a Supabase account, visit your [dashboard](https://supabase.com/dashboard/projects) and create a new project.
Next, navigate to the `Project Settings` page inside your project, and then to the `API` tag. Copy the `Project URL`, and `anon public` project API key. Paste them into the `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_ANON_KEY` environment variables in the `.env` file.
After this, navigate to the `Authentication` page, and the `Providers` tab. Make sure `Email` is enabled (also ensure you've enabled `Confirm Email`). You may also enable `GitHub`, and/or `Google` if you'd like to use those for authentication. (see these pages for documentation on how to setup each provider: [GitHub](https://supabase.com/docs/guides/auth/social-login/auth-github), [Google](https://supabase.com/docs/guides/auth/social-login/auth-google))
#### Test authentication
To verify authentication works, run `yarn dev` and visit [localhost:3000](http://localhost:3000). This should redirect you to the [login page](http://localhost:3000/auth/login). From here, you can either login with Google or GitHub, or if you did not configure these providers, navigate to the [signup page](http://localhost:3000/auth/signup) and create a new account with an email and password. This should then redirect you to a conformation page, and after confirming your email you should be redirected to the [home page](http://localhost:3000).
### Setup LangGraph Server
Now we'll cover how to setup and run the LangGraph server locally.
Follow the [`Installation` instructions in the LangGraph docs](https://langchain-ai.github.io/langgraph/cloud/reference/cli/#installation) to install the LangGraph CLI.
Once installed, navigate to the root of the Open Canvas repo and run `yarn dev:server` (this runs `npx @langchain/langgraph-cli dev --port 54367`).
Once it finishes pulling the docker image and installing dependencies, you should see it log:
```
Ready!
- ๐ API: http://localhost:54367
- ๐จ Studio UI: https://smith.langchain.com/studio?baseUrl=http://localhost:54367
```
After your LangGraph server is running, execute the following command to start the Open Canvas app:
```bash
yarn dev
```
On initial load, compilation may take a little bit of time.
Then, open [localhost:3000](http://localhost:3000) with your browser and start interacting!
## LLM Models
Open Canvas is designed to be compatible with any LLM model. The current deployment has the following models configured:
- **Anthropic Claude 3 Haiku ๐ค**: Haiku is Anthropic's fastest model, great for quick tasks like making edits to your document. Sign up for an Anthropic account [here](https://console.anthropic.com/).
- **Fireworks Llama 3 70B ๐ฆ**: Llama 3 is a SOTA open source model from Meta, powered by [Fireworks AI](https://fireworks.ai/). You can sign up for an account [here](https://fireworks.ai/login).
- **OpenAI GPT 4o Mini ๐จ**: GPT 4o Mini is OpenAI's newest, smallest model. You can sign up for an API key [here](https://platform.openai.com/signup/).
If you'd like to add a new model, follow these simple steps:
1. Add to or update the model provider variables in `constants.ts`.
2. Install the necessary package for the provider (e.g. `@langchain/anthropic`).
3. Update the `getModelConfig` function in `src/agent/utils.ts` to include an `if` statement for your new model name and provider.
4. Manually test by checking you can:
> - 4a. Generate a new artifact
> - 4b. Generate a followup message (happens automatically after generating an artifact)
> - 4c. Update an artifact via a message in chat
> - 4d. Update an artifact via a quick action
> - 4e. Repeat for text/code (ensure both work)
### Local Ollama models
Open Canvas supports calling local LLMs running on Ollama. This is not enabled in the hosted version of Open Canvas, but you can use this in your own local/deployed Open Canvas instance.
To use a local Ollama model, first ensure you have [Ollama](https://ollama.com) installed, and a model that supports tool calling pulled (the default model is `llama3.3`).
Next, start the Ollama server by running `ollama run llama3.3`.
Then, set the `NEXT_PUBLIC_OLLAMA_ENABLED` environment variable to `true`, and the `OLLAMA_API_URL` environment variable to the URL of your Ollama server (defaults to `http://host.docker.internal:11434`. If you do not set a custom port when starting your Ollama server, you should not need to set this environment variable).
> [!NOTE]
> Open source LLMs are typically not as good at instruction following as proprietary models like GPT-4o or Claude Sonnet. Because of this, you may experience errors or unexpected behavior when using local LLMs.
## Troubleshooting
Below are some common issues you may run into if running Open Canvas yourself:
- **I have the LangGraph server running successfully, and my client can make requests, but no text is being generated:** This can happen if you start & connect to multiple different LangGraph servers locally in the same browser. Try clearing the `oc_thread_id_v2` cookie and refreshing the page. This is because each unique LangGraph server has its own database where threads are stored, so a thread ID from one server will not be found in the database of another server.
- **I'm getting 500 network errors when I try to make requests on the client:** Ensure you have the LangGraph server running, and you're making requests to the correct port. You can specify the port to use by passing the `--port <PORT>` flag to the `npx @langchain/langgraph-cli dev` command, and you can set the URL to make requests to by either setting the `LANGGRAPH_API_URL` environment variable, or by changing the fallback value of the `LANGGRAPH_API_URL` variable in `constants.ts`.
- **I'm getting "thread ID not found" error toasts when I try to make requests on the client:** Ensure you have the LangGraph server running, and you're making requests to the correct port. You can specify the port to use by passing the `--port <PORT>` flag to the `npx @langchain/langgraph-cli dev` command, and you can set the URL to make requests to by either setting the `LANGGRAPH_API_URL` environment variable, or by changing the fallback value of the `LANGGRAPH_API_URL` variable in `constants.ts`.
- **`Model name is missing in config.` error is being thrown when I make requests:** This error occurs when the `customModelName` is not specified in the config. You can resolve this by setting the `customModelName` field inside `config.configurable` to the name of the model you want to use when invoking the graph. See [this doc](https://langchain-ai.github.io/langgraphjs/how-tos/configuration/) on how to use configurable fields in LangGraph.
## Roadmap
### Features
Below is a list of features we'd like to add to Open Canvas in the near future:
- **Render React in the editor**: Ideally, if you have Open Canvas generate React (or HTML) code, we should be able to render it live in the editor. **Edit**: This is in the planning stage now!
- **Multiple assistants**: Users should be able to create multiple assistants, each having their own memory store.
- **Give assistants custom 'tools'**: Once we've implemented `RemoteGraph` in LangGraph.js, users should be able to give assistants access to call their own graphs as tools. This means you could customize your assistant to have access to current events, your own personal knowledge graph, etc.
Do you have a feature request? Please [open an issue](https://github.com/langchain-ai/open-canvas/issues/new)!
### Contributing
We'd like to continue developing and improving Open Canvas, and want your help!
To start, there are a handful of GitHub issues with feature requests outlining improvements and additions to make the app's UX even better.
There are three main labels:
- `frontend`: This label is added to issues which are UI focused, and do not require much if any work on the agent(s).
- `ai`: This label is added to issues which are focused on improving the LLM agent(s).
- `fullstack`: This label is added to issues which require touching both the frontend and agent code.
If you have questions about contributing, please reach out to me via email: `brace(at)langchain(dot)dev`. For general bugs/issues with the code, please [open an issue on GitHub](https://github.com/langchain-ai/open-canvas/issues/new). | {
"source": "langchain-ai/open-canvas",
"title": "apps/web/README.md",
"url": "https://github.com/langchain-ai/open-canvas/blob/main/apps/web/README.md",
"date": "2024-10-03T19:53:14",
"stars": 3978,
"description": "๐ A better UX for chat, writing content, and coding with LLMs.",
"file_size": 12064
} |
# Miku Miku Beam ๐ฅโก (Network Stresser)
A fun and visually appealing stress testing server with a **Miku-themed** frontend, where you can configure and run attacks while enjoying a banger song in the background! ๐คโจ

## Features ๐
- ๐ณ **Docker Ready**: MMB is ready to be built and run in a Docker container.
- ๐ **Real-time Attack Visualization**: View your attackโs progress and statistics in real-time as it runs. ๐ฅ
- ๐ถ **Miku-themed UI**: A cute and vibrant design with Mikuโs vibe to make the process more fun. Includes a banger song to keep you pumped! ๐ง
- ๐งโ๐ป **Configurable Attack Parameters**: Easily set the attack method, packet size, duration, and packet delay via the frontend interface.
- ๐ ๏ธ **Worker-Based Attack Handling**: The server processes attacks in separate workers for optimal performance and scalability.
- ๐ **Live Stats**: Track the success and failure of each attack in real-time. See how many packets are sent and whether they succeed or fail.
- ๐ผ๏ธ **Aesthetic Design**: A visually cute interface to make your experience enjoyable. ๐ธ
- ๐ก **Attack Methods:**:
- `HTTP Flood` - Send random HTTP requests
- `HTTP Bypass` - Send HTTP requests that mimics real requests (Redirects, cookies, headers, resources...)
- `HTTP Slowloris` - Send HTTP requests and keep the connection open
- `Minecraft Ping` - Send Minecraft ping/motd requests
- `TCP Flood` - Send random TCP packets
## Setup ๐ ๏ธ
### Prerequisites ๐ฆ
Make sure you have the following installed:
- Node.js (v14 or above) ๐ฑ
- npm (Node Package Manager) ๐ฆ
### Development Mode ๐ง
1. Clone this repository:
```bash
git clone https://github.com/sammwyy/mikumikubeam.git
cd mikumikubeam
```
2. Install the required dependencies:
```bash
npm install
```
3. Create the necessary files:
- `data/proxies.txt` - List of proxies.
- `data/uas.txt` - List of user agents.
4. Run the server in development mode:
```bash
npm run dev
```
- The **frontend** runs on `http://localhost:5173`.
- The **backend** runs on `http://localhost:3000`.
---
### Production Mode ๐ฅ
1. Clone the repository and navigate to the project directory:
```bash
git clone https://github.com/sammwyy/mikumikubeam.git
cd mikumikubeam
```
2. Install the dependencies:
```bash
npm install
```
3. Build the project:
```bash
npm run build
```
4. Start the server in production mode:
```bash
npm run start
```
In production mode, both the **frontend** and **backend** are served on the same port (`http://localhost:3000`).
> Don't forget to add the necessary files `data/proxies.txt` and `data/uas.txt`.
## Usage โ๏ธ
Once the server is up and running, you can interact with it via the frontend:
1. **Start Attack**:
- Set up the attack parameters: target URL, attack method (HTTP Flood, Slowloris, TCP, etc...), packet size, duration, and delay.
- Press "Start Attack" to initiate the stress test.
2. **Stop Attack**:
- Press "Stop Attack" to terminate the ongoing attack.
### Example Request
```json
{
"target": "http://example.com",
"attackMethod": "http_flood",
"packetSize": 512,
"duration": 60,
"packetDelay": 500
}
```
## Adding Proxies and User-Agents
Access to the ``data/proxies.txt`` and ``data/uas.txt`` can now be done fully in the frontend. Click the text button to the right of the beam button to open up the editor.

## Worker-Based Attack Handling ๐ง๐ก
Each attack type is handled in a separate worker thread, ensuring that the main server remains responsive. The attack workers are dynamically loaded based on the selected attack method (HTTP, etc...).
## To-Do ๐
- Add more attack methods:
- UDP ๐
- DNS ๐ก
- And more! ๐ฅ
- Enhance attack statistics and reporting for better real-time monitoring. ๐
## Contributing ๐
Feel free to fork the repo and open pull requests with new attack protocols, bug fixes, or improvements. If you have an idea for a new feature, please share it! ๐
### Adding New Attack Methods โก
To extend the server with new attack methods (e.g., Minecraft, TCP, UDP, DNS), you can create new worker files and add them to the server configuration.
For example:
- Add a new attack method in the frontend settings.
- Create the corresponding worker file (e.g., `minecraftAttack.js`).
- Update the attack handler configuration to include the new method.
```javascript
const attackHandlers = {
http_flood: "./workers/httpFloodAttack.js",
http_slowloris: "./workers/httpSlowlorisAttack.js",
tcp_flood: "./workers/tcpFloodAttack.js",
minecraft_ping: "./workers/minecraftPingAttack.js",
// Add more protocols as needed!
your_protocol: "./workers/yourProtocolAttack.js"
};
```
---
### FAQs โ
**1. What operating system does MMB support?**
> **Windows**, **Linux**, **Mac** and **Android (untested)**
**2. It crashes on startup, giving a "concurrently" error**
> Try running two terminals instead of one, in the first one use "npm run dev:client", and in the other one "npm run dev:server". (This happened to several people with Windows 11)
**3. I go to "<http://localhost:3000>" and nothing appears.**
> Port `3000` is the server port, to see the UI you must use port `5173` (<http://localhost:5173>)
**4. Requests fail to be sent to the target server (Read timeout and variations)**
> You must put the corresponding proxies in the file `data/proxies.txt`. On each line, put a different proxy that will be used to perform the attack. The format must be the following:
>
> - `protocol://user:password@host:port` (Proxy with authentication)
> - `protocol://host:port`
> - `host:port` (Uses http as default protocol)
> - `host` (Uses 8080 as default port)
---
## License ๐
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## Disclaimer ๐จ
Please note that this project is for educational purposes only and should not be used for malicious purposes.
---
### (๏ฝกโฅโฟโฅ๏ฝก) Happy Hacking ๐๐ถ | {
"source": "sammwyy/MikuMikuBeam",
"title": "README.md",
"url": "https://github.com/sammwyy/MikuMikuBeam/blob/main/README.md",
"date": "2025-01-20T02:45:30",
"stars": 3970,
"description": "An open-source network stresser tool but it's Hatsune Miku",
"file_size": 6257
} |
# ไธบ FastExcel ๅ่ดก็ฎ
FastExcel ๆฌข่ฟ็คพๅบ็ๆฏไธไฝ็จๆทๅๅผๅ่
ๆไธบ่ดก็ฎ่
ใๆ ่ฎบๆฏๆฅๅ้ฎ้ขใๆน่ฟๆๆกฃใๆไบคไปฃ็ ๏ผ่ฟๆฏๆไพๆๆฏๆฏๆ๏ผๆจ็ๅไธ้ฝๅฐๅธฎๅฉ FastExcel ๅๅพๆดๅฅฝใ
---
## ๆฅๅ้ฎ้ข
ๆไปฌ้ผๅฑ็จๆทๅจไฝฟ็จ FastExcel ็่ฟ็จไธญ้ๆถๆไพๅ้ฆใๆจๅฏไปฅ้่ฟ [NEW ISSUE](https://github.com/CodePhiliaX/fastexcel/issues/new/choose) ๆไบค้ฎ้ขใ
### ้ซ่ดจ้้ฎ้ขๆฅๅ
ไธบไบๆ้ซๆฒ้ๆ็๏ผ่ฏทๅจๆไบค้ฎ้ขๅ๏ผ
1. **ๆ็ดข็ฐๆ้ฎ้ข**๏ผๆฃๆฅๆจ็้ฎ้ขๆฏๅฆๅทฒ่ขซๆฅๅใๅฆๆๅญๅจ๏ผ่ฏท็ดๆฅๅจ็ฐๆ้ฎ้ขไธ่ฏ่ฎบ่กฅๅ
่ฏฆ็ปไฟกๆฏ๏ผ่ไธๆฏๅๅปบๆฐ้ฎ้ขใ
2. **ไฝฟ็จ้ฎ้ขๆจกๆฟ**๏ผ้ฎ้ขๆจกๆฟไฝไบ [ISSUE TEMPLATE](./.github/ISSUE_TEMPLATE)๏ผ่ฏทๆ็
งๆจกๆฟ่ฆๆฑๅกซๅ๏ผไปฅ็กฎไฟ้ฎ้ขๆ่ฟฐๅ็กฎไธๅฎๆดใ
ไปฅไธๆ
ๅต้ๅๆไบคๆฐ้ฎ้ข๏ผ
- Bug ๆฅๅ
- ๆฐๅ่ฝ้ๆฑ
- ๆง่ฝ้ฎ้ข
- ๅ่ฝๆๆกๆ่ฎพ่ฎก
- ๆๆกฃๆน่ฟ
- ๆต่ฏ่ฆ็็ไผๅ
- ้่ฆๆๆฏๆฏๆ
- ๅ
ถไปไธ้กน็ฎ็ธๅ
ณ็้ฎ้ข
> **ๆณจๆ**๏ผ่ฏทๅฟๅจ้ฎ้ขไธญๅ
ๅซๆๆไฟกๆฏ๏ผๅฆๅฏ็ ใๅฏ้ฅใๆๅกๅจๅฐๅๆ็งไบบๆฐๆฎใ
---
## ่ดก็ฎไปฃ็ ไธๆๆกฃ
ๆๆๅฏน FastExcel ็ๆน่ฟๅๅฏ้่ฟ Pull Request (PR) ๅฎ็ฐใๆ ่ฎบๆฏไฟฎๅค Bugใไผๅไปฃ็ ใๅขๅผบๅ่ฝ๏ผ่ฟๆฏๆน่ฟๆๆกฃ๏ผ้ฝ้ๅธธๆฌข่ฟ๏ผ
### ๆจๅฏไปฅ่ดก็ฎ็ๆนๅ
- ไฟฎๅค้ๅซๅญ
- ไฟฎๅค Bug
- ๅ ้คๅไฝไปฃ็
- ๆทปๅ ๆต่ฏ็จไพ
- ๅขๅผบๅ่ฝ
- ๆทปๅ ๆณจ้ไปฅๆๅไปฃ็ ๅฏ่ฏปๆง
- ไผๅไปฃ็ ็ปๆ
- ๆน่ฟๆๅฎๅๆๆกฃ
**ๅๅ**๏ผ**ไปปไฝๆๅฉไบ้กน็ฎๆน่ฟ็ PR ้ฝๅผๅพ้ผๅฑ๏ผ**
ๅจๆไบค PR ๅ๏ผ่ฏท็ๆไปฅไธๆๅ๏ผ
1. [ๅทฅไฝๅบๅๅค](#ๅทฅไฝๅบๅๅค)
2. [ๅๆฏๅฎไน](#ๅๆฏๅฎไน)
3. [ๆไบค่งๅ](#ๆไบค่งๅ)
4. [PR ่ฏดๆ](#pr่ฏดๆ)
---
### ๅทฅไฝๅบๅๅค
็กฎไฟๆจๅทฒๆณจๅ GitHub ่ดฆๅท๏ผๅนถๆ็
งไปฅไธๆญฅ้ชคๅฎๆๆฌๅฐๅผๅ็ฏๅข้
็ฝฎ๏ผ
1. **Fork ไปๅบ**๏ผๅจ FastExcel ็ [GitHub ้กต้ข](https://github.com/CodePhiliaX/fastexcel) ็นๅป `Fork` ๆ้ฎ๏ผๅฐ้กน็ฎๅคๅถๅฐๆจ็ GitHub ่ดฆๆทไธ๏ผไพๅฆ๏ผ`https://github.com/<your-username>/fastexcel`ใ
2. **ๅ
้ไปฃ็ ๅบ**๏ผ่ฟ่กไปฅไธๅฝไปคๅฐ Fork ็้กน็ฎๅ
้ๅฐๆฌๅฐ๏ผ
```bash
git clone [email protected]:<your-username>/fastexcel.git
```
3. **่ฎพ็ฝฎไธๆธธไปๅบ**๏ผๅฐๅฎๆนไปๅบ่ฎพ็ฝฎไธบ `upstream`๏ผๆนไพฟๅๆญฅๆดๆฐ๏ผ
```bash
git remote add upstream [email protected]:CodePhiliaX/fastexcel.git
git remote set-url --push upstream no-pushing
```
่ฟ่ก `git remote -v` ๅฏๆฃๆฅ้
็ฝฎๆฏๅฆๆญฃ็กฎใ
---
### ๅๆฏๅฎไน
ๅจ FastExcel ไธญ๏ผๆๆ่ดก็ฎๅบๅบไบ `main` ๅผๅๅๆฏใๆญคๅค๏ผ่ฟๆไปฅไธๅๆฏ็ฑปๅ๏ผ
- **release ๅๆฏ**๏ผ็จไบ็ๆฌๅๅธ๏ผๅฆ `0.6.0`, `0.6.1`๏ผใ
- **feature ๅๆฏ**๏ผ็จไบๅผๅ่พๅคง็ๅ่ฝใ
- **hotfix ๅๆฏ**๏ผ็จไบไฟฎๅค้่ฆ Bugใ
ๆไบค PR ๆถ๏ผ่ฏท็กฎไฟๅๆดๅบไบ `main` ๅๆฏใ
---
### ๆไบค่งๅ
#### ๆไบคไฟกๆฏ
่ฏท็กฎไฟๆไบคๆถๆฏๆธ
ๆฐไธๅ
ทๆๆ่ฟฐๆง๏ผ้ตๅพชไปฅไธๆ ผๅผ๏ผ
- **docs**: ๆดๆฐๆๆกฃ๏ผไพๅฆ `docs: ๆดๆฐ PR ๆไบคๆๅ`ใ
- **feature**: ๆฐๅ่ฝ๏ผไพๅฆ `feature: ๆฏๆ ๅนถๅๅๅ
ฅ`ใ
- **bugfix**: ไฟฎๅค Bug๏ผไพๅฆ `bugfix: ไฟฎๅค็ฉบๆ้ๅผๅธธ`ใ
- **refactor**: ้ๆไปฃ็ ๏ผไพๅฆ `refactor: ไผๅๆฐๆฎๅค็้ป่พ`ใ
- **test**: ๅขๅ ๆๆน่ฟๆต่ฏ๏ผไพๅฆ `test: ๆทปๅ ๅๅ
ๆต่ฏ`ใ
ไธๅปบ่ฎฎไฝฟ็จๆจก็ณ็ๆไบคไฟกๆฏ๏ผๅฆ๏ผ
- ~~ไฟฎๅค้ฎ้ข~~
- ~~ๆดๆฐไปฃ็ ~~
ๅฆๆ้่ฆๅธฎๅฉ๏ผ่ฏทๅ่ [ๅฆไฝ็ผๅ Git ๆไบคๆถๆฏ](http://chris.beams.io/posts/git-commit/)ใ
#### ๆไบคๅ
ๅฎน
ไธๆฌกๆไบคๅบๅ
ๅซๅฎๆดไธๅฏๅฎกๆฅ็ๆดๆน๏ผ็กฎไฟ๏ผ
- ้ฟๅ
ๆไบค่ฟไบๅบๅคง็ๆนๅจใ
- ๆฏๆฌกๆไบคๅ
ๅฎน็ฌ็ซไธๅฏ้่ฟ CI ๆต่ฏใ
ๅฆๅค๏ผ่ฏท็กฎไฟๆไบคๆถ้
็ฝฎๆญฃ็กฎ็ Git ็จๆทไฟกๆฏ๏ผ
```bash
git config --get user.name
git config --get user.email
```
---
### PR ่ฏดๆ
ไธบไบๅธฎๅฉๅฎก้
่
ๅฟซ้ไบ่งฃ PR ็ๅ
ๅฎนๅ็ฎ็๏ผ่ฏทไฝฟ็จ [PR ๆจกๆฟ](.github/PULL_REQUEST_TEMPLATE/pull_request_template.md)ใ่ฏฆ็ป็ๆ่ฟฐๅฐๆๅคงๆ้ซไปฃ็ ๅฎก้
ๆ็ใ
---
## ๆต่ฏ็จไพ่ดก็ฎ
ไปปไฝๆต่ฏ็จไพ็่ดก็ฎ้ฝๅผๅพ้ผๅฑ๏ผๅฐคๅ
ถๆฏๅๅ
ๆต่ฏใๅปบ่ฎฎๅจๅฏนๅบๆจกๅ็ `test` ็ฎๅฝไธญๅๅปบ `XXXTest.java` ๆไปถ๏ผๆจ่ไฝฟ็จ JUnit5 ๆกๆถใ
---
## ๅ
ถไปๅไธๆนๅผ
้คไบ็ดๆฅ่ดก็ฎไปฃ็ ๏ผไปฅไธๆนๅผๅๆ ทๆฏๅฏน FastExcel ็ๅฎ่ดตๆฏๆ๏ผ
- ๅ็ญๅ
ถไป็จๆท็้ฎ้ขใ
- ๅธฎๅฉๅฎก้
ไปไบบ็ PRใ
- ๆๅบๆน่ฟๅปบ่ฎฎใ
- ๆฐๅๆๆฏๅๅฎข๏ผๅฎฃไผ FastExcelใ
- ๅจ็คพๅบไธญๅไบซ้กน็ฎ็ธๅ
ณ็ฅ่ฏใ
---
## ไปฃ็ ้ฃๆ ผ
่ฏท้ตๅพช [้ฟ้ๅทดๅทด Java ็ผ็ ่ง่](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/) ่ฟ่กไปฃ็ ็ผๅใ
ๆจๅฏไปฅ้ๆฉๅฎ่ฃ
ไปฅไธๆไปถ๏ผ้ๅฟ
้๏ผไปฅๅธฎๅฉๆฃๆฅไปฃ็ ้ฃๆ ผ๏ผ
- **IntelliJ IDEA ๆไปถ**๏ผ[ๅฎ่ฃ
ๆๅ](https://github.com/alibaba/p3c/blob/master/idea-plugin/README.md)
- **Eclipse ๆไปถ**๏ผ[ๅฎ่ฃ
ๆๅ](https://github.com/alibaba/p3c/blob/master/eclipse-plugin/README.md)
---
**ๆๅ๏ผๆ่ฐขๆจๅฏน FastExcel ็ๆฏๆ๏ผๆฏไธไปฝๅธฎๅฉ๏ผ้ฝๆฏๆไปฌๅ่ฟ็ๅจๅใ** | {
"source": "fast-excel/fastexcel",
"title": "CONTRIBUTING.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/CONTRIBUTING.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 2831
} |
[ไธญๆ](README.md) |[English](README_EN.md) | [ๆฅๆฌ่ช](README_JP.md)
## ไปไนๆฏ FastExcel
FastExcel ๆฏ็ฑๅ EasyExcel ไฝ่
ๅๅปบ็ๆฐ้กน็ฎใ2023 ๅนดๆๅทฒไป้ฟ้็ฆป่๏ผ่ฟๆ้ฟ้ๅฎฃๅธๅๆญขๆดๆฐ EasyExcel๏ผๆๅณๅฎ็ปง็ปญ็ปดๆคๅๅ็บง่ฟไธช้กน็ฎใๅจ้ๆฐๅผๅงๆถ๏ผๆ้ๆฉไธบๅฎ่ตทๅไธบ FastExcel๏ผไปฅ็ชๅบ่ฟไธชๆกๆถๅจๅค็ Excel ๆไปถๆถ็้ซๆง่ฝ่กจ็ฐ๏ผ่ไธไป
ไป
ๆฏ็ฎๅๆ็จใ
FastExcel ๅฐๅง็ปๅๆๅ
่ดนๅผๆบ๏ผๅนถ้็จๆๅผๆพ็ MIT ๅ่ฎฎ๏ผไฝฟๅ
ถ้็จไบไปปไฝๅไธๅๅบๆฏใ่ฟไธบๅผๅ่
ๅไผไธๆไพไบๆๅคง็่ช็ฑๅบฆๅ็ตๆดปๆงใFastExcel ็ไธไบๆพ่็น็นๅ
ๆฌ๏ผ
- 1ใๅฎๅ
จๅ
ผๅฎนๅ EasyExcel ็ๆๆๅ่ฝๅ็นๆง๏ผ่ฟไฝฟๅพ็จๆทๅฏไปฅๆ ็ผ่ฟๆธกใ
- 2ใไป EasyExcel ่ฟ็งปๅฐ FastExcel ๅช้็ฎๅๅฐๆดๆขๅ
ๅๅ Maven ไพ่ตๅณๅฏๅฎๆๅ็บงใ
- 3ใๅจๅ่ฝไธ๏ผๆฏ EasyExcel ๆไพๆดๅคๅๆฐๅๆน่ฟใ
- 4ใFastExcel 1.0.0 ็ๆฌๆฐๅขไบ่ฏปๅ Excel ๆๅฎ่กๆฐๅๅฐ Excel ่ฝฌๆขไธบ PDF ็ๅ่ฝใ
ๆไปฌ่ฎกๅๅจๆชๆฅๆจๅบๆดๅคๆฐ็นๆง๏ผไปฅไธๆญๆๅ็จๆทไฝ้ชๅๅทฅๅ
ทๅฎ็จๆงใๆฌข่ฟๅคงๅฎถๅ
ณๆณจ ็จๅบๅๅฐๆ็ๅ
ฌไผๅท ๅ
ณๆณจFastExcel็ๅๅฑใFastExcel ่ดๅไบๆไธบๆจๅค็ Excel ๆไปถ็ๆไฝณ้ๆฉใ
## ไธป่ฆ็นๆง
- 1. ้ซๆง่ฝ่ฏปๅ๏ผFastExcel ไธๆณจไบๆง่ฝไผๅ๏ผ่ฝๅค้ซๆๅค็ๅคง่งๆจก็ Excel ๆฐๆฎใ็ธๆฏไธไบไผ ็ป็ Excel ๅค็ๅบ๏ผๅฎ่ฝๆพ่้ไฝๅ
ๅญๅ ็จใ
- 2. ็ฎๅๆ็จ๏ผ่ฏฅๅบๆไพไบ็ฎๆด็ด่ง็ API๏ผไฝฟๅพๅผๅ่
ๅฏไปฅ่ฝปๆพ้ๆๅฐ้กน็ฎไธญ๏ผๆ ่ฎบๆฏ็ฎๅ็ Excel ๆไฝ่ฟๆฏๅคๆ็ๆฐๆฎๅค็้ฝ่ฝๅฟซ้ไธๆใ
- 3. ๆตๅผๆไฝ๏ผFastExcel ๆฏๆๆตๅผ่ฏปๅ๏ผๅฐไธๆฌกๆงๅ ่ฝฝๅคง้ๆฐๆฎ็้ฎ้ข้ๅฐๆไฝใ่ฟ็ง่ฎพ่ฎกๆนๅผๅจๅค็ๆฐๅไธ็่ณไธ็พไธ่ก็ๆฐๆฎๆถๅฐคไธบ้่ฆใ
## ๅฎ่ฃ
ไธ่กจๅๅบไบๅ็ๆฌ FastExcel ๅบ็กๅบๅฏน Java ่ฏญ่จ็ๆฌๆไฝ่ฆๆฑ็ๆ
ๅต๏ผ
| ็ๆฌ | jdk็ๆฌๆฏๆ่ๅด | ๅคๆณจ |
|--------|:---------------:|----------------------------------|
| 1.0.0+ | jdk8 - jdk21 | ็ฎๅ็masterๅๆฏ๏ผๅฎๅ
จๅ
ผๅฎนeasyexcel |
ๆไปฌๅผบ็ๅปบ่ฎฎๆจไฝฟ็จๆๆฐ็ๆฌ็ FastExcel๏ผๅ ไธบๆๆฐ็ๆฌไธญ็ๆง่ฝไผๅใBUGไฟฎๅคๅๆฐๅ่ฝ้ฝไผ่ฎฉๆจ็ไฝฟ็จๆดๅ ๆนไพฟใ
> ๅฝๅ FastExcel ๅบๅฑไฝฟ็จ poi ไฝไธบๅบ็กๅ
๏ผๅฆๆๆจ็้กน็ฎไธญๅทฒ็ปๆ poi ็ธๅ
ณ็ปไปถ๏ผ้่ฆๆจๆๅจๆ้ค poi ็็ธๅ
ณ jar ๅ
ใ
## ๆดๆฐ
ๆจๅฏไปฅๅจ [็ๆฌๅ็บง่ฏฆๆ
](update.md) ไธญๆฅ่ฏขๅฐๅ
ทไฝ็็ๆฌๆดๆฐ็ป่ใ ๆจไนๅฏไปฅๅจ[Maven ไธญๅฟไปๅบ](https://mvnrepository.com/artifact/cn.idev.excel/fastexcel)ไธญๆฅ่ฏขๅฐๆๆ็็ๆฌใ
### Maven
ๅฆๆๆจไฝฟ็จ Maven ่ฟ่ก้กน็ฎๆๅปบ๏ผ่ฏทๅจ `pom.xml` ๆไปถไธญๅผๅ
ฅไปฅไธ้
็ฝฎ๏ผ
```xml
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.1.0</version>
</dependency>
```
### Gradle
ๅฆๆๆจไฝฟ็จ Gradle ่ฟ่ก้กน็ฎๆๅปบ๏ผ่ฏทๅจ `build.gradle` ๆไปถไธญๅผๅ
ฅไปฅไธ้
็ฝฎ๏ผ
```gradle
dependencies {
implementation 'cn.idev.excel:fastexcel:1.1.0'
}
```
## EasyExcel ไธ FastExcel ็ๅบๅซ
- 1. FastExcel ๆฏๆๆๆ EasyExcel ็ๅ่ฝ๏ผไฝๆฏ FastExcel ็ๆง่ฝๆดๅฅฝ๏ผๆด็จณๅฎใ
- 2. FastExcel ไธ EasyExcel ็ API ๅฎๅ
จไธ่ด๏ผๅฏไปฅๆ ็ผๅๆขใ
- 3. FastExcel ไผๆ็ปญ็ๆดๆฐ๏ผไฟฎๅค bug๏ผไผๅๆง่ฝ๏ผๅขๅ ๆฐๅ่ฝใ
## EasyExcel ๅฆไฝๅ็บงๅฐ FastExcel
### 1. ไฟฎๆนไพ่ต
ๅฐ EasyExcel ็ไพ่ตๆฟๆขไธบ FastExcel ็ไพ่ต๏ผๅฆไธ๏ผ
```xml
<!-- easyexcel ไพ่ต -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>xxxx</version>
</dependency>
```
็ไพ่ตๆฟๆขไธบ
```xml
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.1.0</version>
</dependency>
```
### 2. ไฟฎๆนไปฃ็
ๅฐ EasyExcel ็ๅ
ๅๆฟๆขไธบ FastExcel ็ๅ
ๅ๏ผๅฆไธ๏ผ
```java
// ๅฐ easyexcel ็ๅ
ๅๆฟๆขไธบ FastExcel ็ๅ
ๅ
import com.alibaba.excel.**;
```
ๆฟๆขไธบ
```java
import cn.idev.excel.**;
```
### 3. ไธไฟฎๆนไปฃ็ ็ดๆฅไพ่ต FastExcel
ๅฆๆ็ฑไบ็ง็งๅๅ ๆจไธๆณไฟฎๆนไปฃ็ ๏ผๅฏไปฅ็ดๆฅไพ่ต FastExcel ๏ผ็ถๅๅจ `pom.xml` ๆไปถไธญ็ดๆฅไพ่ต FastExcelใ
EasyExcel ไธ FastExcel ๅฏไปฅๅ
ฑๅญ๏ผไฝๆฏ้ฟๆๅปบ่ฎฎๆฟๆขไธบ FastExcelใ
### 4. ๅปบ่ฎฎไปฅๅไฝฟ็จ FastExcel ็ฑป
ไธบไบๅ
ผๅฎนๆง่่ไฟ็ไบ EasyExcel ็ฑป๏ผไฝๆฏๅปบ่ฎฎไปฅๅไฝฟ็จ FastExcel ็ฑป๏ผFastExcel ็ฑปๆฏFastExcel ็ๅ
ฅๅฃ็ฑป๏ผๅ่ฝๅ
ๅซไบ EasyExcel ็ฑป็ๆๆๅ่ฝ๏ผไปฅๅๆฐ็นๆงไป
ๅจ FastExcel ็ฑปไธญๆทปๅ ใ
## ็ฎๅ็คบไพ๏ผ่ฏปๅ Excel ๆไปถ
ไธ้ขๆฏ่ฏปๅ Excel ๆๆกฃ็ไพๅญ๏ผ
```java
// ๅฎ็ฐ ReadListener ๆฅๅฃ๏ผ่ฎพ็ฝฎ่ฏปๅๆฐๆฎ็ๆไฝ
public class DemoDataListener implements ReadListener<DemoData> {
@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("่งฃๆๅฐไธๆกๆฐๆฎ" + JSON.toJSONString(data));
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("ๆๆๆฐๆฎ่งฃๆๅฎๆ๏ผ");
}
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// ่ฏปๅ Excel ๆไปถ
FastExcel.read(fileName, DemoData.class, new DemoDataListener()).sheet().doRead();
}
```
## ็ฎๅ็คบไพ๏ผๅๅปบ Excel ๆไปถ
ไธ้ขๆฏไธไธชๅๅปบ Excel ๆๆกฃ็็ฎๅไพๅญ๏ผ
```java
// ็คบไพๆฐๆฎ็ฑป
public class DemoData {
@ExcelProperty("ๅญ็ฌฆไธฒๆ ้ข")
private String string;
@ExcelProperty("ๆฅๆๆ ้ข")
private Date date;
@ExcelProperty("ๆฐๅญๆ ้ข")
private Double doubleData;
@ExcelIgnore
private String ignore;
}
// ๅกซๅ
่ฆๅๅ
ฅ็ๆฐๆฎ
private static List<DemoData> data() {
List<DemoData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
DemoData data = new DemoData();
data.setString("ๅญ็ฌฆไธฒ" + i);
data.setDate(new Date());
data.setDoubleData(0.56);
list.add(data);
}
return list;
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// ๅๅปบไธไธชๅไธบโๆจกๆฟโ็ sheet ้กต๏ผๅนถๅๅ
ฅๆฐๆฎ
FastExcel.write(fileName, DemoData.class).sheet("ๆจกๆฟ").doWrite(data());
}
```
## ๅ
ณๆณจไฝ่
ๅ
ณๆณจไฝ่
โ็จๅบๅๅฐๆโ็ๅ
ฌไผๅทๅ ๅ
ฅๆๆฏไบคๆต็พค๏ผ่ทๅๆดๅคๆๆฏๅนฒ่ดงๅๆๆฐๅจๆใ
<a><img src="https://github.com/user-attachments/assets/b40aebe8-0552-4fb2-b184-4cb64a5b1229" width="30%"/></a> | {
"source": "fast-excel/fastexcel",
"title": "README.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/README.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 4291
} |
[ไธญๆ](README.md) |[English](README_EN.md) | [ๆฅๆฌ่ช](README_JP.md)
## What is FastExcel
FastExcel is the latest work created by the original author of EasyExcel. After I left Alibaba in 2023, and with Alibaba announcing the cessation of EasyExcel updates, I decided to continue maintaining and upgrading this project. When restarting, I chose the name FastExcel to emphasize the high performance of this framework when handling Excel files, not just its simplicity and ease of use.
FastExcel will always remain free and open-source, adopting the most open MIT license, making it suitable for any commercial scenarios. This provides developers and enterprises with great freedom and flexibility. Some notable features of FastExcel include:
- 1. Full compatibility with all functionalities and features of the original EasyExcel, allowing users to transition seamlessly.
- 2. Migrating from EasyExcel to FastExcel only requires a simple change of package name and Maven dependency to complete the upgrade.
- 3. Functionally, it offers more innovations and improvements than EasyExcel.
- 4. The FastExcel 1.0.0 version introduced the ability to read a specified number of Excel rows and convert Excel to PDF.
We plan to introduce more new features in the future to continually enhance user experience and tool usability. Stay tuned to "Programmer Xiao Lan's" public account for updates on the development of FastExcel. FastExcel is committed to being your best choice for handling Excel files.
## Key Features
- 1. High-performance Reading and Writing: FastExcel focuses on performance optimization, capable of efficiently handling large-scale Excel data. Compared to some traditional Excel processing libraries, it can significantly reduce memory consumption.
- 2. Simplicity and Ease of Use: The library offers a simple and intuitive API, allowing developers to easily integrate it into projects, whether for simple Excel operations or complex data processing.
- 3. Stream Operations: FastExcel supports stream reading, minimizing the problem of loading large amounts of data at once. This design is especially important when dealing with hundreds of thousands or even millions of rows of data.
## Installation
The following table lists the minimum Java language version requirements for each version of the FastExcel library:
| Version | JDK Version Support Range | Notes |
|---------|:-------------------------:|--------------------------------|
| 1.0.0+ | JDK8 - JDK21 | Current master branch, fully compatible with EasyExcel |
We strongly recommend using the latest version of FastExcel, as performance optimizations, bug fixes, and new features in the latest version will enhance your experience.
> Currently, FastExcel uses POI as its underlying package. If your project already includes POI-related components, you will need to manually exclude POI-related jar files.
### Maven
If you are using Maven for project building, add the following configuration in the `pom.xml` file:
```xml
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.1.0</version>
</dependency>
```
### Gradle
If you are using Gradle for project building, add the following configuration in the build.gradle file:
```gradle
dependencies {
implementation 'cn.idev.excel:fastexcel:1.1.0'
}
```
## Update
For detailed update logs, refer to [Details of version updates](update.md). You can also find all available versions in the [Maven Central Repository](https://mvnrepository.com/artifact/cn.idev.excel/fastexcel).
## Differences Between EasyExcel and FastExcel
- FastExcel supports all the features of EasyExcel but with better performance and stability.
- FastExcel has an identical API to EasyExcel, allowing seamless switching.
- FastExcel will continue to update, fix bugs, optimize performance, and add new features.
## How to Upgrade from EasyExcel to FastExcel
### 1. Update Dependencies
Replace the EasyExcel dependency with the FastExcel dependency, as follows:
```xml
<!-- EasyExcel dependency -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>xxxx</version>
</dependency>
```
Replace with:
```xml
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.1.0</version>
</dependency>
```
### 2. Update Code
Replace the EasyExcel package name with the FastExcel package name, as follows:
```java
// Replace EasyExcel package name with FastExcel package name
import com.alibaba.excel.**;
```
Replace with:
```java
import cn.idev.excel.** ;
```
### 3. Import FastExcel Without Modifying Code
If you do not want to modify the code for various reasons, you can directly depend on FastExcel by directly adding the dependency in the pom.xml file. EasyExcel and FastExcel can coexist, but long-term switching to FastExcel is recommended.
### 4. Future Use of FastExcel Classes Recommended
To maintain compatibility, EasyExcel classes are retained, but using FastExcel classes in the future is recommended. FastExcel classes are the entry classes for FastExcel and encompass all features of EasyExcel. New features will only be added to FastExcel classes.
## Simple Example: Reading Excel Files
Below is an example of reading an Excel document:
```java
// Implement the ReadListener interface to set up operations for reading data
public class DemoDataListener implements ReadListener<DemoData> {
@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("Parsed a data entry" + JSON.toJSONString(data));
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("All data parsed!");
}
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// Read Excel file
FastExcel.read(fileName, DemoData.class, new DemoDataListener()).sheet().doRead();
}
```
### Simple Example: Creating Excel Files
Below is a simple example of creating an Excel document:
```java
// Sample data class
public class DemoData {
@ExcelProperty("String Title")
private String string;
@ExcelProperty("Date Title")
private Date date;
@ExcelProperty("Number Title")
private Double doubleData;
@ExcelIgnore
private String ignore;
}
// Prepare data to write
private static List<DemoData> data() {
List<DemoData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
DemoData data = new DemoData();
data.setString("String" + i);
data.setDate(new Date());
data.setDoubleData(0.56);
list.add(data);
}
return list;
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// Create a "Template" sheet and write data
FastExcel.write(fileName, DemoData.class).sheet("Template").doWrite(data());
}
``` | {
"source": "fast-excel/fastexcel",
"title": "README_EN.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/README_EN.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 6908
} |
[ไธญๆ](README.md) |[English](README_EN.md) | [ๆฅๆฌ่ช](README_JP.md)
## FastExcelใจใฏ
FastExcelใฏใๅ
EasyExcelใฎไฝ่
ใซใใฃใฆไฝๆใใใๆๆฐใฎไฝๅใงใใ2023ๅนดใซ็งใใขใชใใใ้่ทใใๅพใใขใชใใใEasyExcelใฎๆดๆฐใๅๆญขใใใใจใ็บ่กจใใใใจใซไผดใใใใฎใใญใธใงใฏใใๅผใ็ถใใกใณใใใณในใใใณใขใใใฐใฌใผใใใใใจใๆฑบๅฎใใพใใใๅใณๅงใใ้ใซใ็งใฏใใฎใใฌใผใ ใฏใผใฏใฎๅๅใFastExcelใจใใExcelใใกใคใซใฎๅฆ็ใซใใใ้ซๆง่ฝใๅผท่ชฟใใพใใใใใฎไฝฟใใใใใ ใใงใฏใใใพใใใ
FastExcelใฏๅธธใซ็กๆใงใชใผใใณใฝใผในใงใใใๆใใชใผใใณใชMITใฉใคใปใณในใๆก็จใใฆใใใไปปๆใฎๅๆฅญใทใใชใชใงไฝฟ็จใงใใพใใใใใซใใใ้็บ่
ใไผๆฅญใซๅคงใใช่ช็ฑๅบฆใจๆ่ปๆงใๆไพใใใพใใFastExcelใฎใใใคใใฎ้ก่ใช็นๅพดใฏไปฅไธใฎ้ใใงใ๏ผ
- 1. ๅ
ใฎEasyExcelใฎใในใฆใฎๆฉ่ฝใจ็นๆงใจใฎๅฎๅ
จใชไบๆๆงใใใใใใใฆใผใถใผใฏใทใผใ ใฌในใซ็งป่กใงใใพใใ
- 2. EasyExcelใใFastExcelใธใฎ็งป่กใฏใใใใฑใผใธๅใจMavenไพๅญ้ขไฟใๅ็ดใซๅคๆดใใใ ใใงใขใใใฐใฌใผใใๅฎไบใใพใใ
- 3. ๆฉ่ฝ็ใซใฏใEasyExcelใใใๅคใใฎ้ฉๆฐใจๆนๅใๆไพใใพใใ
- 4. FastExcel 1.0.0ใใผใธใงใณใงใฏใๆๅฎ่กๆฐใฎExcelใ่ชญใฟๅใใExcelใPDFใซๅคๆใใๆฉ่ฝใๆฐใใซ่ฟฝๅ ใใพใใใ
็งใใกใฏใๅฐๆฅ็ใซใใใชใๆฐๆฉ่ฝใๅฐๅ
ฅใ็ถใใฆใใฆใผใถใผใจใฏในใใชใจใณในใจใใผใซใฎๅฎ็จๆงใ็ถ็ถ็ใซๅไธใใใ่จ็ปใงใใ้็บใฎ้ฒๆใ่ฟฝใใFastExcelใฎ็บๅฑใใตใใผใใใใใใใใใญใฐใฉใใผใปใทใฃใชใฉใณใใฎๅ
ฌๅผใขใซใฆใณใใใ่ฆ้ใใชใใFastExcelใฏใExcelใใกใคใซใฎๅฆ็ใซใใใใๅฎขๆงใฎๆ่ฏใฎ้ธๆ่ขใจใชใใใจใซๅฐๅฟตใใฆใใพใใ
## ไธปใชๆฉ่ฝ
- 1. ้ซๆง่ฝใช่ชญใฟๆธใ๏ผFastExcelใฏใใใฉใผใใณในใฎๆ้ฉๅใซ้็นใ็ฝฎใใๅคง่ฆๆจกใชExcelใใผใฟใๅน็็ใซๅฆ็ใใใใจใใงใใพใใใใใคใใฎไผ็ตฑ็ใชExcelๅฆ็ใฉใคใใฉใชใจๆฏ่ผใใฆใใกใขใชๆถ่ฒปใๅคงๅน
ใซๅๆธใงใใพใใ
- 2. ็ฐกๅใงไฝฟใใใใ๏ผใใฎใฉใคใใฉใชใฏ็ฐกๆฝใง็ดๆ็ใชAPIใๆไพใใฆใใใ้็บ่
ใใใญใธใงใฏใใซ็ฐกๅใซ็ตฑๅใงใใ็ฐกๅใชExcelๆไฝใใ่ค้ใชใใผใฟๅฆ็ใพใง่ฟ
้ใซ็ฟๅพใงใใพใใ
- 3. ในใใชใผใ ๆไฝ๏ผFastExcelใฏในใใชใผใ ่ชญใฟๅใใใตใใผใใใฆใใใๅคง้ใฎใใผใฟใไธๅบฆใซใญใผใใใๅ้กใๆๅฐ้ใซๆใใพใใใใฎ่จญ่จๆนๅผใฏๆฐๅไธ่กใใพใใฏๆฐ็พไธ่กใฎใใผใฟใๅฆ็ใใ้ใซ็นใซ้่ฆใงใใ
## ใคใณในใใผใซ
ไปฅไธใฎ่กจใฏใๅใใผใธใงใณใฎFastExcelๅบ็คใฉใคใใฉใชใฎJava่จ่ชใใผใธใงใณใฎๆไฝ่ฆไปถใไธ่ฆงใซใใใใฎใงใ๏ผ
| ใใผใธใงใณ | JDKใใผใธใงใณใตใใผใ็ฏๅฒ | ๅ่ |
|--------------|:--------------------------:|----------------------------------|
| 1.0.0+ | JDK8 - JDK21 | ็พๅจใฎใในใฟใผใใฉใณใใEasyExcelใจๅฎๅ
จไบๆ |
ๆๆฐใฎFastExcelใใผใธใงใณใไฝฟ็จใใใใจใๅผทใใๅงใใใพใใๆๆฐใใผใธใงใณใฎใใใฉใผใใณในๆ้ฉๅใใใฐไฟฎๆญฃใใใใณๆฐๆฉ่ฝใฏใไฝฟ็จใฎๅฉไพฟๆงใๅไธใใใพใใ
> ็พๅจใFastExcelใฎๅบ็คใจใใฆPOIใไฝฟ็จใใฆใใพใใใใญใธใงใฏใใซๆขใซPOI้ข้ฃใฎใณใณใใผใใณใใๅซใพใใฆใใๅ ดๅใPOI้ข้ฃใฎjarใใกใคใซใๆๅใง้คๅคใใๅฟ
่ฆใใใใพใใ
### Maven
Mavenใงใใญใธใงใฏใใๆง็ฏใใๅ ดๅใ`pom.xml`ใใกใคใซใซๆฌกใฎๆงๆใๅซใใฆใใ ใใ๏ผ
```xml
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.1.0</version>
</dependency>
```
### Gradle
Gradleใงใใญใธใงใฏใใๆง็ฏใใๅ ดๅใbuild.gradleใใกใคใซใซๆฌกใฎๆงๆใๅซใใฆใใ ใใ๏ผ
```gradle
dependencies {
implementation 'cn.idev.excel:fastexcel:1.1.0'
}
```
## ๆดๆฐใใ
ๅ
ทไฝ็ใชใใผใธใงใณใขใใๅ
ๅฎนใฏ[ใใผใธใงใณใขใใ่ฉณ็ดฐ](update.md)ใง็ขบ่ชใงใใพใใ [Maven Central Repository](https://mvnrepository.com/artifact/cn.idev.excel/fastexcel) ๅ
ใฎใในใฆใฎใใผใธใงใณใใฏใจใชใใใใจใใงใใพใใ
## EasyExcelใจFastExcelใฎ้ใ
- FastExcelใฏEasyExcelใฎใในใฆใฎๆฉ่ฝใใตใใผใใใฆใใพใใใFastExcelใฎใใใฉใผใใณในใฏใใ่ฏใใใใๅฎๅฎใใฆใใพใใ
- FastExcelใจEasyExcelใฎAPIใฏๅฎๅ
จใซไธ่ดใใฆใใใใใใทใผใ ใฌในใซๅใๆฟใใใใจใใงใใพใใ
- FastExcelใฏ็ถ็ถใใฆๆดๆฐใใใใใฐใไฟฎๆญฃใใใใใฉใผใใณในใๆ้ฉๅใใๆฐๆฉ่ฝใ่ฟฝๅ ใใพใใ
## EasyExcelใFastExcelใซใขใใใฐใฌใผใใใๆนๆณ
### 1. ไพๅญ้ขไฟใฎๅคๆด
EasyExcelใฎไพๅญ้ขไฟใFastExcelใฎไพๅญ้ขไฟใซ็ฝฎใๆใใพใใไปฅไธใฎใใใซ๏ผ
```xml
<!-- easyexcel ไพๅญ -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>xxxx</version>
</dependency>
```
ใไปฅไธใซ็ฝฎใๆใใพใ
```xml
<dependency>
<groupId>cn.idev.excel</groupId>
<artifactId>fastexcel</artifactId>
<version>1.1.0</version>
</dependency>
```
### 2. ใณใผใใฎไฟฎๆญฃ
EasyExcelใฎใใใฑใผใธๅใFastExcelใฎใใใฑใผใธๅใซ็ฝฎใๆใใพใใไปฅไธใฎใใใซ๏ผ
```java
// EasyExcelใฎใใใฑใผใธๅใFastExcelใฎใใใฑใผใธๅใซ็ฝฎใๆใใพใ
import com.alibaba.excel.**;
```
ใไปฅไธใซ็ฝฎใๆใใพใ
```java
import cn.idev.excel.** ;
```
### 3. ใณใผใใไฟฎๆญฃใใใซFastExcelใ็ดๆฅไพๅญใใ
ไฝใใใฎ็็ฑใงใณใผใใไฟฎๆญฃใใใใชใๅ ดๅใฏใFastExcelใซ็ดๆฅไพๅญใใpom.xmlใใกใคใซๅ
ใงFastExcelใซ็ดๆฅไพๅญใงใใพใใEasyExcelใจFastExcelใฏๅ
ฑๅญใงใใพใใใ้ทๆ็ใซใฏFastExcelใไฝฟ็จใใใใจใๆจๅฅจใใพใใ
### 4. ไปฅๅพใฏFastExcelใฏใฉในใไฝฟ็จใใใใจใใๅงใใใพใ
ไบๆๆงใ่ๆ
ฎใใฆEasyExcelใฏใฉในใไฟๆใใใฆใใพใใใไปๅพใฏFastExcelใฏใฉในใไฝฟ็จใใใใจใใๅงใใใพใใFastExcelใฏใฉในใฏFastExcelใฎใจใณใใชใผใฏใฉในใงใใใEasyExcelใฏใฉในใฎใในใฆใฎๆฉ่ฝใๅซใใงใใพใใๆฐๆฉ่ฝใฏไปฅๅพใFastExcelใฏใฉในใซใฎใฟ่ฟฝๅ ใใใพใใ
## ใทใณใใซใชไพ๏ผExcelใใกใคใซใ่ชญใ
ไปฅไธใซExcelใใญใฅใกใณใใ่ชญใใงใใไพใ็คบใใพใ๏ผ
```java
// ReadListenerใคใณใฟใผใใงใผในใๅฎ่ฃ
ใใฆใใผใฟใ่ชญใๆไฝใ่จญๅฎใใพใ
public class DemoDataListener implements ReadListener<DemoData> {
@Override
public void invoke(DemoData data, AnalysisContext context) {
System.out.println("ใใผใฟใจใณใใชใ่งฃๆใใพใใ" + JSON.toJSONString(data));
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("ใในใฆใฎใใผใฟใฎ่งฃๆใๅฎไบใใพใใ๏ผ");
}
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// Excelใใกใคใซใ่ชญใ
FastExcel.read(fileName, DemoData.class, new DemoDataListener()).sheet().doRead();
}
```
## ใทใณใใซใชไพ๏ผExcelใใกใคใซใไฝๆ
ไปฅไธใฏExcelใใญใฅใกใณใใไฝๆใใ็ฐกๅใชไพใงใ๏ผ
```java
// ใตใณใใซใใผใฟใฏใฉใน
public class DemoData {
@ExcelProperty("ๆๅญๅใฟใคใใซ")
private String string;
@ExcelProperty("ๆฅไปใฟใคใใซ")
private Date date;
@ExcelProperty("ๆฐๅญใฟใคใใซ")
private Double doubleData;
@ExcelIgnore
private String ignore;
}
// ๆธใ่พผใใใผใฟใๆบๅใใพใ
private static List<DemoData> data() {
List<DemoData> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
DemoData data = new DemoData();
data.setString("ๆๅญๅ" + i);
data.setDate(new Date());
data.setDoubleData(0.56);
list.add(data);
}
return list;
}
public static void main(String[] args) {
String fileName = "demo.xlsx";
// ใใใณใใฌใผใใใจๅไปใใใทใผใใไฝๆใใใใผใฟใๆธใ่พผใฟใพใ
FastExcel.write(fileName, DemoData.class).sheet("ใใณใใฌใผใ").doWrite(data());
}
``` | {
"source": "fast-excel/fastexcel",
"title": "README_JP.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/README_JP.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 4807
} |
# 1.1.0
ๆญคๆฌกๅ็บงไธป่ฆไฟฎๅค [EasyExcel](https://github.com/alibaba/easyexcel) ๅๅฒ BUG๏ผๅๆถๅ้คไบ้จๅไพ่ตๅบ๏ผ็ฌฆๅ `MIT` ๅ่ฎฎ็็ธๅ
ณ่ง่ใ
ๅ
ทไฝๆดๆฐๅ
ๅฎนๅฆไธ๏ผ
- ใๆน่ฟใ็งป้ค `itext` ไพ่ตๅบ๏ผๅฐ `่ฝฌๆขPDF` ๅ่ฝ่ฟ็งป่ณๆฐ้กน็ฎ๏ผ
- ใไฟฎๅคใfillๅกซๅ
็ฉบๆฐๆฎ๏ผๅฏ่ฝๅฏผ่ด่กๆฐๆฎ้ไนฑ็้ฎ้ข๏ผ
- ใไฟฎๅคใ่ชๅฎไนๆฐๆฎๆ ผๅผๅฏ่ฝๅฏผ่ดๆฐๆฎ่ฏปๅๅคฑ่ดฅ็้ฎ้ข๏ผ
- ใไผๅใไพ่กๅ็บงไพ่ต็Jarๅ
็ๆฌ;
- ใไผๅใๅขๅ ๆฅ้ๅ
ๅฎน่ฏฆ็ปไฟกๆฏ๏ผ
- ใไผๅใๆดๆฐไปฃ็ ๆ ผๅผๅ้จๅ้ๅซๅญ๏ผ
- ใไผๅใๆดๆฐ้จๅๆๆกฃๅไฝฟ็จ่ฏดๆใ | {
"source": "fast-excel/fastexcel",
"title": "update.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/update.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 290
} |
# ่ฏฆ็ปๅๆฐไป็ป
## ๅ
ณไบๅธธ่ง็ฑป่งฃๆ
* EasyExcel ๅ
ฅๅฃ็ฑป๏ผ็จไบๆๅปบๅผๅงๅ็งๆไฝ
* ExcelReaderBuilder ExcelWriterBuilder ๆๅปบๅบไธไธช ReadWorkbook WriteWorkbook๏ผๅฏไปฅ็่งฃๆไธไธชexcelๅฏน่ฑก๏ผไธไธชexcelๅช่ฆๆๅปบไธไธช
* ExcelReaderSheetBuilder ExcelWriterSheetBuilder ๆๅปบๅบไธไธช ReadSheet WriteSheetๅฏน่ฑก๏ผๅฏไปฅ็่งฃๆexcel้้ข็ไธ้กต,ๆฏไธ้กต้ฝ่ฆๆๅปบไธไธช
* ReadListener ๅจๆฏไธ่ก่ฏปๅๅฎๆฏๅ้ฝไผ่ฐ็จReadListenerๆฅๅค็ๆฐๆฎ
* WriteHandler ๅจๆฏไธไธชๆไฝๅ
ๆฌๅๅปบๅๅ
ๆ ผใๅๅปบ่กจๆ ผ็ญ้ฝไผ่ฐ็จWriteHandlerๆฅๅค็ๆฐๆฎ
* ๆๆ้
็ฝฎ้ฝๆฏ็ปงๆฟ็๏ผWorkbook็้
็ฝฎไผ่ขซSheet็ปงๆฟ๏ผๆไปฅๅจ็จEasyExcel่ฎพ็ฝฎๅๆฐ็ๆถๅ๏ผๅจEasyExcel...sheet()ๆนๆณไนๅไฝ็จๅๆฏๆดไธชsheet,ไนๅ้ๅฏนๅไธชsheet
## ่ฏป
### ๆณจ่งฃ
* `ExcelProperty` ๆๅฎๅฝๅๅญๆฎตๅฏนๅบexcelไธญ็้ฃไธๅใๅฏไปฅๆ นๆฎๅๅญๆ่
Indexๅปๅน้
ใๅฝ็ถไนๅฏไปฅไธๅ๏ผ้ป่ฎค็ฌฌไธไธชๅญๆฎตๅฐฑๆฏindex=0๏ผไปฅๆญค็ฑปๆจใๅไธๆณจๆ๏ผ่ฆไนๅ
จ้จไธๅ๏ผ่ฆไนๅ
จ้จ็จindex๏ผ่ฆไนๅ
จ้จ็จๅๅญๅปๅน้
ใๅไธๅซไธไธชๆทท็็จ๏ผ้ค้ไฝ ้ๅธธไบ่งฃๆบไปฃ็ ไธญไธไธชๆทท็็จๆไนๅปๆๅบ็ใ
* `ExcelIgnore` ้ป่ฎคๆๆๅญๆฎต้ฝไผๅexcelๅปๅน้
๏ผๅ ไบ่ฟไธชๆณจ่งฃไผๅฟฝ็ฅ่ฏฅๅญๆฎต
* `DateTimeFormat` ๆฅๆ่ฝฌๆข๏ผ็จ`String`ๅปๆฅๆถexcelๆฅๆๆ ผๅผ็ๆฐๆฎไผ่ฐ็จ่ฟไธชๆณจ่งฃใ้้ข็`value`ๅ็
ง`java.text.SimpleDateFormat`
* `NumberFormat` ๆฐๅญ่ฝฌๆข๏ผ็จ`String`ๅปๆฅๆถexcelๆฐๅญๆ ผๅผ็ๆฐๆฎไผ่ฐ็จ่ฟไธชๆณจ่งฃใ้้ข็`value`ๅ็
ง`java.text.DecimalFormat`
* `ExcelIgnoreUnannotated` ้ป่ฎคไธๅ `ExcelProperty` ็ๆณจ่งฃ็้ฝไผๅไธ่ฏปๅ๏ผๅ ไบไธไผๅไธ
### ๅๆฐ
#### ้็จๅๆฐ
`ReadWorkbook`,`ReadSheet` ้ฝไผๆ็ๅๆฐ๏ผๅฆๆไธบ็ฉบ๏ผ้ป่ฎคไฝฟ็จไธ็บงใ
* `converter` ่ฝฌๆขๅจ๏ผ้ป่ฎคๅ ่ฝฝไบๅพๅค่ฝฌๆขๅจใไนๅฏไปฅ่ชๅฎไนใ
* `readListener` ็ๅฌๅจ๏ผๅจ่ฏปๅๆฐๆฎ็่ฟ็จไธญไผไธๆญ็่ฐ็จ็ๅฌๅจใ
* `headRowNumber` ้่ฆ่ฏป็่กจๆ ผๆๅ ่กๅคดๆฐๆฎใ้ป่ฎคๆไธ่กๅคด๏ผไนๅฐฑๆฏ่ฎคไธบ็ฌฌไบ่กๅผๅง่ตทไธบๆฐๆฎใ
* `head` ไธ`clazz`ไบ้ไธใ่ฏปๅๆไปถๅคดๅฏนๅบ็ๅ่กจ๏ผไผๆ นๆฎๅ่กจๅน้
ๆฐๆฎ๏ผๅปบ่ฎฎไฝฟ็จclassใ
* `clazz` ไธ`head`ไบ้ไธใ่ฏปๅๆไปถ็ๅคดๅฏนๅบ็class๏ผไนๅฏไปฅไฝฟ็จๆณจ่งฃใๅฆๆไธคไธช้ฝไธๆๅฎ๏ผๅไผ่ฏปๅๅ
จ้จๆฐๆฎใ
* `autoTrim` ๅญ็ฌฆไธฒใ่กจๅคด็ญๆฐๆฎ่ชๅจtrim
* `password` ่ฏป็ๆถๅๆฏๅฆ้่ฆไฝฟ็จๅฏ็
#### ReadWorkbook๏ผ็่งฃๆexcelๅฏน่ฑก๏ผๅๆฐ
* `excelType` ๅฝๅexcel็็ฑปๅ ้ป่ฎคไผ่ชๅจๅคๆญ
* `inputStream` ไธ`file`ไบ้ไธใ่ฏปๅๆไปถ็ๆต๏ผๅฆๆๆฅๆถๅฐ็ๆฏๆตๅฐฑๅช็จ๏ผไธ็จๆตๅปบ่ฎฎไฝฟ็จ`file`ๅๆฐใๅ ไธบไฝฟ็จไบ`inputStream` easyexcelไผๅธฎๅฟๅๅปบไธดๆถๆไปถ๏ผๆ็ป่ฟๆฏ`file`
* `file` ไธ`inputStream`ไบ้ไธใ่ฏปๅๆไปถ็ๆไปถใ
* `autoCloseStream` ่ชๅจๅ
ณ้ญๆตใ
* `readCache` ้ป่ฎคๅฐไบ5M็จ ๅ
ๅญ๏ผ่ถ
่ฟ5Mไผไฝฟ็จ `EhCache`,่ฟ้ไธๅปบ่ฎฎไฝฟ็จ่ฟไธชๅๆฐใ
#### ReadSheet๏ผๅฐฑๆฏexcel็ไธไธชSheet๏ผๅๆฐ
* `sheetNo` ้่ฆ่ฏปๅSheet็็ผ็ ๏ผๅปบ่ฎฎไฝฟ็จ่ฟไธชๆฅๆๅฎ่ฏปๅๅชไธชSheet
* `sheetName` ๆ นๆฎๅๅญๅปๅน้
Sheet,excel 2003ไธๆฏๆๆ นๆฎๅๅญๅปๅน้
## ๅ
### ๆณจ่งฃ
* `ExcelProperty` index ๆๅฎๅๅฐ็ฌฌๅ ๅ๏ผ้ป่ฎคๆ นๆฎๆๅๅ้ๆๅบใ`value`ๆๅฎๅๅ
ฅ็ๅ็งฐ๏ผ้ป่ฎคๆๅๅ้็ๅๅญ๏ผๅคไธช`value`ๅฏไปฅๅ็
งๅฟซ้ๅผๅงไธญ็ๅคๆๅคด
* `ExcelIgnore` ้ป่ฎคๆๆๅญๆฎต้ฝไผๅๅ
ฅexcel๏ผ่ฟไธชๆณจ่งฃไผๅฟฝ็ฅ่ฟไธชๅญๆฎต
* `DateTimeFormat` ๆฅๆ่ฝฌๆข๏ผๅฐ`Date`ๅๅฐexcelไผ่ฐ็จ่ฟไธชๆณจ่งฃใ้้ข็`value`ๅ็
ง`java.text.SimpleDateFormat`
* `NumberFormat` ๆฐๅญ่ฝฌๆข๏ผ็จ`Number`ๅexcelไผ่ฐ็จ่ฟไธชๆณจ่งฃใ้้ข็`value`ๅ็
ง`java.text.DecimalFormat`
* `ExcelIgnoreUnannotated` ้ป่ฎคไธๅ `ExcelProperty` ็ๆณจ่งฃ็้ฝไผๅไธ่ฏปๅ๏ผๅ ไบไธไผๅไธ
### ๅๆฐ
#### ้็จๅๆฐ
`WriteWorkbook`,`WriteSheet` ,`WriteTable`้ฝไผๆ็ๅๆฐ๏ผๅฆๆไธบ็ฉบ๏ผ้ป่ฎคไฝฟ็จไธ็บงใ
* `converter` ่ฝฌๆขๅจ๏ผ้ป่ฎคๅ ่ฝฝไบๅพๅค่ฝฌๆขๅจใไนๅฏไปฅ่ชๅฎไนใ
* `writeHandler` ๅ็ๅค็ๅจใๅฏไปฅๅฎ็ฐ`WorkbookWriteHandler`,`SheetWriteHandler`,`RowWriteHandler`,`CellWriteHandler`๏ผๅจๅๅ
ฅexcel็ไธๅ้ถๆฎตไผ่ฐ็จ
* `relativeHeadRowIndex` ่ท็ฆปๅคๅฐ่กๅๅผๅงใไนๅฐฑๆฏๅผๅคด็ฉบๅ ่ก
* `needHead` ๆฏๅฆๅฏผๅบๅคด
* `head` ไธ`clazz`ไบ้ไธใๅๅ
ฅๆไปถ็ๅคดๅ่กจ๏ผๅปบ่ฎฎไฝฟ็จclassใ
* `clazz` ไธ`head`ไบ้ไธใๅๅ
ฅๆไปถ็ๅคดๅฏนๅบ็class๏ผไนๅฏไปฅไฝฟ็จๆณจ่งฃใ
* `autoTrim` ๅญ็ฌฆไธฒใ่กจๅคด็ญๆฐๆฎ่ชๅจtrim
#### WriteWorkbook๏ผ็่งฃๆexcelๅฏน่ฑก๏ผๅๆฐ
* `excelType` ๅฝๅexcel็็ฑปๅ ้ป่ฎค`xlsx`
* `outputStream` ไธ`file`ไบ้ไธใๅๅ
ฅๆไปถ็ๆต
* `file` ไธ`outputStream`ไบ้ไธใๅๅ
ฅ็ๆไปถ
* `templateInputStream` ๆจกๆฟ็ๆไปถๆต
* `templateFile` ๆจกๆฟๆไปถ
* `autoCloseStream` ่ชๅจๅ
ณ้ญๆตใ
* `password` ๅ็ๆถๅๆฏๅฆ้่ฆไฝฟ็จๅฏ็
* `useDefaultStyle` ๅ็ๆถๅๆฏๅฆๆฏไฝฟ็จ้ป่ฎคๅคด
#### WriteSheet๏ผๅฐฑๆฏexcel็ไธไธชSheet๏ผๅๆฐ
* `sheetNo` ้่ฆๅๅ
ฅ็็ผ็ ใ้ป่ฎค0
* `sheetName` ้่ฆไบ็Sheetๅ็งฐ๏ผ้ป่ฎคๅ`sheetNo`
#### WriteTable๏ผๅฐฑๆexcel็ไธไธชSheet,ไธๅๅบๅ็ไธไธชtable๏ผๅๆฐ
* `tableNo` ้่ฆๅๅ
ฅ็็ผ็ ใ้ป่ฎค0 | {
"source": "fast-excel/fastexcel",
"title": "docs/API.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/docs/API.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 2955
} |
# 10Mไปฅไธๆไปถ่ฏปๅ่ฏดๆ
03็ๆฒกๆๅๆณๅค็๏ผ็ธๅฏนๅ
ๅญๅ ็จๅคงๅพๅคใexcel 07็ๆฌๆไธชๅ
ฑไบซๅญ็ฌฆไธฒ[ๅ
ฑไบซๅญ็ฌฆไธฒ](https://docs.microsoft.com/zh-cn/office/open-xml/working-with-the-shared-string-table)็ๆฆๅฟต๏ผ่ฟไธชไผ้ๅธธๅ ็จๅ
ๅญ๏ผๅฆๆๅ
จ้จ่ฏปๅๅฐๅ
ๅญ็่ฏ๏ผๅคงๆฆๆฏexcelๆไปถ็ๅคงๅฐ็3-10ๅ๏ผๆไปฅeasyexcel็จๅญๅจๆไปถ็๏ผ็ถๅๅๅๅบๅๅๅป่ฏปๅ็็ญ็ฅๆฅ่็บฆๅ
ๅญใๅฝ็ถ้่ฆ้่ฟๆไปถๅๅบๅๅไปฅๅ๏ผๆ็ไผ้ไฝ๏ผๅคงๆฆ้ไฝ30-50%๏ผไธไธๅฎ๏ผไน็ๅฝไธญ็๏ผๅฏ่ฝไผ่ถ
่ฟ100%๏ผ
## ๅฆๆๅฏน่ฏปๅๆ็ๆ่ง่ฟ่ฝๆฅๅ๏ผๅฐฑ็จ้ป่ฎค็๏ผๆฐธไน
ๅ ็จ๏ผๅไธชexcel่ฏปๅๆดไธช่ฟ็จ๏ผไธ่ฌไธไผ่ถ
่ฟ50M(ๅคงๆฆ็ๅฐฑ30M)๏ผๅฉไธไธดๆถ็GCไผๅพๅฟซๅๆถ
## ้ป่ฎคๅคงๆไปถๅค็
้ป่ฎคๅคงๆไปถๅค็ไผ่ชๅจๅคๆญ๏ผๅ
ฑไบซๅญ็ฌฆไธฒ5Mไปฅไธไผไฝฟ็จๅ
ๅญๅญๅจ๏ผๅคงๆฆๅ ็จ15-50M็ๅ
ๅญ,่ถ
่ฟ5Mๅไฝฟ็จๆไปถๅญๅจ๏ผ็ถๅๆไปถๅญๅจไน่ฆ่ฎพ็ฝฎๅคๅ
ๅญM็จๆฅๅญๆพไธดๆถ็ๅ
ฑไบซๅญ็ฌฆไธฒ๏ผ้ป่ฎค20Mใ้คไบๅ
ฑไบซๅญ็ฌฆไธฒๅ ็จๅ
ๅญๅค๏ผๅ
ถไปๅ ็จ่พๅฐ๏ผๆไปฅๅฏไปฅ้ขไผฐ10M๏ผๆไปฅ้ป่ฎคๅคงๆฆ30Mๅฐฑ่ฝ่ฏปๅไธไธช่ถ
็บงๅคง็ๆไปถใ
## ๆ นๆฎๅฎ้
้ๆฑ้
็ฝฎๅ
ๅญ
ๆณ่ชๅฎไน่ฎพ็ฝฎ๏ผ้ฆๅ
่ฆ็กฎๅฎไฝ ๅคงๆฆๆฟๆ่ฑๅคๅฐๅ
ๅญๆฅ่ฏปๅไธไธช่ถ
็บงๅคง็excel,ๆฏๅฆๅธๆ่ฏปๅexcelๆๅคๅ ็จ100Mๅ
ๅญ๏ผๆฏ่ฏปๅ่ฟ็จไธญๆฐธไน
ๅ ็จ๏ผๆฐ็ไปฃ้ฉฌไธๅๆถ็ไธ็ฎ๏ผ๏ผ้ฃๅฐฑ่ฎพ็ฝฎไฝฟ็จๆไปถๆฅๅญๅจๅ
ฑไบซๅญ็ฌฆไธฒ็ๅคงๅฐๅคๆญไธบ20M(ๅฐไบ20Mๅญๅ
ๅญ๏ผๅคงไบๅญไธดๆถๆไปถ)๏ผ็ถๅ่ฎพ็ฝฎๆไปถๅญๅจๆถไธดๆถๅ
ฑไบซๅญ็ฌฆไธฒๅ ็จๅ
ๅญๅคงๅฐ90Mๅทฎไธๅค
### ๅฆๆๆๅคงๆไปถๆกๆฐไนๅฐฑๅๅ ไบๅไธ๏ผ็ถๅexcelไนๅฐฑๆฏๅๅ ไบๅM๏ผ่ไธไธไผๆๅพ้ซ็ๅนถๅ๏ผๅนถไธๅ
ๅญไน่พๅคง
```java
// ๅผบๅถไฝฟ็จๅ
ๅญๅญๅจ๏ผ่ฟๆ ทๅคงๆฆไธไธช20M็excelไฝฟ็จ150M๏ผๅพๅคไธดๆถๅฏน่ฑก๏ผๆไปฅ100Mไผไธ็ดGC๏ผ็ๅ
ๅญ
// ่ฟๆ ทๆ็ไผๆฏไธ้ข็ๅคๆ็็ญ็ฅ้ซๅพๅค
// ่ฟ้ๅ่ฏดๆไธ ๅฐฑๆฏๅ ไบไธชreadCache(new MapCache()) ๅๆฐ่ๅทฒ๏ผๅ
ถไป็ๅ็
งๅ
ถไปdemoๅ ่ฟ้ๆฒกๆๅๅ
จ
EasyExcel.read().readCache(new MapCache());
```
### ๅฏนๅนถๅ่ฆๆฑ่พ้ซ๏ผ่ไธ้ฝๆฏ็ปๅธธๆ่ถ
็บงๅคงๆไปถ
```java
// ็ฌฌไธไธชๅๆฐ็ๆๆๆฏ ๅคๅฐMๅ
ฑไบซๅญ็ฌฆไธฒไปฅๅ ้็จๆไปถๅญๅจ ๅไฝMB ้ป่ฎค5M
// ็ฌฌไบไธชๅๆฐ ๆไปถๅญๅจๆถ๏ผๅ
ๅญๅญๆพๅคๅฐM็ผๅญๆฐๆฎ ้ป่ฎค20M
// ๆฏๅฆ ไฝ ๅธๆ็จ100Mๅ
ๅญ(่ฟ้่ฏด็ๆฏ่งฃๆ่ฟ็จไธญ็ๆฐธไน
ๅ ็จ,ไธดๆถๅฏน่ฑกไธ็ฎ)ๆฅ่งฃๆexcel๏ผๅ้ข็ฎ่ฟไบ ๅคงๆฆๆฏ 20M+90M ๆไปฅ่ฎพ็ฝฎๅๆฐไธบ:20 ๅ 90
// ่ฟ้ๅ่ฏดๆไธ ๅฐฑๆฏๅ ไบไธชreadCacheSelector(new SimpleReadCacheSelector(5, 20))ๅๆฐ่ๅทฒ๏ผๅ
ถไป็ๅ็
งๅ
ถไปdemoๅ ่ฟ้ๆฒกๆๅๅ
จ
EasyExcel.read().readCacheSelector(new SimpleReadCacheSelector(5, 20));
```
### ๅ
ณไบmaxCacheActivateSize ไนๅฐฑๆฏๅ้ข็ฌฌไบไธชๅๆฐ็่ฏฆ็ป่ฏดๆ
easyexcelๅจไฝฟ็จๆไปถๅญๅจ็ๆถๅ๏ผไผๆๅ
ฑไบซๅญ็ฌฆไธฒๆๅๆ1000ๆกไธๆน๏ผ็ถๅๆพๅฐๆไปถๅญๅจใ็ถๅexcelๆฅ่ฏปๅๅ
ฑไบซๅญ็ฌฆไธฒๅคงๆฆ็ๆฏๆ็
ง้กบๅบ็๏ผๆไปฅ้ป่ฎค20M็1000ๆก็ๆฐๆฎๆพๅจๅ
ๅญ๏ผๅฝไธญๅ็ดๆฅ่ฟๅ๏ผๆฒกๅฝไธญๅป่ฏปๆไปถใๆไปฅไธ่ฝ่ฎพ็ฝฎๅคชๅฐ๏ผๅคชๅฐไบ๏ผๅพ้พๅฝไธญ๏ผไธ็ดๅป่ฏปๅๆไปถ๏ผๅคชๅคงไบ็่ฏไผๅ ็จ่ฟๅค็ๅ
ๅญใ
### ๅฆไฝๅคๆญ maxCacheActivateSizeๆฏๅฆ้่ฆ่ฐๆด
ๅผๅฏdebugๆฅๅฟไผ่พๅบ`Already put :4000000` ๆๅไธๆฌก่พๅบ๏ผๅคงๆฆๅฏไปฅๅพๅบๅผไธบ400W,็ถๅ็`Cache misses count:4001`ๅพๅฐๅผไธบ4K๏ผ400W/4K=1000 ่ฟไปฃ่กจๅทฒ็ป`maxCacheActivateSize` ๅทฒ็ป้ๅธธๅ็ไบใๅฆๆๅฐไบ500 ้ฎ้ขๅฐฑ้ๅธธๅคงไบ๏ผ500ๅฐ1000 ๅบ่ฏฅ้ฝ่ฟ่กใ | {
"source": "fast-excel/fastexcel",
"title": "docs/LARGEREAD.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/docs/LARGEREAD.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 1703
} |
# easyexcel-support
ๅค้จไพ่ต็ไปฃ็ ๏ผ็ฎๅๅฐฑไธไธชcglib๏ผ็ฑไบcglibไธๆฏๆjdk้ซ็ๆฌ๏ผๆไปฅๅ็ฌๅคๅถไบไธไปฝ | {
"source": "fast-excel/fastexcel",
"title": "fastexcel-support/README.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/fastexcel-support/README.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 66
} |
<!-- ่ฏท็กฎไฟไฝ ๅทฒ็ป้
่ฏปๅนถ็่งฃไบ่ดก็ฎๆๅ -->
### โ
. ๆ่ฟฐ่ฟไธช PR ๅไบไปไน
### โ
ก. ่ฟไธช pull request ๆฏๅฆไฟฎๅคไบไธไธช้ฎ้ข๏ผ
<!-- ๅฆๆๆฏ๏ผ่ฏทๅจไธไธ่กๆทปๅ โfix #xxxโ๏ผไพๅฆ fix #97ใ-->
### โ
ข. ไธบไปไนไธ้่ฆๆทปๅ ๆต่ฏ็จไพ๏ผๅๅ
ๆต่ฏ/้ๆๆต่ฏ๏ผ๏ผ
### โ
ฃ. ๆ่ฟฐๅฆไฝ้ช่ฏๅฎ
### โ
ค. ่ฏๅฎก็็นๅซ่ฏดๆ | {
"source": "fast-excel/fastexcel",
"title": ".github/PULL_REQUEST_TEMPLATE/pull_request_template.md",
"url": "https://github.com/fast-excel/fastexcel/blob/main/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md",
"date": "2024-10-05T11:42:50",
"stars": 3960,
"description": "easyexcelไฝ่
ๆๆฐๅ็บง็ๆฌ๏ผ ๅฟซ้ใ็ฎๆดใ่งฃๅณๅคงๆไปถๅ
ๅญๆบขๅบ็javaๅค็Excelๅทฅๅ
ท",
"file_size": 188
} |
# Changelog
## [2.22.0](https://github.com/folke/snacks.nvim/compare/v2.21.0...v2.22.0) (2025-02-25)
### Features
* **image:** allow disabling math rendering. Closes [#1247](https://github.com/folke/snacks.nvim/issues/1247) ([1543a06](https://github.com/folke/snacks.nvim/commit/1543a063fbd3a462879d696b2885f4aa90c55896))
* **image:** configurable templates for math expressions. Closes [#1338](https://github.com/folke/snacks.nvim/issues/1338) ([e039139](https://github.com/folke/snacks.nvim/commit/e039139291f85eebf3eeb41cc5ad9dc4265cafa4))
* **image:** removed `org` integration, since that is now handled by the org mode plugin directly. ([956fe69](https://github.com/folke/snacks.nvim/commit/956fe69df328d2da924a04061802fb7d2ec5fef6))
* **picker.input:** added some ctrl+r keymaps similar to cmdline. Closes [#1420](https://github.com/folke/snacks.nvim/issues/1420) ([c864a7d](https://github.com/folke/snacks.nvim/commit/c864a7d378da2a11afb09302b3220264e2aa3409))
* **util:** util method to check if ts lang is available on any Neovim version. See [#1422](https://github.com/folke/snacks.nvim/issues/1422) ([e2cb9df](https://github.com/folke/snacks.nvim/commit/e2cb9df7d0695911f60a4510191aaf4a3d0d81ad))
### Bug Fixes
* **compat:** fixup ([ceabfc1](https://github.com/folke/snacks.nvim/commit/ceabfc1b89fe8e46b5138ae2417890121f5dfa02))
* **compat:** properly detect async treesitter parsing ([842605f](https://github.com/folke/snacks.nvim/commit/842605f072e5d124a47eeb212bc2f78345bec4c4))
* **compat:** vim.fs.normalize. Closes [#1321](https://github.com/folke/snacks.nvim/issues/1321) ([2295cfc](https://github.com/folke/snacks.nvim/commit/2295cfcca5bc749f169fb83ca4bdea9a85ad79a3))
* **dim:** check that win is valid when animating dim. Closes [#1342](https://github.com/folke/snacks.nvim/issues/1342) ([47e1440](https://github.com/folke/snacks.nvim/commit/47e1440d547233772a3958580d429b38b5959edd))
* **image.placement:** max width/height in cells is 297. Closes [#1345](https://github.com/folke/snacks.nvim/issues/1345) ([5fa93cb](https://github.com/folke/snacks.nvim/commit/5fa93cb6846b5998bc0b4b4ac9de47108fe39ce6))
* **image.terminal:** reset queue when timer runs ([2b34c4d](https://github.com/folke/snacks.nvim/commit/2b34c4dc05aa4cbccc6171fa530e95c218e9bc9c))
* **image.terminal:** write queued terminal output on main ([1b63b18](https://github.com/folke/snacks.nvim/commit/1b63b1811c58f661ad22f390a52aa6723703dc3d))
* **picker.buffers:** add `a` flag when buffer is visible in a window. See [#1417](https://github.com/folke/snacks.nvim/issues/1417) ([91c3da0](https://github.com/folke/snacks.nvim/commit/91c3da0b4b286967d6d0166c0fc5769795a78918))
* **picker.recent:** expand to full path before normalizing. Closes [#1406](https://github.com/folke/snacks.nvim/issues/1406) ([cf47fa7](https://github.com/folke/snacks.nvim/commit/cf47fa7cee80b0952706aacd4068310fe041761e))
* **picker:** allow overriding winhl of layout box wins. Closes [#1424](https://github.com/folke/snacks.nvim/issues/1424) ([b0f983e](https://github.com/folke/snacks.nvim/commit/b0f983ef9aa9b9855ff0b72350cd3dc80de70675))
* **picker:** disable regex for grep_word ([#1363](https://github.com/folke/snacks.nvim/issues/1363)) ([54298eb](https://github.com/folke/snacks.nvim/commit/54298eb624bd89f10f288b92560861277a34116d))
* **picker:** remove unused keymaps for mouse scrolling ([33df54d](https://github.com/folke/snacks.nvim/commit/33df54dae71df7f7ec17551c23ad0ffc677e6ad1))
* **picker:** update titles before showing. Closes [#1337](https://github.com/folke/snacks.nvim/issues/1337) ([3ae9863](https://github.com/folke/snacks.nvim/commit/3ae98636aaaf8f1b2f55b264f5745ae268de532f))
* **scope:** use `rawequal` to check if scope impl is treesitter. Closes [#1413](https://github.com/folke/snacks.nvim/issues/1413) ([4ce197b](https://github.com/folke/snacks.nvim/commit/4ce197bff9cb9b78a0bdcebb6f7ebbf22cd48c6a))
* **scroll:** compat with Neovim 0.9.4 ([4c52b7f](https://github.com/folke/snacks.nvim/commit/4c52b7f25da0ce6b2b830ce060dbd162706acf33))
* **statuscolumn:** right-align the current line number when relativenumber=true. Closes [#1376](https://github.com/folke/snacks.nvim/issues/1376) ([dd15e3a](https://github.com/folke/snacks.nvim/commit/dd15e3a05a2111231c53726f18e39a147162c20f))
* **win:** don't update title is relative win is invalid. Closes [#1348](https://github.com/folke/snacks.nvim/issues/1348) ([a00c323](https://github.com/folke/snacks.nvim/commit/a00c323d4b244f781df6df8b11bbfa47f63202d4))
* **win:** use correct keys for displaying help. Closes [#1364](https://github.com/folke/snacks.nvim/issues/1364) ([b100c93](https://github.com/folke/snacks.nvim/commit/b100c937177536cf2aa634ddd2aa5b8a1dd23ace))
* **zen:** always count cmdheight towards Zen bottom offset ([#1402](https://github.com/folke/snacks.nvim/issues/1402)) ([041bf1d](https://github.com/folke/snacks.nvim/commit/041bf1da9ed12498cbe3273dd90ef83e0a4913fa))
### Performance Improvements
* **scope:** use async treesitter parsing when available ([e0f882e](https://github.com/folke/snacks.nvim/commit/e0f882e6d6464666319502151cc244a090d4377f))
## 2.21.0 (2025-02-20)
### Features
* added new `image` snacks plugin for the kitty graphics protocol ([4e4e630](https://github.com/folke/snacks.nvim/commit/4e4e63048e5ddae6f921f1a1b4bd11a53016c7aa))
* **bigfile:** configurable average line length (default = 1000). Useful for minified files. Closes [#576](https://github.com/folke/snacks.nvim/issues/576). Closes [#372](https://github.com/folke/snacks.nvim/issues/372) ([7fa92a2](https://github.com/folke/snacks.nvim/commit/7fa92a24501fa85b567c130b4e026f9ca1efed17))
* **compat:** added `svim`, a compatibility layer for Neovim. Closes [#1321](https://github.com/folke/snacks.nvim/issues/1321) ([bc902f7](https://github.com/folke/snacks.nvim/commit/bc902f7032df305df7dc48104cfa4e37967b3bdf))
* **debug:** graduate proc debug to Snacks.debug.cmd ([eced303](https://github.com/folke/snacks.nvim/commit/eced3033ea29bf9154a5f2c5207bf9fc97368599))
* **explorer:** `opts.include` and `opts.exclude`. Closes [#1068](https://github.com/folke/snacks.nvim/issues/1068) ([ab1889c](https://github.com/folke/snacks.nvim/commit/ab1889c35b1845f487f31f0399ec0c8bd2c6e521))
* **explorer:** added `Snacks.explorer.reveal()` to reveal the current file in the tree. ([b4cf6bb](https://github.com/folke/snacks.nvim/commit/b4cf6bb48d882a873a6954bff2802d88e8e19e0d))
* **explorer:** added copy/paste (yank/paste) for files. Closes [#1195](https://github.com/folke/snacks.nvim/issues/1195) ([938aee4](https://github.com/folke/snacks.nvim/commit/938aee4a02119ad693a67c38b64a9b3232a72565))
* **explorer:** added ctrl+f to grep in the item's directory ([0454b21](https://github.com/folke/snacks.nvim/commit/0454b21165cb84d2f59a1daf6226de065c90d4f7))
* **explorer:** added ctrl+t to open a terminal in the item's directory ([81f9006](https://github.com/folke/snacks.nvim/commit/81f90062c50430c1bad9546fcb65c3e43a76be9b))
* **explorer:** added diagnostics file/directory status ([7f1b60d](https://github.com/folke/snacks.nvim/commit/7f1b60d5576345af5e7b990f3a9e4bca49cd3686))
* **explorer:** added quick nav with `[`, `]` with `d/w/e` for diagnostics ([d1d5585](https://github.com/folke/snacks.nvim/commit/d1d55850ecb4aac1396c314a159db1e90a34bd79))
* **explorer:** added support for live search ([82c4a50](https://github.com/folke/snacks.nvim/commit/82c4a50985c9bb9f4b1d598f10a30e1122a35212))
* **explorer:** allow disabling untracked git status. Closes [#983](https://github.com/folke/snacks.nvim/issues/983) ([a3b083b](https://github.com/folke/snacks.nvim/commit/a3b083b8443b1ae1299747fdac8da51c3160835b))
* **explorer:** deal with existing buffers when renaming / deleting files. Closes [#1315](https://github.com/folke/snacks.nvim/issues/1315) ([6614a2c](https://github.com/folke/snacks.nvim/commit/6614a2c84f1ad8528aa03caeb2574b274ee0c20b))
* **explorer:** different hl group for broken links ([1989921](https://github.com/folke/snacks.nvim/commit/1989921466e6b5234ae8f71add41b8defd55f732))
* **explorer:** disable fuzzy searches by default for explorer since it's too noisy and we can't sort on score due to tree view ([b07788f](https://github.com/folke/snacks.nvim/commit/b07788f14a28daa8d0b387c1258f8f348f47420f))
* **explorer:** file watching that works on all platforms ([8399465](https://github.com/folke/snacks.nvim/commit/8399465872c51fab54ad5d02eb315e258ec96ed1))
* **explorer:** focus on first file when searching in the explorer ([1d4bea4](https://github.com/folke/snacks.nvim/commit/1d4bea4a9ee8a5258c6ae085ac66dd5cc05a9749))
* **explorer:** git index watcher ([4c12475](https://github.com/folke/snacks.nvim/commit/4c12475e80528d8d48b9584d78d645e4a51c3298))
* **explorer:** show symlink target ([dfa79e0](https://github.com/folke/snacks.nvim/commit/dfa79e04436ebfdc83ba71c0048fc1636b4de5aa))
* **git_log:** add author filter ([#1091](https://github.com/folke/snacks.nvim/issues/1091)) ([8c11661](https://github.com/folke/snacks.nvim/commit/8c1166165b17376ed87f0dedfc480c7cb8e42b7c))
* **gitbrowse:** add support for git.sr.ht ([#1297](https://github.com/folke/snacks.nvim/issues/1297)) ([a3b47e5](https://github.com/folke/snacks.nvim/commit/a3b47e5202d924e6a6d4386bb5f94cc5857c4f8c))
* **gitbrowse:** open permalinks to files. Fixes [#320](https://github.com/folke/snacks.nvim/issues/320) ([#438](https://github.com/folke/snacks.nvim/issues/438)) ([2a06e4c](https://github.com/folke/snacks.nvim/commit/2a06e4ce9957dea555d38b4f52024ea9e2902d8e))
* **image.doc:** allow configuring the header for latex / typst inline in the document. Closes [#1303](https://github.com/folke/snacks.nvim/issues/1303) ([bde3add](https://github.com/folke/snacks.nvim/commit/bde3adddc7d787c5e93eb13af55b6e702d86418b))
* **image.doc:** allow setting `image.src` with `#set!`. Closes [#1276](https://github.com/folke/snacks.nvim/issues/1276) ([65f89e2](https://github.com/folke/snacks.nvim/commit/65f89e2d6f3790b0687f09ebe2811d953bd09e0c))
* **image.doc:** check for `image.ignore` in ts meta. See [#1276](https://github.com/folke/snacks.nvim/issues/1276) ([29c777a](https://github.com/folke/snacks.nvim/commit/29c777a0a0291a0caba17f2e9aeb86b6097fc83c))
* **image:** `conceal` option for inline rendering (disabled by default) ([684666f](https://github.com/folke/snacks.nvim/commit/684666f6432eae139b8ca6813b1a88679f8febc1))
* **image:** `Snacks.image.hover()` ([5f466be](https://github.com/folke/snacks.nvim/commit/5f466becd96ebcd0a52352f2d53206e0e86de35a))
* **image:** add support for `svelte` ([#1277](https://github.com/folke/snacks.nvim/issues/1277)) ([54ab77c](https://github.com/folke/snacks.nvim/commit/54ab77c5d2b2edefa29fc63de73c7b2b60d2651b))
* **image:** adde support for `Image` in jsx ([95878ad](https://github.com/folke/snacks.nvim/commit/95878ad32aaf310f465a004ef12e9edddf939287))
* **image:** added `opts.img_dirs` to configure the search path for resolving images. Closes [#1222](https://github.com/folke/snacks.nvim/issues/1222) ([ad0b88d](https://github.com/folke/snacks.nvim/commit/ad0b88dc0814dc760c7b6ed4efc7c2fa8d27ba76))
* **image:** added `Snacks.image.doc.at_cursor()`. See [#1108](https://github.com/folke/snacks.nvim/issues/1108) ([6348ccf](https://github.com/folke/snacks.nvim/commit/6348ccf1209739552f70800910c206637f3b2d2c))
* **image:** added fallback image rendering for wezterm. Closes [#1063](https://github.com/folke/snacks.nvim/issues/1063) ([9e6b1a6](https://github.com/folke/snacks.nvim/commit/9e6b1a62a87aa201dea13a755f6ac1ed680a20d1))
* **image:** added math rendering for typst. Closes [#1260](https://github.com/folke/snacks.nvim/issues/1260) ([e225823](https://github.com/folke/snacks.nvim/commit/e2258236a2fc770a87a81125232ca786ec7a1cf1))
* **image:** added proper support for tmux ([b1a3b66](https://github.com/folke/snacks.nvim/commit/b1a3b66fade926e9d211453275ddf1be19a847a5))
* **image:** added support for `.image` tags in neorg ([59bbe8d](https://github.com/folke/snacks.nvim/commit/59bbe8d90e91d4b4f63cc5fcb36c81bd8eeee850))
* **image:** added support for `typst`. Closes [#1235](https://github.com/folke/snacks.nvim/issues/1235) ([507c183](https://github.com/folke/snacks.nvim/commit/507c1836e3c5cfc5194bb6350ece1a1e0a1edf14))
* **image:** added support for a bunch of aditional languages ([a596f8a](https://github.com/folke/snacks.nvim/commit/a596f8a9ea0a058490bca8aca70f935cded18d22))
* **image:** added support for angle bracket urls. Closes [#1209](https://github.com/folke/snacks.nvim/issues/1209) ([14a1f32](https://github.com/folke/snacks.nvim/commit/14a1f32eafd50b5b6ae742052e6da04b1e0167b2))
* **image:** added support for math expressions in latex and markdown doc + images in latex. Closes [#1223](https://github.com/folke/snacks.nvim/issues/1223) ([1bca71a](https://github.com/folke/snacks.nvim/commit/1bca71a1332e3119ece0e62d668b75e6c98d948c))
* **image:** added support for mermaid diagrams in markdown ([f8e7942](https://github.com/folke/snacks.nvim/commit/f8e7942d6c83a1b1953320054102eb32bf536d98))
* **image:** added support for remote image viewing. Closes [#1156](https://github.com/folke/snacks.nvim/issues/1156) ([#1165](https://github.com/folke/snacks.nvim/issues/1165)) ([a5748ea](https://github.com/folke/snacks.nvim/commit/a5748ea8db2ac14fbc9c05376cc6d154d749f881))
* **image:** added support for tsx, jsx, vue and angular ([ab0ba5c](https://github.com/folke/snacks.nvim/commit/ab0ba5cb22d7bf62fa204f08426e601a20750f29))
* **image:** added support for wikilink style images. Closes [#1210](https://github.com/folke/snacks.nvim/issues/1210) ([3fda272](https://github.com/folke/snacks.nvim/commit/3fda27200d9af7ed181e9ee0a841c50137e9a5be))
* **image:** allow customizing font size for math expressions ([b052eb9](https://github.com/folke/snacks.nvim/commit/b052eb93728df6cc0c09b7ee42fec6d93477fc3e))
* **image:** allow customizing the default magick args for vector images ([2096fcd](https://github.com/folke/snacks.nvim/commit/2096fcdd739500ba8275d791b20d60f306c61b33))
* **image:** allow forcing image rendering even when the terminal support detection fails ([d17a6e4](https://github.com/folke/snacks.nvim/commit/d17a6e4af888c43ba3faddc30231aa2aebc699d4))
* **image:** apply image window options ([73366fa](https://github.com/folke/snacks.nvim/commit/73366fa17018d7fd4d115cec2466b2d8e7233341))
* **image:** better detection of image capabilities of the terminal/mux environment ([1795d4b](https://github.com/folke/snacks.nvim/commit/1795d4b1ec767886300faa4965539fe67318a06a))
* **image:** better error handling + option to disable error notifications ([1adfd29](https://github.com/folke/snacks.nvim/commit/1adfd29af3d1b4db2ba46f7a292410a2f9105fd6))
* **image:** better health checks ([d389c5d](https://github.com/folke/snacks.nvim/commit/d389c5df14d83b6aff9eb6734906888780e8ca71))
* **image:** check for `magick` in health check ([1284835](https://github.com/folke/snacks.nvim/commit/12848356c4fd672476f47d9dea9999784c140c05))
* **image:** custom `src` resolve function ([af21ea3](https://github.com/folke/snacks.nvim/commit/af21ea3ccf6c11246cfbb1bef061caa4f387f1f0))
* **image:** enabled pdf previews ([39bf513](https://github.com/folke/snacks.nvim/commit/39bf5131c4f8cd79c1779a5cb80e526cf9e4fffe))
* **image:** floats in markdown. Closes [#1151](https://github.com/folke/snacks.nvim/issues/1151) ([4e10e31](https://github.com/folke/snacks.nvim/commit/4e10e31398e6921ac19371099f06640b8753bc8a))
* **image:** health checks ([0d5b106](https://github.com/folke/snacks.nvim/commit/0d5b106d4eae756cd612fdabde36aa795a444546))
* **image:** images are now properly scaled based on device DPI and image DPI. Closing [#1257](https://github.com/folke/snacks.nvim/issues/1257) ([004050c](https://github.com/folke/snacks.nvim/commit/004050c43533ac38a224649268e913c6fb0c4caa))
* **image:** make manual hover work correctly ([942cb92](https://github.com/folke/snacks.nvim/commit/942cb9291e096d8604d515499e295ec67578b71a))
* **image:** make math packages configurable. Closes [#1295](https://github.com/folke/snacks.nvim/issues/1295) ([e27ba72](https://github.com/folke/snacks.nvim/commit/e27ba726b15e71eca700141c2030ac858bc8025c))
* **image:** markdown inline image preview. `opts.image` must be enabled and terminal needs support ([001f300](https://github.com/folke/snacks.nvim/commit/001f3002cabb9e23d8f1b23e0567db2d41c098a6))
* **image:** refactor + css/html + beter image fitting ([e35d6cd](https://github.com/folke/snacks.nvim/commit/e35d6cd4ba87e8ff71d6ebe52b7be53408e13538))
* **image:** refactor of treesitter queries to support inline image data ([0bf0c62](https://github.com/folke/snacks.nvim/commit/0bf0c6223d71ced4e5dc7ab7357b0a36a91a0a67))
* **images:** added support for org-mode. Closes [#1276](https://github.com/folke/snacks.nvim/issues/1276) ([10387af](https://github.com/folke/snacks.nvim/commit/10387af009e51678788506527b46240b2139fd7f))
* **image:** show progress indicator when converting image files ([b65178b](https://github.com/folke/snacks.nvim/commit/b65178b470385f0a81256d54c9d80f153cd14efd))
* **image:** try resolving paths relative to the document and to the cwd. See [#1203](https://github.com/folke/snacks.nvim/issues/1203) ([668cbbb](https://github.com/folke/snacks.nvim/commit/668cbbba473d757144e24188b458e57dc0e98943))
* **image:** url_decode strings ([d41704f](https://github.com/folke/snacks.nvim/commit/d41704f3daae823513c90adb913976bfabc36387))
* **image:** use `tectonic` when available ([8d073cc](https://github.com/folke/snacks.nvim/commit/8d073ccc0ca984f844cc2a8f8506f23f3fcea56a))
* **image:** use kitty's unicode placeholder images ([7d655fe](https://github.com/folke/snacks.nvim/commit/7d655fe09d2c705ff5707902f4ed925a62a61d3b))
* **image:** use search dirs to resolve file from both cwd and dirname of file. Closes [#1305](https://github.com/folke/snacks.nvim/issues/1305) ([bf01460](https://github.com/folke/snacks.nvim/commit/bf01460e6d82b720fb50664d372c1daf5ade249d))
* **image:** utility function to get a png dimensions from the file header ([a6d866a](https://github.com/folke/snacks.nvim/commit/a6d866ab72e5cad7840d69a7354cc67e2699f46e))
* **matcher:** call on_match after setting score ([23ce529](https://github.com/folke/snacks.nvim/commit/23ce529fb663337f9dc17ca08aa601b172469031))
* **picker.actions:** `cmd` action now always allows to edit the command. Closes [#1033](https://github.com/folke/snacks.nvim/issues/1033) ([a177885](https://github.com/folke/snacks.nvim/commit/a17788539a5e66784535d0c973bdc08728f16c46))
* **picker.actions:** option to disable notify for yank action. Closes [#1117](https://github.com/folke/snacks.nvim/issues/1117) ([f6a807d](https://github.com/folke/snacks.nvim/commit/f6a807da6d4e6ab591f85592a472bbb5bc6583f7))
* **picker.config:** better source field spec ([6c58b67](https://github.com/folke/snacks.nvim/commit/6c58b67890bbd2076a7f5b69f57ab666cb9b7410))
* **picker.db:** allow configuring the sqlite3 lib path. Closes [#1025](https://github.com/folke/snacks.nvim/issues/1025) ([b990044](https://github.com/folke/snacks.nvim/commit/b9900444d2ea494bba8857e5224059002ee8c465))
* **picker.files:** added `ft` option to filter by extension(s) ([12a7ea2](https://github.com/folke/snacks.nvim/commit/12a7ea28b97827575a1768d6013dd3c7bedd5ebb))
* **picker.format:** `opts.formatters.file.use_git_status_hl` defaults to `true` and adds git status hl to filename ([243eeca](https://github.com/folke/snacks.nvim/commit/243eecaca5f465602a9ba68e5c0fa375b90a13fb))
* **picker.git_diff:** use the `diff` previewer for `git_diff` so that `delta` can be used. See [#1302](https://github.com/folke/snacks.nvim/issues/1302) ([92786c5](https://github.com/folke/snacks.nvim/commit/92786c5b03ae4772521050acabcb619283eeb94a))
* **picker.git:** add confirmation before deleting a git branch ([#951](https://github.com/folke/snacks.nvim/issues/951)) ([337a3ae](https://github.com/folke/snacks.nvim/commit/337a3ae7eebb95020596f15a349a85d2f6be31a4))
* **picker.git:** add create and delete branch to git_branches ([#909](https://github.com/folke/snacks.nvim/issues/909)) ([8676c40](https://github.com/folke/snacks.nvim/commit/8676c409e148e28eff93c114aca0c1bf3d42281a))
* **picker.git:** allow passing extra args to git grep. Closes [#1184](https://github.com/folke/snacks.nvim/issues/1184) ([7122a03](https://github.com/folke/snacks.nvim/commit/7122a03fdf0b7bb9a5c6645b0e86f9e3a9f9290b))
* **picker.git:** allow passing extra args to other git pickers ([#1205](https://github.com/folke/snacks.nvim/issues/1205)) ([4d46574](https://github.com/folke/snacks.nvim/commit/4d46574b247d72bf1a602cdda2ddd8da39854234))
* **picker.lazy:** don't use `grep`. Parse spec files manually. Closes [#972](https://github.com/folke/snacks.nvim/issues/972) ([0928007](https://github.com/folke/snacks.nvim/commit/09280078e8339f018be5249fe0e1d7b9d32db7f7))
* **picker.lsp:** added original symbol to item.item. Closes [#1171](https://github.com/folke/snacks.nvim/issues/1171) ([45a6f8d](https://github.com/folke/snacks.nvim/commit/45a6f8d1ee0c323246413d1e1d43b0f0c9da18a2))
* **picker.lsp:** use existing buffers for preview when opened ([d4e6353](https://github.com/folke/snacks.nvim/commit/d4e63531c9fba63ded6fb470a5d53c98af110478))
* **picker.preview:** allow confguring `preview = {main = true, enabled = false}` ([1839c65](https://github.com/folke/snacks.nvim/commit/1839c65f6784bedb7ae96a84ee741fa5c0023226))
* **picker.preview:** allow passing additional args to the git preview command ([910437f](https://github.com/folke/snacks.nvim/commit/910437f1451ccaaa495aa1eca99e0a73fc798d40))
* **picker.proc:** added proc debug mode ([d870f16](https://github.com/folke/snacks.nvim/commit/d870f164534d1853fd8c599d7933cc5324272a09))
* **picker.undo:** `ctrl+y` to yank added lines, `ctrl+shift+y` to yank deleted lines ([3baf95d](https://github.com/folke/snacks.nvim/commit/3baf95d3a1005105b57ce53644ff6224ee3afa1c))
* **picker.undo:** added ctrl+y to yank added lines from undo ([811a24c](https://github.com/folke/snacks.nvim/commit/811a24cc16a8e9b7ec947c95b73e1fe05e4692d1))
* **picker.util:** lua globber ([97dcd9c](https://github.com/folke/snacks.nvim/commit/97dcd9c168c667538a4c6cc1384c4981a37afcad))
* **picker.util:** utility function to get all bins on the PATH ([5d42c7e](https://github.com/folke/snacks.nvim/commit/5d42c7e5e480bde04fd9506b3df64b579446c4f9))
* **picker:** `opts.focus` can be used to set default focus window. `opts.enter` if picker should be focused on enter. Closes [#1162](https://github.com/folke/snacks.nvim/issues/1162) ([e8de28b](https://github.com/folke/snacks.nvim/commit/e8de28b56ec85ad45cdb3c303c5ee5da0e070baf))
* **picker:** add LSP symbol range to result item ([#1123](https://github.com/folke/snacks.nvim/issues/1123)) ([c0481ab](https://github.com/folke/snacks.nvim/commit/c0481ab0b69c6111bfc5077bd1550acbb480f05d))
* **picker:** added `c-q` to list ([6d0d2dc](https://github.com/folke/snacks.nvim/commit/6d0d2dc2a7e07de9704a172bd5295f4920eb965f))
* **picker:** added `git_grep` picker. Closes [#986](https://github.com/folke/snacks.nvim/issues/986) ([2dc9016](https://github.com/folke/snacks.nvim/commit/2dc901634b250059cc9b7129bdeeedd24520b86c))
* **picker:** added `lsp_config` source ([0d4aa98](https://github.com/folke/snacks.nvim/commit/0d4aa98cea0de6144853d820e52e6e35d0f0c609))
* **picker:** added treesitter symbols picker ([a6beb0f](https://github.com/folke/snacks.nvim/commit/a6beb0f280d3f43513998882faf199acf3818ddf))
* **picker:** allow complex titles ([#1112](https://github.com/folke/snacks.nvim/issues/1112)) ([f200b3f](https://github.com/folke/snacks.nvim/commit/f200b3f6c8f84147e1a80f70b8f1714645c59af6))
* **picker:** allow configuring file icon width. Closes [#981](https://github.com/folke/snacks.nvim/issues/981) ([52c1086](https://github.com/folke/snacks.nvim/commit/52c1086ecdf410dfec3317144d46de7c6f86c1ad))
* **picker:** allow overriding default file/dir/dir_open icons. Closes [#1199](https://github.com/folke/snacks.nvim/issues/1199) ([41c4391](https://github.com/folke/snacks.nvim/commit/41c4391b72ff5ef3dfa8216fc608bbe02bbd4d1c))
* **picker:** default `c-t` keymap to open in tab ([ffc6fe3](https://github.com/folke/snacks.nvim/commit/ffc6fe3965cb176c2b3e2bdb0aee4478e4dc2b94))
* **picker:** each window can now be `toggled` (also input), `hidden` and have `auto_hide` ([01efab2](https://github.com/folke/snacks.nvim/commit/01efab2ddb75d2077229231201c5a69ab2df3ad8))
* **picker:** get filetype from modeline when needed. Closes [#987](https://github.com/folke/snacks.nvim/issues/987) ([5af04ab](https://github.com/folke/snacks.nvim/commit/5af04ab6672ae38bf7d72427e75f925615f93904))
* **picker:** image previewer using kitty graphics protocol ([2b0aa93](https://github.com/folke/snacks.nvim/commit/2b0aa93efc9aa662e0cb9446cc4639f3be1a9d1e))
* **picker:** new native diff mode (disabled by default). Can be used to show delta diffs for undo. Closes [#1288](https://github.com/folke/snacks.nvim/issues/1288) ([d6a38ac](https://github.com/folke/snacks.nvim/commit/d6a38acbf5765eeb5ca2558bcb0d1ae1428dd2ca))
* **picker:** pin picker as a split to left/bottom/top/right with `ctrl+z+(hjkl)` ([27cba53](https://github.com/folke/snacks.nvim/commit/27cba535a6763cbca3f3162c5c4bb48c6f382005))
* **picker:** renamed `native` -> `builtin` + fixed diff mode used for undo. Closes [#1302](https://github.com/folke/snacks.nvim/issues/1302) ([bd6a62a](https://github.com/folke/snacks.nvim/commit/bd6a62af12ca5e8cab88b94912e65bff26c9feba))
* **scope:** allow injected languages to be parsed by treesitter ([#823](https://github.com/folke/snacks.nvim/issues/823)) ([aba21dd](https://github.com/folke/snacks.nvim/commit/aba21ddc712b12db8469680dd7f2080063cb6d5c))
* **scroll:** big rework to make scroll play nice with virtual lines ([e71955a](https://github.com/folke/snacks.nvim/commit/e71955a941300cd81bf6d7ab36d1352b62d6f568))
* **scroll:** scroll improvements. Closes [#1024](https://github.com/folke/snacks.nvim/issues/1024) ([73d2f0f](https://github.com/folke/snacks.nvim/commit/73d2f0f40c702acaf7a1a3e833fc5460cb552578))
* **statuscolumn:** added mouse click handler to open/close folds. Closes [#968](https://github.com/folke/snacks.nvim/issues/968) ([98a7b64](https://github.com/folke/snacks.nvim/commit/98a7b647c9e245ef02d57d566bf8461c2f7beb56))
* **terminal:** added `Snacks.terminal.list()`. Closes [#421](https://github.com/folke/snacks.nvim/issues/421). Closes [#759](https://github.com/folke/snacks.nvim/issues/759) ([73c4b62](https://github.com/folke/snacks.nvim/commit/73c4b628963004760ccced0192d1c2633c9e3657))
* **terminal:** added `start_insert` ([64129e4](https://github.com/folke/snacks.nvim/commit/64129e4c3c5b247c61b1f46bc0faaa1e69e7eef8))
* **terminal:** auto_close and auto_insert. Closes [#965](https://github.com/folke/snacks.nvim/issues/965) ([bb76cae](https://github.com/folke/snacks.nvim/commit/bb76cae87e81a871435570b91c8c6f6e27eb9955))
* **terminal:** don't use deprecated `vim.fn.termopen` on Neovim >= 0.10 ([37f6665](https://github.com/folke/snacks.nvim/commit/37f6665c488d90bf50b99cfe0b0fab40f990c497))
* test ([520ed85](https://github.com/folke/snacks.nvim/commit/520ed85169c873a8492077520ff37a5f0233c67d))
* **toggle:** allow user to add custom which-key description ([#1121](https://github.com/folke/snacks.nvim/issues/1121)) ([369732e](https://github.com/folke/snacks.nvim/commit/369732e65e0077e51487547131045526ccbdad1b))
* **treesitter:** add `tree` boolean to toggle on/off tree symbols ([#1105](https://github.com/folke/snacks.nvim/issues/1105)) ([c61f9eb](https://github.com/folke/snacks.nvim/commit/c61f9eb28695b9f96682d6dbf67072947dfa2737))
* **util:** `Snacks.util.winhl` helper to deal with `vim.wo.winhighlight` ([4c1d7b4](https://github.com/folke/snacks.nvim/commit/4c1d7b4720218122885877877e7883cc491133ed))
* **util:** base64 shim for Neovim < 0.10 ([96f1227](https://github.com/folke/snacks.nvim/commit/96f12274a49bb2e6d0d558e652c728d27d4c3ff8))
* **util:** Snacks.util.color can now get the color from a list of hl groups ([a33f65d](https://github.com/folke/snacks.nvim/commit/a33f65d936a85efa9aaee9e44bcd70069134a816))
* **util:** util.spawn ([a76fe13](https://github.com/folke/snacks.nvim/commit/a76fe13148a899274484972a8705052bef4baa93))
* **words:** add `filter` function for user to disable specific filetypes ([#1296](https://github.com/folke/snacks.nvim/issues/1296)) ([d62e752](https://github.com/folke/snacks.nvim/commit/d62e7527a5e9608ab0033bc63a329baf8757ea6d))
### Bug Fixes
* **all:** better support for opening windows / pickers / ... on multiple tab pages. Closes [#1043](https://github.com/folke/snacks.nvim/issues/1043) ([8272c1c](https://github.com/folke/snacks.nvim/commit/8272c1c66f43390294debb24759c32627653aedb))
* **bigfile:** check that passed path is the one from the buffer ([8deea64](https://github.com/folke/snacks.nvim/commit/8deea64dba3b9b8f57e52bb6b0133263f6ff171f))
* **buffers:** use `"` mark for full buffer position when set. Closes [#1160](https://github.com/folke/snacks.nvim/issues/1160) ([7d350bc](https://github.com/folke/snacks.nvim/commit/7d350bc0c7e897ad0d7bd7fc9a470dabecab32ca))
* **compat:** correct Neovim 0.11 check ([448a55a](https://github.com/folke/snacks.nvim/commit/448a55a0e3c437bacc945c4ea98a6342ccb2b769))
* **dashboard:** allow dashboard to be the main editor window ([e3ead3c](https://github.com/folke/snacks.nvim/commit/e3ead3c648b3b6c8af0557c6412ae0307cc92018))
* **dashboard:** dashboard can be a main editor window ([f36c70a](https://github.com/folke/snacks.nvim/commit/f36c70a912c2893b10336b4645d3447264813a34))
* **dashboard:** use `Snacks.util.icon` for icons. Closes [#1192](https://github.com/folke/snacks.nvim/issues/1192) ([c2f06da](https://github.com/folke/snacks.nvim/commit/c2f06daeca6c3304d1e94225323dbe8c2f7f797d))
* **debug:** better args handling for debugging cmds ([48a3fed](https://github.com/folke/snacks.nvim/commit/48a3fed3c51390650d134bc5d76d15ace8d614ea))
* **explorer.git:** always at `.git` directory to ignored ([f7a35b8](https://github.com/folke/snacks.nvim/commit/f7a35b8214f393e2412adc0c8f2fe85d956c4b02))
* **explorer.git:** better git status watching ([09349ec](https://github.com/folke/snacks.nvim/commit/09349ecd44040666db9d4835994a378a9ff53e8c))
* **explorer.git:** dont reset cursor when git status is done updating ([bc87992](https://github.com/folke/snacks.nvim/commit/bc87992e712c29ef8e826f3550f9b8e3f1a9308d))
* **explorer.git:** vim.schedule git updates ([3aad761](https://github.com/folke/snacks.nvim/commit/3aad7616209951320d54f83dd7df35d5578ea61f))
* **explorer.tree:** fix linux ([6f5399b](https://github.com/folke/snacks.nvim/commit/6f5399b47c55f916fcc3a82dcc71cce0eb5d7c92))
* **explorer.tree:** symlink directories ([e5f1e91](https://github.com/folke/snacks.nvim/commit/e5f1e91249b468ff3a7d14a8650074c27f1fdb30))
* **explorer.watch:** pcall watcher, since it can give errors on windows ([af96818](https://github.com/folke/snacks.nvim/commit/af968181af6ce6a988765fe51558b2caefdcf863))
* **explorer:** always refresh state when opening the picker since changes might have happened that were not monitored ([c61114f](https://github.com/folke/snacks.nvim/commit/c61114fb32910863a543a4a7a1f63e9915983d26))
* **explorer:** call original `on_close`. Closes [#971](https://github.com/folke/snacks.nvim/issues/971) ([a0bee9f](https://github.com/folke/snacks.nvim/commit/a0bee9f662d4e22c6533e6544b4daedecd2aacc0))
* **explorer:** change grep in item dir keymap to leader-/. Closes [#1000](https://github.com/folke/snacks.nvim/issues/1000) ([9dfa276](https://github.com/folke/snacks.nvim/commit/9dfa276ea424a091f5d5bdc008aff127850441b2))
* **explorer:** check that picker is still open ([50fa1be](https://github.com/folke/snacks.nvim/commit/50fa1be38ee8366d79e1fa58b38abf31d3955033))
* **explorer:** disable follow for explorer search by default. No longer needed. Link directories may show as files then though, but that's not an issue. See [#960](https://github.com/folke/snacks.nvim/issues/960) ([b9a17d8](https://github.com/folke/snacks.nvim/commit/b9a17d82a726dc6cfd9a0b4f8566178708073808))
* **explorer:** dont focus first file when not searching ([3fd437c](https://github.com/folke/snacks.nvim/commit/3fd437ccd38d79b876154097149d130cdb01e653))
* **explorer:** dont process git when picker closed ([c255d9c](https://github.com/folke/snacks.nvim/commit/c255d9c6a02f070f0048c5eaa40921f71e9f2acb))
* **explorer:** last status for indent guides taking hidden / ignored files into account ([94bd2ef](https://github.com/folke/snacks.nvim/commit/94bd2eff74acd7faa78760bf8a55d9c269e99190))
* **explorer:** strip cwd from search text for explorer items ([38f392a](https://github.com/folke/snacks.nvim/commit/38f392a8ad75ced790f89c8ef43a91f98a2bb6e3))
* **explorer:** windows ([b560054](https://github.com/folke/snacks.nvim/commit/b56005466952b759a2f610e8b3c8263444402d76))
* **exporer.tree:** and now hopefully on windows ([ef9b12d](https://github.com/folke/snacks.nvim/commit/ef9b12d68010a931c76533925a8c730123241635))
* **gitbrowse:** add support for GitHub Enterprise Cloud repo url ([#1089](https://github.com/folke/snacks.nvim/issues/1089)) ([97fd57e](https://github.com/folke/snacks.nvim/commit/97fd57e8a0555023d2968354ca5f2b62de988103))
* **gitbrowse:** cwd for permalinks ([#1038](https://github.com/folke/snacks.nvim/issues/1038)) ([0bf47dc](https://github.com/folke/snacks.nvim/commit/0bf47dc319e4d6848366aff5c1a42cd08672d3e3))
* **gitbrowse:** previous logic always overwrote 'commit' ([#1127](https://github.com/folke/snacks.nvim/issues/1127)) ([2f3f080](https://github.com/folke/snacks.nvim/commit/2f3f080ede4d5f75c0b02d1698156648832cb974))
* **git:** use nul char as separator for git status ([8e0dfd2](https://github.com/folke/snacks.nvim/commit/8e0dfd285665bedf67441efe11c9c1318781826f))
* **health:** skip dot dirs... Closes [#1293](https://github.com/folke/snacks.nvim/issues/1293) ([aaed4a9](https://github.com/folke/snacks.nvim/commit/aaed4a94111ddfd9d23cdecb01e4ae53030c2c3e))
* **image.doc:** crop inline typst equations properly ([#1320](https://github.com/folke/snacks.nvim/issues/1320)) ([4f8b9eb](https://github.com/folke/snacks.nvim/commit/4f8b9ebf717b8acf41be02b0bd5a6d75f6038ea7))
* **image.doc:** fixed at_cursor. Closes [#1258](https://github.com/folke/snacks.nvim/issues/1258) ([76f5ee4](https://github.com/folke/snacks.nvim/commit/76f5ee4a1bd2566fc1460a1b11aa6a0bc36d2f5d))
* **image.health:** add check for ghost-script to render pdfs. Closes [#1248](https://github.com/folke/snacks.nvim/issues/1248) ([2b52d89](https://github.com/folke/snacks.nvim/commit/2b52d89508a448a1ca0c500afbd325e77023afc1))
* **image.health:** allow `convert` if `magick` not available ([4589e25](https://github.com/folke/snacks.nvim/commit/4589e2575894090a1e62aae11cf17856f5b84ea5))
* **image.hover:** close when needed. Closes [#1229](https://github.com/folke/snacks.nvim/issues/1229) ([1f9ba12](https://github.com/folke/snacks.nvim/commit/1f9ba127554bd3bd9780bfb925adfdf1e0ee73f9))
* **image.latex:** include doc packages for math rendering. Closes [#1262](https://github.com/folke/snacks.nvim/issues/1262) ([2ee6488](https://github.com/folke/snacks.nvim/commit/2ee64887c2be80c6b7b8fac4bb0617c827fde0d0))
* **image.latex:** inline math formulas. Closes [#1246](https://github.com/folke/snacks.nvim/issues/1246) ([9e422e1](https://github.com/folke/snacks.nvim/commit/9e422e12876002cba59ac4825bbeea89996e0196))
* **image.markdown:** fix image treesitter query. Closes [#1300](https://github.com/folke/snacks.nvim/issues/1300) ([830ac62](https://github.com/folke/snacks.nvim/commit/830ac62815e70f3db35ed7a295710c836578c6e3))
* **image.terminal:** set passthrough=all instead of on for tmux. Closes [#1249](https://github.com/folke/snacks.nvim/issues/1249) ([efcc25d](https://github.com/folke/snacks.nvim/commit/efcc25dcfa3ccaa7aa0a11b6cf065f8b8d32e485))
* **image:** added support for relative paths. Closes [#1143](https://github.com/folke/snacks.nvim/issues/1143) ([2ef6375](https://github.com/folke/snacks.nvim/commit/2ef63754b9c2a835a1d464766a22ba1bd4b16ea3))
* **image:** better cell size calculation for non-HDPI displays ([e146a66](https://github.com/folke/snacks.nvim/commit/e146a66cb767c60c6e84b2ab9a4522abdb6a5cc0))
* **image:** better image position caluclation. Closes [#1268](https://github.com/folke/snacks.nvim/issues/1268) ([5c0607e](https://github.com/folke/snacks.nvim/commit/5c0607e31a76317bc34f840fe8cc283b6a8d00c5))
* **image:** create cache dir ([f8c4e03](https://github.com/folke/snacks.nvim/commit/f8c4e03d025de17fb2302b3253bc72b8c0693c24))
* **image:** delay sending first image, to make ghostty happy. Closes [#1333](https://github.com/folke/snacks.nvim/issues/1333) ([9aa8cbb](https://github.com/folke/snacks.nvim/commit/9aa8cbb8031750fce640d476df67d88f60fd7c4e))
* **image:** delete terminal image on exit, just to be sure ([317bfac](https://github.com/folke/snacks.nvim/commit/317bfaca65dc53aa0a74885cf0c48c64fdfc30a9))
* **image:** do not attach to invalid buffers ([#1238](https://github.com/folke/snacks.nvim/issues/1238)) ([9a5e4de](https://github.com/folke/snacks.nvim/commit/9a5e4deaec451e77464759b4d78e7207caee14a7))
* **image:** don't fallback to `convert` on windows, since that is a system tool ([c1a1984](https://github.com/folke/snacks.nvim/commit/c1a1984fdb537017b6239d5592d1f7d25a77caa9))
* **image:** failed state ([5a37d83](https://github.com/folke/snacks.nvim/commit/5a37d838973f216822448a9dae935724754acbf0))
* **image:** fix disappearing images when changing colorscheme ([44e2f8e](https://github.com/folke/snacks.nvim/commit/44e2f8e573a8e4971badb8c7d3c1181fed7d5de3))
* **image:** fixed gsub for angle brackets. Closes [#1301](https://github.com/folke/snacks.nvim/issues/1301) ([beaa1c2](https://github.com/folke/snacks.nvim/commit/beaa1c2efcc598a9752b4536ef95606a10835aaa))
* **image:** fixup ([de3cba5](https://github.com/folke/snacks.nvim/commit/de3cba5158509b82e2f0ff9fc9101effccc1a863))
* **image:** handle file uppercase file extensions. Closes [#1202](https://github.com/folke/snacks.nvim/issues/1202) ([356f621](https://github.com/folke/snacks.nvim/commit/356f6216b90b85878af2c0134c8f3955349cae18))
* **image:** handle inline images at the same TS node, but that changed url. See [#1203](https://github.com/folke/snacks.nvim/issues/1203) ([86e3ddf](https://github.com/folke/snacks.nvim/commit/86e3ddf2e4f7a08d8172d2b2383eb51b4c0bbb5f))
* **image:** hide progress when finished loading in for wezterm ([526896a](https://github.com/folke/snacks.nvim/commit/526896ad3e736786c4520efce6f97c831677ca69))
* **image:** let text conversion continue on errors. See [#1303](https://github.com/folke/snacks.nvim/issues/1303) ([6d1cda4](https://github.com/folke/snacks.nvim/commit/6d1cda4a6df71f146daf171fbd6d95e53123a61e))
* **image:** mermaid theme. Closes [#1282](https://github.com/folke/snacks.nvim/issues/1282) ([8117fb4](https://github.com/folke/snacks.nvim/commit/8117fb4cbbaec9fbcfe7fe0b6c3a9c933d6c27ee))
* **image:** move assertion for src/content. See [#1276](https://github.com/folke/snacks.nvim/issues/1276) ([31e21cc](https://github.com/folke/snacks.nvim/commit/31e21ccef857e600a72fc059ee660fd134595f9d))
* **image:** only load image when the file exists. Closes [#1143](https://github.com/folke/snacks.nvim/issues/1143) ([298499d](https://github.com/folke/snacks.nvim/commit/298499dcb943ab49946e648ab79bf14868480560))
* **image:** only setup tmux pass-through on supported terminals. Fixes [#1054](https://github.com/folke/snacks.nvim/issues/1054) ([78e692c](https://github.com/folke/snacks.nvim/commit/78e692cd07b752e29e021635a70f353024d9c9b4))
* **image:** prevent image id collisions by interleaving the nvim pid hash in the image id ([31788ba](https://github.com/folke/snacks.nvim/commit/31788ba74e12081e79165f4447f6ff0f7e33b696))
* **image:** relax check for wezterm. Closes [#1076](https://github.com/folke/snacks.nvim/issues/1076) ([8d5ae25](https://github.com/folke/snacks.nvim/commit/8d5ae25806f88ec6c79f094eb7f3cc3413584309))
* **image:** remove `wezterm` from supported terminals, since they don't support unicode placeholders. Closes [#1063](https://github.com/folke/snacks.nvim/issues/1063) ([345260f](https://github.com/folke/snacks.nvim/commit/345260f39f70d63625e63d3c6771b2a8224f45c9))
* **image:** remove debug ([13863ea](https://github.com/folke/snacks.nvim/commit/13863ea25d169ef35f939b836c5edf8116042b89))
* **image:** remove ft check, since we use lang already. Closes [#1177](https://github.com/folke/snacks.nvim/issues/1177) ([4bcd26a](https://github.com/folke/snacks.nvim/commit/4bcd26aca8150a70b40b62673731046f85a205ff))
* **image:** remove some default latex packages ([f45dd6c](https://github.com/folke/snacks.nvim/commit/f45dd6c44c1319a2660b3b390d8d39ec5f2d73dc))
* **image:** remove test ([462578e](https://github.com/folke/snacks.nvim/commit/462578edb8fb13f0c158d2c9ac9479109dfdab31))
* **image:** return converted filename instead of original src. Closes [#1213](https://github.com/folke/snacks.nvim/issues/1213) ([118eab0](https://github.com/folke/snacks.nvim/commit/118eab0cfd4093bcd2b120378e5ea0685a333950))
* **image:** show full size when not showing image inline ([d7c8fd9](https://github.com/folke/snacks.nvim/commit/d7c8fd9a482a98e44442071d1d02342ebb256be4))
* **image:** support Neovim < 0.10 ([c067ffe](https://github.com/folke/snacks.nvim/commit/c067ffe86ce931702f82d2a1bd4c0ea98c3bfdd0))
* **image:** wrong return when trying second command ([74c4298](https://github.com/folke/snacks.nvim/commit/74c42985be207f6c9ed164bd1fae6be81fecd5bb))
* **input:** add missing hl group for input title ([#1164](https://github.com/folke/snacks.nvim/issues/1164)) ([7014b91](https://github.com/folke/snacks.nvim/commit/7014b91b927a384a7219629cf53e19573c832c23))
* **layout:** deep merge instead of shallow merge for window options. Closes [#1166](https://github.com/folke/snacks.nvim/issues/1166) ([27256cf](https://github.com/folke/snacks.nvim/commit/27256cf989475e3305713341930a7709e3670eac))
* **layout:** just hide any layouts below a backdrop. easier and looks better. ([0dab071](https://github.com/folke/snacks.nvim/commit/0dab071dbabaea642f42b2a13d5fc8f00a391963))
* **layout:** make sure width/height are at least `1`. Closes [#1090](https://github.com/folke/snacks.nvim/issues/1090) ([c554097](https://github.com/folke/snacks.nvim/commit/c5540974fa7a55720f0a1e55d0afe948c8f8fe0a))
* **layout:** take winbar into account for split layouts. Closes [#996](https://github.com/folke/snacks.nvim/issues/996) ([e4e5040](https://github.com/folke/snacks.nvim/commit/e4e5040d9b9b58ac3bc44a6709bbb5e55e58adea))
* **layout:** zindex weirdness on stable. Closes [#1180](https://github.com/folke/snacks.nvim/issues/1180) ([72ffb3d](https://github.com/folke/snacks.nvim/commit/72ffb3d1a2812671bb3487e490a3b1dd380bc234))
* **notifier:** keep notif when current buf is notif buf ([a13c891](https://github.com/folke/snacks.nvim/commit/a13c891a59ec0e67a75824fe1505a9e57fbfca0f))
* **picker.actions:** better set cmdline. Closes [#1291](https://github.com/folke/snacks.nvim/issues/1291) ([570c035](https://github.com/folke/snacks.nvim/commit/570c035b9417aaa2f02cadf00c83f5b968a70b6c))
* **picker.actions:** check that plugin exists before loading it in help. Closes [#1134](https://github.com/folke/snacks.nvim/issues/1134) ([e326de9](https://github.com/folke/snacks.nvim/commit/e326de9e0ce4f97c974359568617dc69a0cd6d67))
* **picker.actions:** don't delete empty buffer when its in another tabpage. Closes [#1005](https://github.com/folke/snacks.nvim/issues/1005) ([1491b54](https://github.com/folke/snacks.nvim/commit/1491b543ef1d8a0eb29a6ebc35db4fb808dcb47f))
* **picker.actions:** don't reuse_win in floating windows (like the picker preview) ([4b9ea98](https://github.com/folke/snacks.nvim/commit/4b9ea98007cddc0af80fa0479a86a1bf2e880b66))
* **picker.actions:** fix qflist position ([#911](https://github.com/folke/snacks.nvim/issues/911)) ([6d3c135](https://github.com/folke/snacks.nvim/commit/6d3c1352358e0e2980f9f323b6ca8a62415963bc))
* **picker.actions:** keymap confirm. Closes [#1252](https://github.com/folke/snacks.nvim/issues/1252) ([a9a84dd](https://github.com/folke/snacks.nvim/commit/a9a84dde2e474eb9ee57630ab2f6418bfe1b380f))
* **picker.actions:** reverse prev/next on select with a reversed list layout. Closes [#1124](https://github.com/folke/snacks.nvim/issues/1124) ([eae55e7](https://github.com/folke/snacks.nvim/commit/eae55e7ca3b7c33882884a439e12d26200403a66))
* **picker.actions:** use `vim.v.register` instead of `+` as default. ([9ab6637](https://github.com/folke/snacks.nvim/commit/9ab6637df061fb03c6c5ba937dee5bfef92a6633))
* **picker.buffers:** remove `dd` to delete buffer from input keymaps. Closes [#1193](https://github.com/folke/snacks.nvim/issues/1193) ([f311d1c](https://github.com/folke/snacks.nvim/commit/f311d1c83a25fbce63e322c72ad6c99a02f84a2f))
* **picker.colorscheme:** use wildignore. Closes [#969](https://github.com/folke/snacks.nvim/issues/969) ([ba8badf](https://github.com/folke/snacks.nvim/commit/ba8badfe74783e97934c21a69e0c44883092587f))
* **picker.config:** use `<c-w>HJKL` to move float to far left/bottom/top/right. Only in normal mode. ([34dd83c](https://github.com/folke/snacks.nvim/commit/34dd83c2572658c3f6140e8a8acc1bcfbf7cf32b))
* **picker.explorer:** ensure diagnostics can be disabled ([#1145](https://github.com/folke/snacks.nvim/issues/1145)) ([885c140](https://github.com/folke/snacks.nvim/commit/885c1409e898b2f6f806cdb31f6ca9d7d84b4ff3))
* **picker.git:** account for deleted files in git diff. Closes [#1001](https://github.com/folke/snacks.nvim/issues/1001) ([e9e2e69](https://github.com/folke/snacks.nvim/commit/e9e2e6976e3cc7c1110892c9c4a6882dd88ca6fd))
* **picker.git:** apply args to `git`, and not `git grep`. ([2e284e2](https://github.com/folke/snacks.nvim/commit/2e284e23d956767a50321de9c9bb0c005ea7c51f))
* **picker.git:** better handling of multi file staging ([b39a3ba](https://github.com/folke/snacks.nvim/commit/b39a3ba40af7c63e0cf0f5e6a2c242c6d3f22591))
* **picker.git:** correct root dir for git log ([c114a0d](https://github.com/folke/snacks.nvim/commit/c114a0da1a3984345c3035474b8a688592288c9d))
* **picker.git:** formatting of git log ([f320026](https://github.com/folke/snacks.nvim/commit/f32002607a5a81a1d25eda27b954fc6ba8e9fd1b))
* **picker.git:** handle git status renames. Closes [#1003](https://github.com/folke/snacks.nvim/issues/1003) ([93ad23a](https://github.com/folke/snacks.nvim/commit/93ad23a0abb4c712722b74e3c066e6b42881fc81))
* **picker.git:** preserve chronological order when matching ([#1216](https://github.com/folke/snacks.nvim/issues/1216)) ([8b19fd0](https://github.com/folke/snacks.nvim/commit/8b19fd0332835d48f7fe9fe203fa1c2b27976cd2))
* **picker.git:** properly handle file renames for git log. Closes [#1154](https://github.com/folke/snacks.nvim/issues/1154) ([9c436cb](https://github.com/folke/snacks.nvim/commit/9c436cb273c9b6984da275ba449fda2780d4fa2e))
* **picker.help:** make sure plugin is loaded for which we want to view the help ([3841a87](https://github.com/folke/snacks.nvim/commit/3841a8705a5e433d88539176d7c67a0ee6a9a92c))
* **picker.highlight:** lower case treesitter parser name ([3367983](https://github.com/folke/snacks.nvim/commit/336798345c1503689917a4a4a03a03a3da33119a))
* **picker.highlights:** close on confirm. Closes [#1096](https://github.com/folke/snacks.nvim/issues/1096) ([76f6e4f](https://github.com/folke/snacks.nvim/commit/76f6e4f81cff6f00c8ff027af9351f38ffa6d9f0))
* **picker.input:** prevent save dialog ([fcb2f50](https://github.com/folke/snacks.nvim/commit/fcb2f508dd6b58c98b781229db895d22c69e6f21))
* **picker.lines:** use original buf instead of current (which can be the picker on refresh) ([7ccf9c9](https://github.com/folke/snacks.nvim/commit/7ccf9c9d6934a76d5bd835bbd6cf1e764960f14e))
* **picker.list:** `list:view` should never transform reverse. Closes [#1016](https://github.com/folke/snacks.nvim/issues/1016) ([be781f9](https://github.com/folke/snacks.nvim/commit/be781f9fcb3d99db03c9c6979386565b65f8801b))
* **picker.list:** allow horizontal scrolling in the list ([572436b](https://github.com/folke/snacks.nvim/commit/572436bc3f16691172a6a0e94c8ffaf16b4170f0))
* **picker.list:** better wrap settings for when wrapping is enabled ([a542ea4](https://github.com/folke/snacks.nvim/commit/a542ea4d3487bd1aa449350c320bfdbe0c23083b))
* **picker.list:** correct offset calculation for large scrolloff. Closes [#1208](https://github.com/folke/snacks.nvim/issues/1208) ([f4ca368](https://github.com/folke/snacks.nvim/commit/f4ca368672e2231cc34abbd96208812cc6bb1aa1))
* **picker.list:** don't return non-matching items. Closes [#1133](https://github.com/folke/snacks.nvim/issues/1133) ([d07e7ac](https://github.com/folke/snacks.nvim/commit/d07e7ac6209356f74405bdd9d881fcacdf80f5ad))
* **picker.list:** don't show preview when target cursor/top not yet reached. Closes [#1204](https://github.com/folke/snacks.nvim/issues/1204) ([b02cb5e](https://github.com/folke/snacks.nvim/commit/b02cb5e8826179b385b870edbda1631213391cf1))
* **picker.list:** dont transform with reverse for resolving target. Closes [#1142](https://github.com/folke/snacks.nvim/issues/1142) ([0e36317](https://github.com/folke/snacks.nvim/commit/0e363177bd4a8037a127bc3fab6bf9d442da1123))
* **picker.list:** keep existing target if it exists unless `force = true`. Closes [#1152](https://github.com/folke/snacks.nvim/issues/1152) ([121e74e](https://github.com/folke/snacks.nvim/commit/121e74e4a5b7962ee370a8d8ae75d1c7b4c2e11c))
* **picker.list:** let user override wrap ([22da4bd](https://github.com/folke/snacks.nvim/commit/22da4bd5118a63268e6516ac74a8c3dc514218d3))
* **picker.list:** reset preview when no results. Closes [#1133](https://github.com/folke/snacks.nvim/issues/1133) ([f8bc119](https://github.com/folke/snacks.nvim/commit/f8bc1192cb3f740913f9198fabaf87b46434a926))
* **picker.lsp:** fix indent guides for sorted document symbols ([17360e4](https://github.com/folke/snacks.nvim/commit/17360e400905f50c5cc513b072c207233f825a73))
* **picker.lsp:** handle invalid lsp kinds. Closes [#1182](https://github.com/folke/snacks.nvim/issues/1182) ([f3cdd02](https://github.com/folke/snacks.nvim/commit/f3cdd02620bd5075e453be7451a260dbbee68cab))
* **picker.lsp:** only sort when not getting workspace symbols. Closes [#1071](https://github.com/folke/snacks.nvim/issues/1071) ([d607d2e](https://github.com/folke/snacks.nvim/commit/d607d2e050d9ab19ebe51db38aab807958f05bad))
* **picker.lsp:** sort document symbols by position ([cc22177](https://github.com/folke/snacks.nvim/commit/cc22177dcf288195022b0f739da3d00fcf56e3d7))
* **picker.matcher:** don't optimize pattern subsets when pattern has a negation ([a6b3d78](https://github.com/folke/snacks.nvim/commit/a6b3d7840baef2cc9207353a7c1a782fc8508af9))
* **picker.matcher:** only consider subset patterns that contain only whitespace and alpha numeric chars. Closes [#1013](https://github.com/folke/snacks.nvim/issues/1013) ([fcf2311](https://github.com/folke/snacks.nvim/commit/fcf2311c0e68d91b71bc1be114ad13e84cd7771d))
* **picker.notifications:** close on confirm. Closes [#1092](https://github.com/folke/snacks.nvim/issues/1092) ([a8dda99](https://github.com/folke/snacks.nvim/commit/a8dda993e5f2a0262a2be1585511a6df7e5dcb8c))
* **picker.preview:** clear namespace on reset ([a6d418e](https://github.com/folke/snacks.nvim/commit/a6d418e877033de9a12288cdbf7e78d2f0f5d661))
* **picker.preview:** don't clear preview state on close so that colorscheme can be restored. Closes [#932](https://github.com/folke/snacks.nvim/issues/932) ([9688bd9](https://github.com/folke/snacks.nvim/commit/9688bd92cda4fbe57210bbdfbb9c940516382f9a))
* **picker.preview:** don't reset preview when filtering and the same item is previewed ([c8285c2](https://github.com/folke/snacks.nvim/commit/c8285c2ca2c4805019e105967f17e60f82faf106))
* **picker.preview:** fix newlines before setting lines of a buffer ([62c2c62](https://github.com/folke/snacks.nvim/commit/62c2c62671cf88ace1bd9fdd26411158d7072e0b))
* **picker.preview:** hide line numbers / status column for directory preview. Closes [#1029](https://github.com/folke/snacks.nvim/issues/1029) ([f9aca86](https://github.com/folke/snacks.nvim/commit/f9aca86bf3ddbbd56cb53f71250c301f90af35a2))
* **picker.preview:** preview for uris. Closes [#1075](https://github.com/folke/snacks.nvim/issues/1075) ([c1f93e2](https://github.com/folke/snacks.nvim/commit/c1f93e25bb927dce2e1eb46610b6347460f0c69b))
* **picker.preview:** update titles on layout update. Closes [#1113](https://github.com/folke/snacks.nvim/issues/1113) ([89b3ce1](https://github.com/folke/snacks.nvim/commit/89b3ce11ca700badc92af0e1a37be2e19b79cd55))
* **picker.preview:** work-around for Neovim's messy window-local options (that are never truly local). Closes [#1100](https://github.com/folke/snacks.nvim/issues/1100) ([e5960d8](https://github.com/folke/snacks.nvim/commit/e5960d8e32ed2771a1d84ce4532bf0e2dc4dc8ca))
* **picker.proc:** don't close stdout on proc exit, since it might still contain buffered output. Closes [#966](https://github.com/folke/snacks.nvim/issues/966) ([3b7021e](https://github.com/folke/snacks.nvim/commit/3b7021e7fdf88e13fdf06643ae9a7224e1291495))
* **picker.proc:** make sure to emit the last line when done. Closes [#1095](https://github.com/folke/snacks.nvim/issues/1095) ([b94926e](https://github.com/folke/snacks.nvim/commit/b94926e5cc697c54c73e7c2b3759c8432afca91d))
* **picker.projects:** add custom project dirs ([c7293bd](https://github.com/folke/snacks.nvim/commit/c7293bdfe7664eca6f49816795ffb7f2af5b8302))
* **picker.projects:** use fd or fdfind ([270250c](https://github.com/folke/snacks.nvim/commit/270250cf4646dbb16c3d1a453257a3f024b8f362))
* **picker.watch:** schedule_wrap. Closes [#1049](https://github.com/folke/snacks.nvim/issues/1049) ([f489d61](https://github.com/folke/snacks.nvim/commit/f489d61f54c3a32c35c439a16ff0f097dbe93028))
* **picker.zoxide:** directory icon ([#1031](https://github.com/folke/snacks.nvim/issues/1031)) ([33dbebb](https://github.com/folke/snacks.nvim/commit/33dbebb75395b5e80e441214985c0d9143d323d6))
* **picker:** `nil` on `:quit`. Closes [#1107](https://github.com/folke/snacks.nvim/issues/1107) ([1219f5e](https://github.com/folke/snacks.nvim/commit/1219f5e43baf1c17e305d605d3db8972aae19bf5))
* **picker:** `opts.focus = false` now works again ([031f9e9](https://github.com/folke/snacks.nvim/commit/031f9e96fb85cd417868ab2ba03946cb98fd06c8))
* **picker:** closed check for show preview. Closes [#1181](https://github.com/folke/snacks.nvim/issues/1181) ([c1f4d30](https://github.com/folke/snacks.nvim/commit/c1f4d3032529a7af3d0863c775841f6dc13e03d6))
* **picker:** consider zen windows as main. Closes [#973](https://github.com/folke/snacks.nvim/issues/973) ([b1db65a](https://github.com/folke/snacks.nvim/commit/b1db65ac61127581cbe3bca8e54a8faf8ce16e5f))
* **picker:** disabled preview main ([9fe43bd](https://github.com/folke/snacks.nvim/commit/9fe43bdf9b6c04b129e84bd7c2cb7ebd8e04bfae))
* **picker:** don't render list when closed. See [#1308](https://github.com/folke/snacks.nvim/issues/1308) ([681ae6e](https://github.com/folke/snacks.nvim/commit/681ae6e3078503d2c4cc137a492782a0ee3977b3))
* **picker:** exit insert mode before closing with `<c-c>` to prevent cursor shifting left. Close [#956](https://github.com/folke/snacks.nvim/issues/956) ([71eae96](https://github.com/folke/snacks.nvim/commit/71eae96bfa5ccafad9966a7bc40982ebe05d8f5d))
* **picker:** go back to last window on cancel instead of main ([4551f49](https://github.com/folke/snacks.nvim/commit/4551f499c7945036761fd48927cc07b9720fce56))
* **picker:** initial preview state when main ([cd6e336](https://github.com/folke/snacks.nvim/commit/cd6e336ec0dc8b95e7a75c86cba297a16929370e))
* **picker:** only show extmark errors when debug is enabled. Closes [#988](https://github.com/folke/snacks.nvim/issues/988) ([f6d9af7](https://github.com/folke/snacks.nvim/commit/f6d9af7410963780c48772f7bd9ee3f5e7be8599))
* **picker:** remove debug ([a23b10e](https://github.com/folke/snacks.nvim/commit/a23b10e6cafeae7b9e06be47ba49295d0c921a97))
* **picker:** remove debug :) ([3d53a73](https://github.com/folke/snacks.nvim/commit/3d53a7364e438a7652bb6b90b95c334c32cab938))
* **picker:** save toggles for resume. Closes [#1085](https://github.com/folke/snacks.nvim/issues/1085) ([e390713](https://github.com/folke/snacks.nvim/commit/e390713ac6f92d0076f38b518645b55222ecf4d1))
* **picker:** sometimes main layout win gets selected. Closes [#1015](https://github.com/folke/snacks.nvim/issues/1015) ([4799f82](https://github.com/folke/snacks.nvim/commit/4799f829683272b06ad9bf8b8e9816f28b3a46ef))
* **picker:** update titles last on show. Closes [#1113](https://github.com/folke/snacks.nvim/issues/1113) ([96796db](https://github.com/folke/snacks.nvim/commit/96796db21e474eff0d0ddeee2afa6c2c346756c7))
* **picker:** vim.ui.select callback is called when canceling selection ([#1115](https://github.com/folke/snacks.nvim/issues/1115)) ([4c3bfa2](https://github.com/folke/snacks.nvim/commit/4c3bfa29f3122c4fb855c1adaef01cf22612624a))
* **scroll:** added `keepjumps` ([7161dc1](https://github.com/folke/snacks.nvim/commit/7161dc1b570849324bb2b0b808c6f2cc46ef6f84))
* **statuscolumn:** only execute `za` when fold exists ([#1093](https://github.com/folke/snacks.nvim/issues/1093)) ([345eeb6](https://github.com/folke/snacks.nvim/commit/345eeb69417f5568930f283e3be01f0ef55bee63))
* **terminal:** check for 0.11 ([6e45829](https://github.com/folke/snacks.nvim/commit/6e45829879da987cb4ed01d3098eb2507da72343))
* **terminal:** softer check for using jobstart with `term=true` instead of deprecated termopen ([544a2ae](https://github.com/folke/snacks.nvim/commit/544a2ae01c28056629a0c90f8d0ff40995c84e42))
* **toggle:** hide toggle when real keymap does not exist. Closes [#378](https://github.com/folke/snacks.nvim/issues/378) ([ee9e617](https://github.com/folke/snacks.nvim/commit/ee9e6179fe18a2bf36ebb5e81ddf1052e04577dc))
* **win:** apply win-local window options for new buffers displayed in a window. Fixes [#925](https://github.com/folke/snacks.nvim/issues/925) ([cb99c46](https://github.com/folke/snacks.nvim/commit/cb99c46fa171134f582f6b13bef32f6d25ebda59))
* **win:** better handling when the command window is open. Closes [#1245](https://github.com/folke/snacks.nvim/issues/1245) ([7720410](https://github.com/folke/snacks.nvim/commit/77204102a1f5869bf37d8ccbc5e8e0769cfe8db4))
* **win:** call `on_close` before actually closing so that prev win can be set. Closes [#962](https://github.com/folke/snacks.nvim/issues/962) ([a1cb54c](https://github.com/folke/snacks.nvim/commit/a1cb54cc9e579c53bbd4b96949acf2341b31a3ee))
* **words:** default count to 1. Closes [#1307](https://github.com/folke/snacks.nvim/issues/1307) ([45ec90b](https://github.com/folke/snacks.nvim/commit/45ec90bdd91d7730b81662ee3bfcdd4a88ed908f))
* **zen:** properly get zoom options. Closes [#1207](https://github.com/folke/snacks.nvim/issues/1207) ([3100333](https://github.com/folke/snacks.nvim/commit/3100333fdb777853c77aeac46b92fcdaba8e3e57))
### Performance Improvements
* **dashboard:** speed up filtering for recent_files ([#1250](https://github.com/folke/snacks.nvim/issues/1250)) ([b91f417](https://github.com/folke/snacks.nvim/commit/b91f417670e8f35ac96a2ebdecceeafdcc43ba4a))
* **explorer:** disable watchdirs fallback watcher ([5d34380](https://github.com/folke/snacks.nvim/commit/5d34380310861cd42e32ce0865bd8cded9027b41))
* **explorer:** early exit for tree calculation ([1a30610](https://github.com/folke/snacks.nvim/commit/1a30610ab78cce8bb184166de2ef35ee2ca1987a))
* **explorer:** no need to get git status with `-uall`. Closes [#983](https://github.com/folke/snacks.nvim/issues/983) ([bc087d3](https://github.com/folke/snacks.nvim/commit/bc087d36d6126ccf25f8bb3ead405ec32547d85d))
* **explorer:** only update tree if git status actually changed ([5a2acf8](https://github.com/folke/snacks.nvim/commit/5a2acf82b2aff0b6f7121ce953c5754de6fd1e01))
* **explorer:** only update tree when diagnostics actually changed ([1142f46](https://github.com/folke/snacks.nvim/commit/1142f46a27358c8f48023382389a8b31c9628b6b))
* **image.convert:** identify during convert instead of calling identify afterwards ([7b7f42f](https://github.com/folke/snacks.nvim/commit/7b7f42fb3bee6083677d66b301424c26b4ff41c2))
* **image:** no need to run identify before convert for local files ([e2d9941](https://github.com/folke/snacks.nvim/commit/e2d99418968b0dc690ca6b56dac688d70e9b5e40))
* **picker.list:** only re-render when visible items changed ([c72e62e](https://github.com/folke/snacks.nvim/commit/c72e62ef9012161ec6cd86aa749d780f77d1cc87))
* **picker:** cache treesitter line highlights ([af31c31](https://github.com/folke/snacks.nvim/commit/af31c312872cab2a47e17ed2ee67bf5940a522d4))
* **picker:** cache wether ts lang exists and disable smooth scrolling on big files ([719b36f](https://github.com/folke/snacks.nvim/commit/719b36fa70c35a7015537aa0bfd2956f6128c87d))
* **scroll:** much better/easier/faster method for vertical cursor positioning ([a3194d9](https://github.com/folke/snacks.nvim/commit/a3194d95199c4699a4da0d4c425a19544ed8d670))
### Documentation
* docgen ([b503e3e](https://github.com/folke/snacks.nvim/commit/b503e3ee9fdd57202e5815747e67d1f6259468a4))
## [2.20.0](https://github.com/folke/snacks.nvim/compare/v2.19.0...v2.20.0) (2025-02-08)
### Features
* **picker.undo:** `ctrl+y` to yank added lines, `ctrl+shift+y` to yank deleted lines ([3baf95d](https://github.com/folke/snacks.nvim/commit/3baf95d3a1005105b57ce53644ff6224ee3afa1c))
* **picker:** added treesitter symbols picker ([a6beb0f](https://github.com/folke/snacks.nvim/commit/a6beb0f280d3f43513998882faf199acf3818ddf))
* **terminal:** added `Snacks.terminal.list()`. Closes [#421](https://github.com/folke/snacks.nvim/issues/421). Closes [#759](https://github.com/folke/snacks.nvim/issues/759) ([73c4b62](https://github.com/folke/snacks.nvim/commit/73c4b628963004760ccced0192d1c2633c9e3657))
### Bug Fixes
* **explorer:** change grep in item dir keymap to leader-/. Closes [#1000](https://github.com/folke/snacks.nvim/issues/1000) ([9dfa276](https://github.com/folke/snacks.nvim/commit/9dfa276ea424a091f5d5bdc008aff127850441b2))
* **layout:** take winbar into account for split layouts. Closes [#996](https://github.com/folke/snacks.nvim/issues/996) ([e4e5040](https://github.com/folke/snacks.nvim/commit/e4e5040d9b9b58ac3bc44a6709bbb5e55e58adea))
* **picker.git:** account for deleted files in git diff. Closes [#1001](https://github.com/folke/snacks.nvim/issues/1001) ([e9e2e69](https://github.com/folke/snacks.nvim/commit/e9e2e6976e3cc7c1110892c9c4a6882dd88ca6fd))
* **picker.git:** handle git status renames. Closes [#1003](https://github.com/folke/snacks.nvim/issues/1003) ([93ad23a](https://github.com/folke/snacks.nvim/commit/93ad23a0abb4c712722b74e3c066e6b42881fc81))
* **picker.lines:** use original buf instead of current (which can be the picker on refresh) ([7ccf9c9](https://github.com/folke/snacks.nvim/commit/7ccf9c9d6934a76d5bd835bbd6cf1e764960f14e))
* **picker.proc:** don't close stdout on proc exit, since it might still contain buffered output. Closes [#966](https://github.com/folke/snacks.nvim/issues/966) ([3b7021e](https://github.com/folke/snacks.nvim/commit/3b7021e7fdf88e13fdf06643ae9a7224e1291495))
## [2.19.0](https://github.com/folke/snacks.nvim/compare/v2.18.0...v2.19.0) (2025-02-07)
### Features
* **bigfile:** configurable average line length (default = 1000). Useful for minified files. Closes [#576](https://github.com/folke/snacks.nvim/issues/576). Closes [#372](https://github.com/folke/snacks.nvim/issues/372) ([7fa92a2](https://github.com/folke/snacks.nvim/commit/7fa92a24501fa85b567c130b4e026f9ca1efed17))
* **explorer:** add hl groups for ignored / hidden files. Closes [#887](https://github.com/folke/snacks.nvim/issues/887) ([85e1b34](https://github.com/folke/snacks.nvim/commit/85e1b343b0cc6d2facc0763d9e1c1de4b63b99ac))
* **explorer:** added ctrl+f to grep in the item's directory ([0454b21](https://github.com/folke/snacks.nvim/commit/0454b21165cb84d2f59a1daf6226de065c90d4f7))
* **explorer:** added ctrl+t to open a terminal in the item's directory ([81f9006](https://github.com/folke/snacks.nvim/commit/81f90062c50430c1bad9546fcb65c3e43a76be9b))
* **explorer:** added diagnostics file/directory status ([7f1b60d](https://github.com/folke/snacks.nvim/commit/7f1b60d5576345af5e7b990f3a9e4bca49cd3686))
* **explorer:** added quick nav with `[`, `]` with `d/w/e` for diagnostics ([d1d5585](https://github.com/folke/snacks.nvim/commit/d1d55850ecb4aac1396c314a159db1e90a34bd79))
* **explorer:** added support for live search ([82c4a50](https://github.com/folke/snacks.nvim/commit/82c4a50985c9bb9f4b1d598f10a30e1122a35212))
* **explorer:** allow disabling untracked git status. Closes [#983](https://github.com/folke/snacks.nvim/issues/983) ([a3b083b](https://github.com/folke/snacks.nvim/commit/a3b083b8443b1ae1299747fdac8da51c3160835b))
* **explorer:** different hl group for broken links ([1989921](https://github.com/folke/snacks.nvim/commit/1989921466e6b5234ae8f71add41b8defd55f732))
* **explorer:** disable fuzzy searches by default for explorer since it's too noisy and we can't sort on score due to tree view ([b07788f](https://github.com/folke/snacks.nvim/commit/b07788f14a28daa8d0b387c1258f8f348f47420f))
* **explorer:** file watcher when explorer is open ([6936c14](https://github.com/folke/snacks.nvim/commit/6936c1491d4aa8ffb4448acca677589a1472bb3a))
* **explorer:** file watching that works on all platforms ([8399465](https://github.com/folke/snacks.nvim/commit/8399465872c51fab54ad5d02eb315e258ec96ed1))
* **explorer:** focus on first file when searching in the explorer ([1d4bea4](https://github.com/folke/snacks.nvim/commit/1d4bea4a9ee8a5258c6ae085ac66dd5cc05a9749))
* **explorer:** git index watcher ([4c12475](https://github.com/folke/snacks.nvim/commit/4c12475e80528d8d48b9584d78d645e4a51c3298))
* **explorer:** rewrite that no longer depends on `fd` for exploring ([6149a7b](https://github.com/folke/snacks.nvim/commit/6149a7babbd2c6d9cd924bb70102d80a7f045287))
* **explorer:** show symlink target ([dfa79e0](https://github.com/folke/snacks.nvim/commit/dfa79e04436ebfdc83ba71c0048fc1636b4de5aa))
* **matcher:** call on_match after setting score ([23ce529](https://github.com/folke/snacks.nvim/commit/23ce529fb663337f9dc17ca08aa601b172469031))
* **picker.git:** add confirmation before deleting a git branch ([#951](https://github.com/folke/snacks.nvim/issues/951)) ([337a3ae](https://github.com/folke/snacks.nvim/commit/337a3ae7eebb95020596f15a349a85d2f6be31a4))
* **picker.git:** add create and delete branch to git_branches ([#909](https://github.com/folke/snacks.nvim/issues/909)) ([8676c40](https://github.com/folke/snacks.nvim/commit/8676c409e148e28eff93c114aca0c1bf3d42281a))
* **picker.lazy:** don't use `grep`. Parse spec files manually. Closes [#972](https://github.com/folke/snacks.nvim/issues/972) ([0928007](https://github.com/folke/snacks.nvim/commit/09280078e8339f018be5249fe0e1d7b9d32db7f7))
* **picker.lsp:** use existing buffers for preview when opened ([d4e6353](https://github.com/folke/snacks.nvim/commit/d4e63531c9fba63ded6fb470a5d53c98af110478))
* **picker.matcher:** internal `on_match` ([47b3b69](https://github.com/folke/snacks.nvim/commit/47b3b69570271b12bbd72b9dbcfbd445b915beca))
* **picker.preview:** allow confguring `preview = {main = true, enabled = false}` ([1839c65](https://github.com/folke/snacks.nvim/commit/1839c65f6784bedb7ae96a84ee741fa5c0023226))
* **picker.undo:** added ctrl+y to yank added lines from undo ([811a24c](https://github.com/folke/snacks.nvim/commit/811a24cc16a8e9b7ec947c95b73e1fe05e4692d1))
* **picker:** `picker:dir()` to get the dir of the item (when a directory) or it's parent (when a file) ([969608a](https://github.com/folke/snacks.nvim/commit/969608ab795718cc23299247bf4ea0a199fcca3f))
* **picker:** added `git_grep` picker. Closes [#986](https://github.com/folke/snacks.nvim/issues/986) ([2dc9016](https://github.com/folke/snacks.nvim/commit/2dc901634b250059cc9b7129bdeeedd24520b86c))
* **picker:** allow configuring file icon width. Closes [#981](https://github.com/folke/snacks.nvim/issues/981) ([52c1086](https://github.com/folke/snacks.nvim/commit/52c1086ecdf410dfec3317144d46de7c6f86c1ad))
* **picker:** better checkhealth ([b773368](https://github.com/folke/snacks.nvim/commit/b773368f8aa6e84a68e979f0e335d23de71f405a))
* **picker:** get filetype from modeline when needed. Closes [#987](https://github.com/folke/snacks.nvim/issues/987) ([5af04ab](https://github.com/folke/snacks.nvim/commit/5af04ab6672ae38bf7d72427e75f925615f93904))
* **picker:** opts.on_close ([6235f44](https://github.com/folke/snacks.nvim/commit/6235f44b115c45dd009c45b81a52f8d99863efaa))
* **picker:** pin picker as a split to left/bottom/top/right with `ctrl+z+(hjkl)` ([27cba53](https://github.com/folke/snacks.nvim/commit/27cba535a6763cbca3f3162c5c4bb48c6f382005))
* **rename:** add `old` to `on_rename` callback ([455228e](https://github.com/folke/snacks.nvim/commit/455228ed3a07bf3aee34a75910785b9978f53da6))
* **scope:** allow injected languages to be parsed by treesitter ([#823](https://github.com/folke/snacks.nvim/issues/823)) ([aba21dd](https://github.com/folke/snacks.nvim/commit/aba21ddc712b12db8469680dd7f2080063cb6d5c))
* **statuscolumn:** added mouse click handler to open/close folds. Closes [#968](https://github.com/folke/snacks.nvim/issues/968) ([98a7b64](https://github.com/folke/snacks.nvim/commit/98a7b647c9e245ef02d57d566bf8461c2f7beb56))
* **terminal:** added `start_insert` ([64129e4](https://github.com/folke/snacks.nvim/commit/64129e4c3c5b247c61b1f46bc0faaa1e69e7eef8))
* **terminal:** auto_close and auto_insert. Closes [#965](https://github.com/folke/snacks.nvim/issues/965) ([bb76cae](https://github.com/folke/snacks.nvim/commit/bb76cae87e81a871435570b91c8c6f6e27eb9955))
### Bug Fixes
* **bigfile:** check that passed path is the one from the buffer ([8deea64](https://github.com/folke/snacks.nvim/commit/8deea64dba3b9b8f57e52bb6b0133263f6ff171f))
* **explorer.git:** better git status watching ([09349ec](https://github.com/folke/snacks.nvim/commit/09349ecd44040666db9d4835994a378a9ff53e8c))
* **explorer.git:** dont reset cursor when git status is done updating ([bc87992](https://github.com/folke/snacks.nvim/commit/bc87992e712c29ef8e826f3550f9b8e3f1a9308d))
* **explorer.git:** vim.schedule git updates ([3aad761](https://github.com/folke/snacks.nvim/commit/3aad7616209951320d54f83dd7df35d5578ea61f))
* **explorer.tree:** fix linux ([6f5399b](https://github.com/folke/snacks.nvim/commit/6f5399b47c55f916fcc3a82dcc71cce0eb5d7c92))
* **explorer.tree:** symlink directories ([e5f1e91](https://github.com/folke/snacks.nvim/commit/e5f1e91249b468ff3a7d14a8650074c27f1fdb30))
* **explorer.watch:** pcall watcher, since it can give errors on windows ([af96818](https://github.com/folke/snacks.nvim/commit/af968181af6ce6a988765fe51558b2caefdcf863))
* **explorer:** always refresh state when opening the picker since changes might have happened that were not monitored ([c61114f](https://github.com/folke/snacks.nvim/commit/c61114fb32910863a543a4a7a1f63e9915983d26))
* **explorer:** call original `on_close`. Closes [#971](https://github.com/folke/snacks.nvim/issues/971) ([a0bee9f](https://github.com/folke/snacks.nvim/commit/a0bee9f662d4e22c6533e6544b4daedecd2aacc0))
* **explorer:** check that picker is still open ([50fa1be](https://github.com/folke/snacks.nvim/commit/50fa1be38ee8366d79e1fa58b38abf31d3955033))
* **explorer:** clear cache after action. Fixes [#890](https://github.com/folke/snacks.nvim/issues/890) ([34097ff](https://github.com/folke/snacks.nvim/commit/34097ff37e0fb53771bbe3bf927048d06b4576f6))
* **explorer:** clear selection after delete. Closes [#898](https://github.com/folke/snacks.nvim/issues/898) ([44733ea](https://github.com/folke/snacks.nvim/commit/44733eaa78fb899dc3b3d72d7cac6f447356a287))
* **explorer:** disable follow for explorer search by default. No longer needed. Link directories may show as files then though, but that's not an issue. See [#960](https://github.com/folke/snacks.nvim/issues/960) ([b9a17d8](https://github.com/folke/snacks.nvim/commit/b9a17d82a726dc6cfd9a0b4f8566178708073808))
* **explorer:** don't use --absolute-path option, since that resolves paths to realpath. See [#901](https://github.com/folke/snacks.nvim/issues/901). See [#905](https://github.com/folke/snacks.nvim/issues/905). See [#904](https://github.com/folke/snacks.nvim/issues/904) ([97570d2](https://github.com/folke/snacks.nvim/commit/97570d23ac42dac813c5eb49637381fa3b728246))
* **explorer:** dont focus first file when not searching ([3fd437c](https://github.com/folke/snacks.nvim/commit/3fd437ccd38d79b876154097149d130cdb01e653))
* **explorer:** dont process git when picker closed ([c255d9c](https://github.com/folke/snacks.nvim/commit/c255d9c6a02f070f0048c5eaa40921f71e9f2acb))
* **explorer:** last status for indent guides taking hidden / ignored files into account ([94bd2ef](https://github.com/folke/snacks.nvim/commit/94bd2eff74acd7faa78760bf8a55d9c269e99190))
* **explorer:** strip cwd from search text for explorer items ([38f392a](https://github.com/folke/snacks.nvim/commit/38f392a8ad75ced790f89c8ef43a91f98a2bb6e3))
* **explorer:** windows ([b560054](https://github.com/folke/snacks.nvim/commit/b56005466952b759a2f610e8b3c8263444402d76))
* **exporer.tree:** and now hopefully on windows ([ef9b12d](https://github.com/folke/snacks.nvim/commit/ef9b12d68010a931c76533925a8c730123241635))
* **git:** use nul char as separator for git status ([8e0dfd2](https://github.com/folke/snacks.nvim/commit/8e0dfd285665bedf67441efe11c9c1318781826f))
* **health:** better health checks for picker. Closes [#917](https://github.com/folke/snacks.nvim/issues/917) ([427f036](https://github.com/folke/snacks.nvim/commit/427f036c6532097859d9177f32ccb037803abaa4))
* **picker.actions:** close preview before buffer delete ([762821e](https://github.com/folke/snacks.nvim/commit/762821e420cef56b03b6897b008454eefe68fd1d))
* **picker.actions:** don't reuse_win in floating windows (like the picker preview) ([4b9ea98](https://github.com/folke/snacks.nvim/commit/4b9ea98007cddc0af80fa0479a86a1bf2e880b66))
* **picker.actions:** fix qflist position ([#911](https://github.com/folke/snacks.nvim/issues/911)) ([6d3c135](https://github.com/folke/snacks.nvim/commit/6d3c1352358e0e2980f9f323b6ca8a62415963bc))
* **picker.actions:** get win after splitting or tabnew. Fixes [#896](https://github.com/folke/snacks.nvim/issues/896) ([95d3e7f](https://github.com/folke/snacks.nvim/commit/95d3e7f96182e4cc8aa0c05a616a61eba9a77366))
* **picker.colorscheme:** use wildignore. Closes [#969](https://github.com/folke/snacks.nvim/issues/969) ([ba8badf](https://github.com/folke/snacks.nvim/commit/ba8badfe74783e97934c21a69e0c44883092587f))
* **picker.db:** better script to download sqlite3 on windows. See [#918](https://github.com/folke/snacks.nvim/issues/918) ([84d1a92](https://github.com/folke/snacks.nvim/commit/84d1a92faba55a470a6c52a1aca86988b0c57869))
* **picker.finder:** correct check if filter changed ([52bc24c](https://github.com/folke/snacks.nvim/commit/52bc24c23256246e863992dfcc3172c527254f55))
* **picker.input:** fixed startinsert weirdness with prompt buffers (again) ([c030827](https://github.com/folke/snacks.nvim/commit/c030827d7ad3fe7117bf81c0db1613c958015211))
* **picker.input:** set as not modified when setting input through API ([54a041f](https://github.com/folke/snacks.nvim/commit/54a041f7fca05234379d7bceff6b036acc679cdc))
* **picker.list:** better wrap settings for when wrapping is enabled ([a542ea4](https://github.com/folke/snacks.nvim/commit/a542ea4d3487bd1aa449350c320bfdbe0c23083b))
* **picker.list:** let user override wrap ([22da4bd](https://github.com/folke/snacks.nvim/commit/22da4bd5118a63268e6516ac74a8c3dc514218d3))
* **picker.list:** nil check ([c22e46a](https://github.com/folke/snacks.nvim/commit/c22e46ab9a1f1416368759e0979bc5c0c64c0084))
* **picker.lsp:** fix indent guides for sorted document symbols ([17360e4](https://github.com/folke/snacks.nvim/commit/17360e400905f50c5cc513b072c207233f825a73))
* **picker.lsp:** sort document symbols by position ([cc22177](https://github.com/folke/snacks.nvim/commit/cc22177dcf288195022b0f739da3d00fcf56e3d7))
* **picker.matcher:** don't optimize pattern subsets when pattern has a negation ([a6b3d78](https://github.com/folke/snacks.nvim/commit/a6b3d7840baef2cc9207353a7c1a782fc8508af9))
* **picker.preview:** don't clear preview state on close so that colorscheme can be restored. Closes [#932](https://github.com/folke/snacks.nvim/issues/932) ([9688bd9](https://github.com/folke/snacks.nvim/commit/9688bd92cda4fbe57210bbdfbb9c940516382f9a))
* **picker.preview:** update main preview when changing the layout ([604c603](https://github.com/folke/snacks.nvim/commit/604c603dfafdac0c2edc725ff8bcdcc395100028))
* **picker.projects:** add custom project dirs ([c7293bd](https://github.com/folke/snacks.nvim/commit/c7293bdfe7664eca6f49816795ffb7f2af5b8302))
* **picker.projects:** use fd or fdfind ([270250c](https://github.com/folke/snacks.nvim/commit/270250cf4646dbb16c3d1a453257a3f024b8f362))
* **picker.select:** default height shows just the items. See [#902](https://github.com/folke/snacks.nvim/issues/902) ([c667622](https://github.com/folke/snacks.nvim/commit/c667622fb7569a020195e3e35c1405e4a1fa0e7e))
* **picker:** better handling when entering the root layout window. Closes [#894](https://github.com/folke/snacks.nvim/issues/894) ([e294fd8](https://github.com/folke/snacks.nvim/commit/e294fd8a273b1f5622c8a3259802d91a1ed01110))
* **picker:** consider zen windows as main. Closes [#973](https://github.com/folke/snacks.nvim/issues/973) ([b1db65a](https://github.com/folke/snacks.nvim/commit/b1db65ac61127581cbe3bca8e54a8faf8ce16e5f))
* **picker:** disabled preview main ([9fe43bd](https://github.com/folke/snacks.nvim/commit/9fe43bdf9b6c04b129e84bd7c2cb7ebd8e04bfae))
* **picker:** exit insert mode before closing with `<c-c>` to prevent cursor shifting left. Close [#956](https://github.com/folke/snacks.nvim/issues/956) ([71eae96](https://github.com/folke/snacks.nvim/commit/71eae96bfa5ccafad9966a7bc40982ebe05d8f5d))
* **picker:** initial preview state when main ([cd6e336](https://github.com/folke/snacks.nvim/commit/cd6e336ec0dc8b95e7a75c86cba297a16929370e))
* **picker:** only show extmark errors when debug is enabled. Closes [#988](https://github.com/folke/snacks.nvim/issues/988) ([f6d9af7](https://github.com/folke/snacks.nvim/commit/f6d9af7410963780c48772f7bd9ee3f5e7be8599))
* **win:** apply win-local window options for new buffers displayed in a window. Fixes [#925](https://github.com/folke/snacks.nvim/issues/925) ([cb99c46](https://github.com/folke/snacks.nvim/commit/cb99c46fa171134f582f6b13bef32f6d25ebda59))
* **win:** better handling of alien buffers opening in managed windows. See [#886](https://github.com/folke/snacks.nvim/issues/886) ([c8430fd](https://github.com/folke/snacks.nvim/commit/c8430fdd8dec6aa21c73f293cbd363084fb56ab0))
### Performance Improvements
* **explorer:** disable watchdirs fallback watcher ([5d34380](https://github.com/folke/snacks.nvim/commit/5d34380310861cd42e32ce0865bd8cded9027b41))
* **explorer:** early exit for tree calculation ([1a30610](https://github.com/folke/snacks.nvim/commit/1a30610ab78cce8bb184166de2ef35ee2ca1987a))
* **explorer:** no need to get git status with `-uall`. Closes [#983](https://github.com/folke/snacks.nvim/issues/983) ([bc087d3](https://github.com/folke/snacks.nvim/commit/bc087d36d6126ccf25f8bb3ead405ec32547d85d))
* **picker.list:** only re-render when visible items changed ([c72e62e](https://github.com/folke/snacks.nvim/commit/c72e62ef9012161ec6cd86aa749d780f77d1cc87))
* **picker:** cache treesitter line highlights ([af31c31](https://github.com/folke/snacks.nvim/commit/af31c312872cab2a47e17ed2ee67bf5940a522d4))
* **picker:** cache wether ts lang exists and disable smooth scrolling on big files ([719b36f](https://github.com/folke/snacks.nvim/commit/719b36fa70c35a7015537aa0bfd2956f6128c87d))
## [2.18.0](https://github.com/folke/snacks.nvim/compare/v2.17.0...v2.18.0) (2025-02-03)
### Features
* **dashboard:** play nice with file explorer netrw replacement ([5420a64](https://github.com/folke/snacks.nvim/commit/5420a64b66fd7350f5bb9d5dea2372850ea59969))
* **explorer.git:** added git_status_open. When false, then dont show recursive git status in open directories ([8646ba4](https://github.com/folke/snacks.nvim/commit/8646ba469630b73a34c06243664fb5607c0a43fa))
* **explorer:** added `]g` and `[g` to jump between files mentioned in `git status` ([263dfde](https://github.com/folke/snacks.nvim/commit/263dfde1b598e0fbba5f0031b8976e3c979f553c))
* **explorer:** added git status. Closes [#817](https://github.com/folke/snacks.nvim/issues/817) ([5cae48d](https://github.com/folke/snacks.nvim/commit/5cae48d93c875efa302bdffa995e4b057e2c3731))
* **explorer:** hide git status for open directories by default. it's mostly redundant ([b40c0d4](https://github.com/folke/snacks.nvim/commit/b40c0d4ee4e53aadc5fcf0900e58690c49f9763f))
* **explorer:** keep expanded dir state. Closes [#816](https://github.com/folke/snacks.nvim/issues/816) ([31984e8](https://github.com/folke/snacks.nvim/commit/31984e88a51652bda4997456c53113cbdc811cb4))
* **explorer:** more keymaps and tree rework. See [#837](https://github.com/folke/snacks.nvim/issues/837) ([2ff3893](https://github.com/folke/snacks.nvim/commit/2ff389312a78a8615754c2dee32b96211c9f9c54))
* **explorer:** navigate with h/l to close/open directories. Closes [#833](https://github.com/folke/snacks.nvim/issues/833) ([4b29ddc](https://github.com/folke/snacks.nvim/commit/4b29ddc5d9856ff49a07d77a43634e00b06f4d31))
* **explorer:** new `explorer` module with shortcut to start explorer picker and netrw replacement functionlity ([670c673](https://github.com/folke/snacks.nvim/commit/670c67366f0025fc4ebb78ba35a7586b7477989a))
* **explorer:** recursive copy and copying of selected items with `c` ([2528fcb](https://github.com/folke/snacks.nvim/commit/2528fcb02ceab7b19ee72a94b93c620259881e65))
* **explorer:** update on cwd change ([8dea225](https://github.com/folke/snacks.nvim/commit/8dea2252094ca3dc6d2073ab0015b7bcee396e24))
* **explorer:** update status when saving a file that is currently visible ([78d4116](https://github.com/folke/snacks.nvim/commit/78d4116662d38acb8456ffc6869204b487b472f8))
* **picker.commands:** do not autorun commands that require arguments ([#879](https://github.com/folke/snacks.nvim/issues/879)) ([62d99ed](https://github.com/folke/snacks.nvim/commit/62d99ed2a3711769e34fbc33c7072075824d256a))
* **picker.frecency:** added frecency support for directories ([ce67fa9](https://github.com/folke/snacks.nvim/commit/ce67fa9e31467590c750e203e27d3e6df293f2ad))
* **picker.input:** search syntax highlighting ([4242f90](https://github.com/folke/snacks.nvim/commit/4242f90268c93e7e546c195df26d9f0ee6b10645))
* **picker.lines:** jump to first position of match. Closes [#806](https://github.com/folke/snacks.nvim/issues/806) ([ae897f3](https://github.com/folke/snacks.nvim/commit/ae897f329f06695ee3482e2cd768797d5af3e277))
* **picker.list:** use regular CursorLine when picker window is not focused ([8a570bb](https://github.com/folke/snacks.nvim/commit/8a570bb48ba3536dcfe51f08547896b55fcb0e4d))
* **picker.matcher:** added opts.matcher.history_bonus that does fzf's scheme=history. Closes [#882](https://github.com/folke/snacks.nvim/issues/882). Closes [#872](https://github.com/folke/snacks.nvim/issues/872) ([78c2853](https://github.com/folke/snacks.nvim/commit/78c28535ddd4e3973bcdc9bdf342a37979010918))
* **picker.pickwin:** optional win/buf filter. Closes [#877](https://github.com/folke/snacks.nvim/issues/877) ([5c5b40b](https://github.com/folke/snacks.nvim/commit/5c5b40b5d0ed4166c751a11a839b015f4ad6e26a))
* **picker.projects:** added `<c-t>` to open a new tab page with the projects picker ([ced377a](https://github.com/folke/snacks.nvim/commit/ced377a05783073ab3a8506b5a9b0ffaf8293773))
* **picker.projects:** allow disabling projects from recent files ([c2dedb6](https://github.com/folke/snacks.nvim/commit/c2dedb647f6e170ee4defed647c7f89a51ee9fd0))
* **picker.projects:** default to tcd instead of cd ([3d2a075](https://github.com/folke/snacks.nvim/commit/3d2a07503f0724794a7e262a2f570a13843abedf))
* **picker.projects:** enabled frecency for projects picker ([5a20565](https://github.com/folke/snacks.nvim/commit/5a2056575faa50f788293ee787b803c15f42a9e0))
* **picker.projects:** projects now automatically processes dev folders and added a bunch of actions/keymaps. Closes [#871](https://github.com/folke/snacks.nvim/issues/871) ([6f8f0d3](https://github.com/folke/snacks.nvim/commit/6f8f0d3c727fe035dffc0bc4c1843e2a06eee1f2))
* **picker.undo:** better undo tree visualization. Closes [#863](https://github.com/folke/snacks.nvim/issues/863) ([44b8e38](https://github.com/folke/snacks.nvim/commit/44b8e3820493ca774cd220e3daf85c16954e74c7))
* **picker.undo:** make diff opts for undo configurable ([d61fb45](https://github.com/folke/snacks.nvim/commit/d61fb453c6c23976759e16a33fd8d6cb79cc59bc))
* **picker:** added support for double cliking and confirm ([8b26bae](https://github.com/folke/snacks.nvim/commit/8b26bae6bb01db22dbd3c6f868736487265025c0))
* **picker:** automatically download sqlite3.dll on Windows when using frecency / history for the first time. ([65907f7](https://github.com/folke/snacks.nvim/commit/65907f75ba52c09afc16e3d8d3c7ac67a3916237))
* **picker:** beter API to interact with active pickers. Closes [#851](https://github.com/folke/snacks.nvim/issues/851) ([6a83373](https://github.com/folke/snacks.nvim/commit/6a8337396ad843b27bdfe0a03ac2ce26ccf13092))
* **picker:** better health checks. Fixes [#855](https://github.com/folke/snacks.nvim/issues/855) ([d245925](https://github.com/folke/snacks.nvim/commit/d2459258f1a56109a2ad506f4a4dd6c69f2bb9f2))
* **picker:** history per source. Closes [#843](https://github.com/folke/snacks.nvim/issues/843) ([35295e0](https://github.com/folke/snacks.nvim/commit/35295e0eb2ee261e6173545190bc6c181fd08067))
### Bug Fixes
* **dashboard:** open pull requests with P instead of p in the github exmaple ([b2815d7](https://github.com/folke/snacks.nvim/commit/b2815d7f79e82d09cde5c9bb8e6fd13976b4d618))
* **dashboard:** update on VimResized and WinResized ([558b0ee](https://github.com/folke/snacks.nvim/commit/558b0ee04d0c6e1acf842774fbf9e02cce3efb0e))
* **explorer:** after search, cursor always jumped to top. Closes [#827](https://github.com/folke/snacks.nvim/issues/827) ([d17449e](https://github.com/folke/snacks.nvim/commit/d17449ee90b78843a22ee12ae29c3c110b28eac7))
* **explorer:** always use `--follow` to make sure we see dir symlinks as dirs. Fixes [#814](https://github.com/folke/snacks.nvim/issues/814) ([151fd3d](https://github.com/folke/snacks.nvim/commit/151fd3d62d73e0ec122bb243003c3bd59d53f8ef))
* **explorer:** cwd is now changed automatically, so no need to update state. ([5549d4e](https://github.com/folke/snacks.nvim/commit/5549d4e848b865ad4cc5bbb9bdd9487d631c795b))
* **explorer:** don't disable netrw fully. Just the autocmd that loads a directory ([836eb9a](https://github.com/folke/snacks.nvim/commit/836eb9a4e9ca0d7973f733203871d70691447c2b))
* **explorer:** don't try to show when closed. Fixes [#836](https://github.com/folke/snacks.nvim/issues/836) ([6921cd0](https://github.com/folke/snacks.nvim/commit/6921cd06ac7b530d786b2282afdfce67762008f1))
* **explorer:** fix git status sorting ([551d053](https://github.com/folke/snacks.nvim/commit/551d053c7ccc635249c262a5ea38b5d7aa814b3a))
* **explorer:** fixed hierarchical sorting. Closes [#828](https://github.com/folke/snacks.nvim/issues/828) ([fa32e20](https://github.com/folke/snacks.nvim/commit/fa32e20e9910f8071979f16788832027d1e25850))
* **explorer:** keep global git status cache ([a54a21a](https://github.com/folke/snacks.nvim/commit/a54a21adc0e67b97fb787adcbaaf4578c6f44476))
* **explorer:** remove sleep :) ([efbc4a1](https://github.com/folke/snacks.nvim/commit/efbc4a12af6aae39dadeab0badb84d04a94d5f85))
* **git:** use os.getenv to get env var. Fixes [#5504](https://github.com/folke/snacks.nvim/issues/5504) ([16d700e](https://github.com/folke/snacks.nvim/commit/16d700eb65fc320a5ab8e131d8f5d185b241887b))
* **layout:** adjust zindex when needed when another layout is already open. Closes [#826](https://github.com/folke/snacks.nvim/issues/826) ([ab8af1b](https://github.com/folke/snacks.nvim/commit/ab8af1bb32a4d9f82156122056d07a0850c2a828))
* **layout:** destroy in schedule. Fixes [#861](https://github.com/folke/snacks.nvim/issues/861) ([c955a8d](https://github.com/folke/snacks.nvim/commit/c955a8d1ef543fd56907d5291e92e62fd944db9b))
* **picker.actions:** fix split/vsplit/tab. Closes [#818](https://github.com/folke/snacks.nvim/issues/818) ([ff02241](https://github.com/folke/snacks.nvim/commit/ff022416dd6e6dade2ee822469d0087fcf3e0509))
* **picker.actions:** pass edit commands to jump. Closes [#859](https://github.com/folke/snacks.nvim/issues/859) ([df0e3e3](https://github.com/folke/snacks.nvim/commit/df0e3e3d861fd7b8ab85b3e8dbca97817b3d6604))
* **picker.actions:** reworked split/vsplit/drop/tab cmds to better do what's intended. Closes [#854](https://github.com/folke/snacks.nvim/issues/854) ([2946875](https://github.com/folke/snacks.nvim/commit/2946875af09f5f439ce64b78da8da6cf28523b8c))
* **picker.actions:** tab -> tabnew. Closes [#842](https://github.com/folke/snacks.nvim/issues/842) ([d962d5f](https://github.com/folke/snacks.nvim/commit/d962d5f3359dc91da7aa54388515fd0b03a2fe8b))
* **picker.explorer:** do LSP stuff on move ([894ff74](https://github.com/folke/snacks.nvim/commit/894ff749300342593007e6366894b681b3148f19))
* **picker.explorer:** use cached git status ([1ce435c](https://github.com/folke/snacks.nvim/commit/1ce435c6eb161feae63c8ddfe3e1aaf98b2aa41d))
* **picker.format:** extra slash in path ([dad3e00](https://github.com/folke/snacks.nvim/commit/dad3e00e83ec8a8af92e778e29f2fe200ad0d969))
* **picker.format:** use item.file for filename_only ([e784a9e](https://github.com/folke/snacks.nvim/commit/e784a9e6723371f8f453a92edb03d68428da74cc))
* **picker.git_log:** add extra space between the date and the message ([#885](https://github.com/folke/snacks.nvim/issues/885)) ([d897ead](https://github.com/folke/snacks.nvim/commit/d897ead2b78a73a186a3cb1b735a10f2606ddb36))
* **picker.keymaps:** added normalized lhs to search text ([fbd39a4](https://github.com/folke/snacks.nvim/commit/fbd39a48df085a7df979a06b1003faf86625c157))
* **picker.lazy:** don't use live searches. Fixes [#809](https://github.com/folke/snacks.nvim/issues/809) ([1a5fd93](https://github.com/folke/snacks.nvim/commit/1a5fd93b89904b8f8029e6ee74e6d6ada87f28c5))
* **picker.lines:** col is first non-whitespace. Closes [#806](https://github.com/folke/snacks.nvim/issues/806) ([ec8eb60](https://github.com/folke/snacks.nvim/commit/ec8eb6051530261e7d0e5566721e5c396c1ed6cd))
* **picker.list:** better virtual scrolling that works from any window ([4a50291](https://github.com/folke/snacks.nvim/commit/4a502914486346940389a99690578adca9a820bb))
* **picker.matcher:** fix cwd_bonus check ([00af290](https://github.com/folke/snacks.nvim/commit/00af2909064433ee84280dd64233a34b0f8d6027))
* **picker.matcher:** regex offset by one. Fixes [#878](https://github.com/folke/snacks.nvim/issues/878) ([9a82f0a](https://github.com/folke/snacks.nvim/commit/9a82f0a564df3e4f017e9b66da6baa41196962b7))
* **picker.undo:** add newlines ([72826a7](https://github.com/folke/snacks.nvim/commit/72826a72de93f49b2446c691e3bef04df1a44dde))
* **picker.undo:** cleanup tmp buffer ([8368176](https://github.com/folke/snacks.nvim/commit/83681762435a425ab1edb10fe3244b3e8b1280c2))
* **picker.undo:** copy over buffer lines instead of just the file ([c900e2c](https://github.com/folke/snacks.nvim/commit/c900e2cb3ab83c299c95756fc34e4ae52f4e72e9))
* **picker.undo:** disable swap for tmp undo buffer ([033db25](https://github.com/folke/snacks.nvim/commit/033db250cd688872724a84deb623b599662d79c5))
* **picker:** better main window management. Closes [#842](https://github.com/folke/snacks.nvim/issues/842) ([f0f053a](https://github.com/folke/snacks.nvim/commit/f0f053a1d9b16edaa27f05e20ad6fd862db8c6f7))
* **picker:** improve resume. Closes [#853](https://github.com/folke/snacks.nvim/issues/853) ([0f5b30b](https://github.com/folke/snacks.nvim/commit/0f5b30b41196d831cda84e4b792df2ce765fd856))
* **picker:** make pick_win work with split layouts. Closes [#834](https://github.com/folke/snacks.nvim/issues/834) ([6dbc267](https://github.com/folke/snacks.nvim/commit/6dbc26757cb043c8153a4251a1f75bff4dcadf68))
* **picker:** multi layouts that need async task work again. ([cd44efb](https://github.com/folke/snacks.nvim/commit/cd44efb60ce70382de02d069e269bb40e5e7fa22))
* **picker:** no auto-close when entering a floating window ([08e6c12](https://github.com/folke/snacks.nvim/commit/08e6c12358d57dfb497f8ce7de7eb09134868dc7))
* **picker:** no need to track jumping ([b37ea74](https://github.com/folke/snacks.nvim/commit/b37ea748b6ff56cd479600b1c39d19a308ee7eae))
* **picker:** propagate WinEnter when going to the real window after entering the layout split window ([8555789](https://github.com/folke/snacks.nvim/commit/8555789d86f7f6127fdf023723775207972e0c44))
* **picker:** show regex matches in list when needed. Fixes [#878](https://github.com/folke/snacks.nvim/issues/878) ([1d99bac](https://github.com/folke/snacks.nvim/commit/1d99bac9bcf75a11adc6cd78cde4477a95f014bd))
* **picker:** show_empty for files / grep. Closes [#808](https://github.com/folke/snacks.nvim/issues/808) ([a13ff6f](https://github.com/folke/snacks.nvim/commit/a13ff6fe0f68c3242d6be5e352d762b6037a9695))
* **util:** better default icons when no icon plugin is installed ([0e4ddfd](https://github.com/folke/snacks.nvim/commit/0e4ddfd3ee1d81def4028e52e44e45ac3ce98cfc))
* **util:** better keymap normalization ([e1566a4](https://github.com/folke/snacks.nvim/commit/e1566a483df1badc97729f66b1faf358d2bd3362))
* **util:** normkey. Closes [#763](https://github.com/folke/snacks.nvim/issues/763) ([6972960](https://github.com/folke/snacks.nvim/commit/69729608e101923810a13942f0b3bef98f253592))
* **win:** close help when leaving the win buffer ([4aba559](https://github.com/folke/snacks.nvim/commit/4aba559c6e321f90524a2e8164b8fd1f9329552e))
### Performance Improvements
* **explorer:** don't wait till git status finished. Update tree when needed. See [#869](https://github.com/folke/snacks.nvim/issues/869) ([287db30](https://github.com/folke/snacks.nvim/commit/287db30ed21dc2a8be80fabcffcec9b1b878e04e))
* **explorer:** use cache when possible for opening/closing directories. Closes [#869](https://github.com/folke/snacks.nvim/issues/869) ([cef4fc9](https://github.com/folke/snacks.nvim/commit/cef4fc91813ba6e6932db88a1c9e82a30ea51349))
* **git:** also check top-level path to see if it's a git root. Closes [#807](https://github.com/folke/snacks.nvim/issues/807) ([b9e7c51](https://github.com/folke/snacks.nvim/commit/b9e7c51e8f7eea876275e52f1083b58f9d2df92f))
* **picker.files:** no need to check every time for cmd availability ([8f87c2c](https://github.com/folke/snacks.nvim/commit/8f87c2c32bbb75a4fad4f5768d5faa963c4f66d8))
* **picker.undo:** more performance improvements for the undo picker ([3d4b8ee](https://github.com/folke/snacks.nvim/commit/3d4b8eeea9380eb7488217af74f9448eaa7b376e))
* **picker.undo:** use a tmp buffer to get diffs. Way faster than before. Closes [#863](https://github.com/folke/snacks.nvim/issues/863) ([d4a5449](https://github.com/folke/snacks.nvim/commit/d4a54498131a5d9027bccdf2cd0edd2d22594ce7))
## [2.17.0](https://github.com/folke/snacks.nvim/compare/v2.16.0...v2.17.0) (2025-01-30)
### Features
* **picker.actions:** allow selecting the visual selection with `<Tab>` ([96c76c6](https://github.com/folke/snacks.nvim/commit/96c76c6d9d401c2205d73639389b32470c550e6a))
* **picker.explorer:** focus dir on confirm from search ([605f745](https://github.com/folke/snacks.nvim/commit/605f7451984f0011635423571ad83ab74f342ed8))
### Bug Fixes
* **git:** basic support for git work trees ([d76d9aa](https://github.com/folke/snacks.nvim/commit/d76d9aaaf2399c6cf15c5b37a9183680b106a4af))
* **picker.preview:** properly refresh the preview after layout changes. Fixes [#802](https://github.com/folke/snacks.nvim/issues/802) ([47993f9](https://github.com/folke/snacks.nvim/commit/47993f9a809ce13e98c3132d463d5a3002289fd6))
* **picker:** add proper close ([15a9411](https://github.com/folke/snacks.nvim/commit/15a94117e17d78c8c2e579d20988d4cb9e85d098))
* **picker:** make jumping work again... ([f40f338](https://github.com/folke/snacks.nvim/commit/f40f338d669bf2d54b224e4a973c52c8157fe505))
* **picker:** show help for input / list window with `?`. ([87dab7e](https://github.com/folke/snacks.nvim/commit/87dab7eca7949b85c0ee688f86c08b8c437f9433))
* **win:** properly handle closing the last window. Fixes [#793](https://github.com/folke/snacks.nvim/issues/793) ([18de5bb](https://github.com/folke/snacks.nvim/commit/18de5bb23898fa2055afee5035c97a2abe4aae6b))
## [2.16.0](https://github.com/folke/snacks.nvim/compare/v2.15.0...v2.16.0) (2025-01-30)
### Features
* **layout:** added support for split layouts (root box can be a split) ([6da592e](https://github.com/folke/snacks.nvim/commit/6da592e130295388ee64fe282eb0dafa0b99fa2f))
* **layout:** make fullscreen work for split layouts ([115f8c6](https://github.com/folke/snacks.nvim/commit/115f8c6ae9c9a57b36677b728a6f6cc9207c6489))
* **picker.actions:** added separate hl group for pick win current ([9b80e44](https://github.com/folke/snacks.nvim/commit/9b80e444f548aea26214a95ad9e1affc4ef5d91c))
* **picker.actions:** separate edit_split etc in separate split and edit actions. Fixes [#791](https://github.com/folke/snacks.nvim/issues/791) ([3564f4f](https://github.com/folke/snacks.nvim/commit/3564f4fede6feefdfe1dc200295eb3b162996d6d))
* **picker.config:** added `opts.config` which can be a function that can change the resolved options ([b37f368](https://github.com/folke/snacks.nvim/commit/b37f368a81d0a6ce8b7c9f683f9c0c736af6de36))
* **picker.explorer:** added `explorer_move` action mapped to `m` ([08b9083](https://github.com/folke/snacks.nvim/commit/08b9083f4759c87c93f6afb4af0a1f3d2b8ad1fa))
* **picker.explorer:** live search ([db52796](https://github.com/folke/snacks.nvim/commit/db52796e79c63dfa0d5d689d5d13b120f6184642))
* **picker.files:** allow forcing the files finder to use a certain cmd ([3e1dc30](https://github.com/folke/snacks.nvim/commit/3e1dc300cc98815ad74ae11c98f7ebebde966c39))
* **picker.format:** better path formatting for directories ([08f3c32](https://github.com/folke/snacks.nvim/commit/08f3c32c7d64a81ea35d1cb0d22fc140d25c9088))
* **picker.format:** directory formatting ([847509e](https://github.com/folke/snacks.nvim/commit/847509e12c0cd95355cb05c97e1bc8bedde29957))
* **picker.jump:** added `opts.jump.close`, which default to true, but is false for explorer ([a9591ed](https://github.com/folke/snacks.nvim/commit/a9591ed43f4de3b611028eadce7d36c4b3dedca8))
* **picker.list:** added support for setting a cursor/topline target for the next render. Target clears when reached, or when finders finishes. ([da08379](https://github.com/folke/snacks.nvim/commit/da083792053e41c57e8ca5e9fe9e5b175b1e378d))
* **picker:** `opts.focus = "input"|"list"|false` to configure what to focus (if anything) when showing the picker ([5a8d798](https://github.com/folke/snacks.nvim/commit/5a8d79847b1959f9c9515b51a062f6acbe22f1a4))
* **picker:** `picker:iter()` now also returns `idx` ([118d908](https://github.com/folke/snacks.nvim/commit/118d90899d7b2bb0a28a799dbf2a21ed39516e66))
* **picker:** added `edit_win` action bound to `ctrl+enter` to pick a window and edit ([2ba5be8](https://github.com/folke/snacks.nvim/commit/2ba5be84910d14454292423f08ad83ea213de2ba))
* **picker:** added `git_stash` picker. Closes [#762](https://github.com/folke/snacks.nvim/issues/762) ([bb3db11](https://github.com/folke/snacks.nvim/commit/bb3db117a45da1dabe76f08a75144b028314e6b6))
* **picker:** added `notifications` picker. Closes [#738](https://github.com/folke/snacks.nvim/issues/738) ([32cffd2](https://github.com/folke/snacks.nvim/commit/32cffd2e603ccace129b62c777933a42203c5c77))
* **picker:** added support for split layouts to picker (sidebar and ivy_split) ([5496c22](https://github.com/folke/snacks.nvim/commit/5496c22b6e20a26d2252543029faead946cc2ce9))
* **picker:** added support to keep the picker open when focusing another window (auto_close = false) ([ad8f166](https://github.com/folke/snacks.nvim/commit/ad8f16632c63a3082ea0e80a39cdbd774624532a))
* **picker:** new file explorer `Snacks.picker.explorer()` ([00613bd](https://github.com/folke/snacks.nvim/commit/00613bd4163c89e01c1d534d283cfe531773fdc8))
* **picker:** opening a picker with the same source as an active picker, will close it instead (toggle) ([b6cf033](https://github.com/folke/snacks.nvim/commit/b6cf033051aa2f859d9d217bc60e89806fcf5377))
* **picker:** reworked toggles (flags). they're now configurable. Closes [#770](https://github.com/folke/snacks.nvim/issues/770) ([e16a6a4](https://github.com/folke/snacks.nvim/commit/e16a6a441322c944b41e9ae5b30ba816145218cd))
* **rename:** optional `file`, `on_rename` for `Snacks.rename.rename_file()` ([9d8c277](https://github.com/folke/snacks.nvim/commit/9d8c277bebb9483b1d46c7eeeff348966076347f))
### Bug Fixes
* **bigfile:** check if buf still exists when applying syntax. Fixes [#737](https://github.com/folke/snacks.nvim/issues/737) ([08852ac](https://github.com/folke/snacks.nvim/commit/08852ac7f811f51d47a590d62df805d0e84e611a))
* **bufdelete:** ctrl-c throw error in `fn.confirm` ([#750](https://github.com/folke/snacks.nvim/issues/750)) ([3a3e795](https://github.com/folke/snacks.nvim/commit/3a3e79535bb085815d3add9f678d30b98b5f900f))
* **bufdelete:** invalid lua ([b1f4f99](https://github.com/folke/snacks.nvim/commit/b1f4f99a51ef1ca11a0c802b847501b71f09161b))
* **dashboard:** better handling of closed dashboard win ([6cb7fdf](https://github.com/folke/snacks.nvim/commit/6cb7fdfb036239b9c1b6d147633e494489a45191))
* **dashboard:** don't override user configuration ([#774](https://github.com/folke/snacks.nvim/issues/774)) ([5ff2ad3](https://github.com/folke/snacks.nvim/commit/5ff2ad320b0cd1e17d48862c74af0df205894f37))
* **dashboard:** fix dasdhboard when opening in a new win. Closes [#767](https://github.com/folke/snacks.nvim/issues/767) ([d44b978](https://github.com/folke/snacks.nvim/commit/d44b978d7dbe7df8509a172cef0913b5a9ac77e3))
* **dashboard:** prevent starting picker twice when no session manager. Fixes [#783](https://github.com/folke/snacks.nvim/issues/783) ([2f396b3](https://github.com/folke/snacks.nvim/commit/2f396b341dc1a072643eb402bfaa8a73f6be19a1))
* **filter:** insert path from `filter.paths` into `self.paths` ([#761](https://github.com/folke/snacks.nvim/issues/761)) ([ac20c6f](https://github.com/folke/snacks.nvim/commit/ac20c6ff5d0ac8747e164d592e8ae7e8f2581b2e))
* **layout:** better handling of resizing of split layouts ([c8ce9e2](https://github.com/folke/snacks.nvim/commit/c8ce9e2b33623d21901e02213319270936e4545f))
* **layout:** better update check for split layouts ([b50d697](https://github.com/folke/snacks.nvim/commit/b50d697ce45dbee5efe25371428b7f23b037d0ed))
* **layout:** make sure split layouts are still visible when a float layout with backdrop opens ([696d198](https://github.com/folke/snacks.nvim/commit/696d1981b18ad1f0cc0e480aafed78a064730417))
* **matcher.score:** correct prev_class for transition bonusses when in a gap. Fixes [#787](https://github.com/folke/snacks.nvim/issues/787) ([b45d0e0](https://github.com/folke/snacks.nvim/commit/b45d0e03579c80ac901261e0e2705a1be3dfcb20))
* **picker.actions:** detect and report circular action references ([0ffc003](https://github.com/folke/snacks.nvim/commit/0ffc00367a957c1602df745c2038600d48d96305))
* **picker.actions:** proper cr check ([6c9f866](https://github.com/folke/snacks.nvim/commit/6c9f866b3123cbc8cbef91f55593d30d98d4f26a))
* **picker.actions:** stop pick_win when no target and only unhide when picker wasn't stopped ([4a1d189](https://github.com/folke/snacks.nvim/commit/4a1d189f9f7afac4180f7a459597bb094d11435b))
* **picker.actions:** when only 1 win, `pick_win` will select that automatically. Show warning when no windows. See [#623](https://github.com/folke/snacks.nvim/issues/623) ([ba5a70b](https://github.com/folke/snacks.nvim/commit/ba5a70b84d12aa9e497cfea86d5358aa5cf0aad3))
* **picker.config:** fix wrong `opts.cwd = true` config. Closes [#757](https://github.com/folke/snacks.nvim/issues/757) ([ea44a2d](https://github.com/folke/snacks.nvim/commit/ea44a2d4c21aa10fb57fe08b974999f7b8d117d2))
* **picker.config:** normalize `opts.cwd` ([69c013e](https://github.com/folke/snacks.nvim/commit/69c013e1b27e2f70def48576aaffcc1081fa0e47))
* **picker.explorer:** fix cwd for items ([71070b7](https://github.com/folke/snacks.nvim/commit/71070b78f0482a42448da2cee64ed0d84c507314))
* **picker.explorer:** stop file follow when picker was closed ([89fcb3b](https://github.com/folke/snacks.nvim/commit/89fcb3bb2025cb1c986e9af3478715f6e0bdf425))
* **picker.explorer:** when searching, go to first non internal node in the list ([276497b](https://github.com/folke/snacks.nvim/commit/276497b3969cdefd18aa731c5e3d5c1bb8289cca))
* **picker.filter:** proper cwd check. See [#757](https://github.com/folke/snacks.nvim/issues/757) ([e4ae9e3](https://github.com/folke/snacks.nvim/commit/e4ae9e32295d688a1e0d3f59ab1ba4cc78d1ba89))
* **picker.git:** better stash pattern. Closes [#775](https://github.com/folke/snacks.nvim/issues/775) ([e960010](https://github.com/folke/snacks.nvim/commit/e960010496f860d1077f1e54d193e127ad7e26ad))
* **picker.git:** default to git root for `git_files`. Closes [#751](https://github.com/folke/snacks.nvim/issues/751) ([3cdebee](https://github.com/folke/snacks.nvim/commit/3cdebee880742970df1a1f685be4802b90642c7d))
* **picker.git:** ignore autostash ([2b15357](https://github.com/folke/snacks.nvim/commit/2b15357c25db315567f08e7ec8d5c85c94d0753f))
* **picker.git:** show diff for staged files. Fixes [#747](https://github.com/folke/snacks.nvim/issues/747) ([e87f0ff](https://github.com/folke/snacks.nvim/commit/e87f0ffcd100a3a6686549e25f480c1311f08d8f))
* **picker.layout:** fix list cursorline when layout updates ([3f43026](https://github.com/folke/snacks.nvim/commit/3f43026f579f33b679a924dea699df86e8b965b2))
* **picker.layout:** make split layouts work in layout preview ([215ae72](https://github.com/folke/snacks.nvim/commit/215ae72daaed5d7ee18b72e8b14bfd6a727bc939))
* **picker.lsp:** remove symbol detail from search text. too noisy ([92710df](https://github.com/folke/snacks.nvim/commit/92710dfb0bacc72a82e0172bb06f5eb9ad82964a))
* **picker.multi:** apply source filter settings for multi source pickers. See [#761](https://github.com/folke/snacks.nvim/issues/761) ([4e30ff0](https://github.com/folke/snacks.nvim/commit/4e30ff0f1ed58b0bdc8fd3f5f1a9a440959eb998))
* **picker.preview:** don't enable numbers when minimal=true ([04e2995](https://github.com/folke/snacks.nvim/commit/04e2995bbfc505d0fc91263712d0255f102f404e))
* **picker.preview:** don't error on invalid start positions for regex. Fixes [#784](https://github.com/folke/snacks.nvim/issues/784) ([460b58b](https://github.com/folke/snacks.nvim/commit/460b58bdbd57e32a1bed22b3e176fa53befeafaa))
* **picker.preview:** only show binary message when binary and no ft. Closes [#729](https://github.com/folke/snacks.nvim/issues/729) ([ea838e2](https://github.com/folke/snacks.nvim/commit/ea838e28383d74d60cd6d714cac9b007a4a4469a))
* **picker.resume:** fix picker is nil ([#772](https://github.com/folke/snacks.nvim/issues/772)) ([1a5a087](https://github.com/folke/snacks.nvim/commit/1a5a0871c822e5de8e69c10bb1d6cb3dfc2f5c86))
* **picker.score:** scoring closer to fzf. See [#787](https://github.com/folke/snacks.nvim/issues/787) ([390f017](https://github.com/folke/snacks.nvim/commit/390f017c3b227377c09ae6572f88b7c42304b811))
* **picker.select:** allow configuring `vim.ui.select` with the `select` source. Closes [#776](https://github.com/folke/snacks.nvim/issues/776) ([d70af2d](https://github.com/folke/snacks.nvim/commit/d70af2d253f61164a44a8676a5fc316cad10497f))
* **picker.util:** proper cwd check for paths. Fixes [#754](https://github.com/folke/snacks.nvim/issues/754). See [#757](https://github.com/folke/snacks.nvim/issues/757) ([1069d78](https://github.com/folke/snacks.nvim/commit/1069d783347a7a5213240e2e12e485ab57e15bd8))
* **picker:** better handling of win Enter/Leave mostly for split layouts ([046653a](https://github.com/folke/snacks.nvim/commit/046653a4f166633339a276999738bac43c3c1388))
* **picker:** don't destroy active pickers (only an issue when multiple pickers were open) ([b479f10](https://github.com/folke/snacks.nvim/commit/b479f10b24a8cf5325bc575e1bab2fc51ebfde45))
* **picker:** only do preview scrolling when preview is scrolling and removed default preview horizontal scrolling keymaps ([a998c71](https://github.com/folke/snacks.nvim/commit/a998c714c31ab92a06b9edafef71251b63f0eb5b))
* **picker:** show new notifications on top ([0df7c0b](https://github.com/folke/snacks.nvim/commit/0df7c0bef59be861f3e6682aa1381f6422f4a0af))
* **picker:** split edit_win in `{"pick_win", "jump"}` ([dcd3bc0](https://github.com/folke/snacks.nvim/commit/dcd3bc03295a8521773c04671298bd3fdcb14f7b))
* **picker:** stopinsert again ([2250c57](https://github.com/folke/snacks.nvim/commit/2250c57529b1a8da4d96966db1cd9a46b73d8007))
* **win:** don't destroy opts. Fixes [#726](https://github.com/folke/snacks.nvim/issues/726) ([473be03](https://github.com/folke/snacks.nvim/commit/473be039e59730b0554a7dfda2eb800ecf7a948e))
* **win:** error when enabling padding with `listchars=""` ([#786](https://github.com/folke/snacks.nvim/issues/786)) ([6effbcd](https://github.com/folke/snacks.nvim/commit/6effbcdff110c16f49c2cef5d211db86f6db5820))
### Performance Improvements
* **picker.matcher:** optimize matcher priorities and skip items that can't match for pattern subset ([dfaa18d](https://github.com/folke/snacks.nvim/commit/dfaa18d1c72a78cacfe0a682c853b7963641444c))
* **picker.recent:** correct generator for old files ([5f32414](https://github.com/folke/snacks.nvim/commit/5f32414dd645ab7650dc60379f422b00aaecea4f))
* **picker.score:** no need to track `in_gap` status. redundant since we can depend on `gap` instead ([fdf4b0b](https://github.com/folke/snacks.nvim/commit/fdf4b0bf26743eef23e645235915aa4920827daf))
## [2.15.0](https://github.com/folke/snacks.nvim/compare/v2.14.0...v2.15.0) (2025-01-23)
### Features
* **debug:** truncate inspect to 2000 lines max ([570d219](https://github.com/folke/snacks.nvim/commit/570d2191d598d344ddd5b2a85d8e79d207955cc3))
* **input:** input history. Closes [#591](https://github.com/folke/snacks.nvim/issues/591) ([80db91f](https://github.com/folke/snacks.nvim/commit/80db91f03e3493e9b3aa09d1cd90b063ae0ec31c))
* **input:** persistent history. Closes [#591](https://github.com/folke/snacks.nvim/issues/591) ([0ed68bd](https://github.com/folke/snacks.nvim/commit/0ed68bdf7268bf1baef7a403ecc799f2c016b656))
* **picker.debug:** more info about potential leaks ([8d9677f](https://github.com/folke/snacks.nvim/commit/8d9677fc479710ae1f531fc52b0ac368def55b0b))
* **picker.filter:** Filter arg for filter ([5a4b684](https://github.com/folke/snacks.nvim/commit/5a4b684c0dd3eda10ce86f9710e085431a7656f2))
* **picker.finder:** optional transform function ([5e69fb8](https://github.com/folke/snacks.nvim/commit/5e69fb83d50bb79ff62352418733d11562e488d0))
* **picker.format:** `filename_only` option ([0396bdf](https://github.com/folke/snacks.nvim/commit/0396bdfc3eece8438ed6a978f1dbddf3f675ca36))
* **picker.git:** git_log, git_log_file, git_log_line now do git_checkout as confirm. Closes [#722](https://github.com/folke/snacks.nvim/issues/722) ([e6fb538](https://github.com/folke/snacks.nvim/commit/e6fb5381a9bfcbd0f1693ea9c7e3711045380187))
* **picker.help:** add more color to help tags ([5778234](https://github.com/folke/snacks.nvim/commit/5778234e3917999a0be1a5b8145dd83ab41035b3))
* **picker.keymaps:** add global + buffer toggles ([#705](https://github.com/folke/snacks.nvim/issues/705)) ([b7c08df](https://github.com/folke/snacks.nvim/commit/b7c08df2b8ff23e0293cfe06beaf60aa6fd14efc))
* **picker.keymaps:** improvements to keymaps picker ([2762c37](https://github.com/folke/snacks.nvim/commit/2762c37eb09bc434eba647d4ec079d6064d3c563))
* **picker.matcher:** frecency and cwd bonus can now be enabled on any picker ([7b85dfc](https://github.com/folke/snacks.nvim/commit/7b85dfc6f60538b0419ca1b969553891b64cd9b8))
* **picker.multi:** multi now also merges keymaps ([8b2c78a](https://github.com/folke/snacks.nvim/commit/8b2c78a3bf5a3ca52c8c9e46b9d15c288c59c5c1))
* **picker.preview:** better positioning of preview location ([3864955](https://github.com/folke/snacks.nvim/commit/38649556ee9f831e5d456043a796ae0fb115f8eb))
* **picker.preview:** fallback highlight of results when no `end_pos`. Mostly useful for grep. ([d12e454](https://github.com/folke/snacks.nvim/commit/d12e45433960210a16a37adc116e645e253578c1))
* **picker.smart:** add bufdelete actions from buffers picker ([#679](https://github.com/folke/snacks.nvim/issues/679)) ([67fbab1](https://github.com/folke/snacks.nvim/commit/67fbab1bf7f5c436e28af715097eecb2232eea59))
* **picker.smart:** re-implemented smart as multi-source picker ([450d1d4](https://github.com/folke/snacks.nvim/commit/450d1d4d4c218ac1df63924d29717caa61c98f27))
* **picker.util:** smart path truncate. Defaults to 40. Closes [#708](https://github.com/folke/snacks.nvim/issues/708) ([bab8243](https://github.com/folke/snacks.nvim/commit/bab8243395de8d8748a7295906bee7723b7b8190))
* **picker:** added `lazy` source to search for a plugin spec. Closes [#680](https://github.com/folke/snacks.nvim/issues/680) ([d03bd00](https://github.com/folke/snacks.nvim/commit/d03bd00ced5a03f1cb317b9227a6a1812e35a6c2))
* **picker:** added `opts.rtp` (bool) to find/grep over files in the rtp. See [#680](https://github.com/folke/snacks.nvim/issues/680) ([9d5d3bd](https://github.com/folke/snacks.nvim/commit/9d5d3bdb1747669d74587662cce93021fc99f878))
* **picker:** added new `icons` picker for nerd fonts and emoji. Closes [#703](https://github.com/folke/snacks.nvim/issues/703) ([97898e9](https://github.com/folke/snacks.nvim/commit/97898e910d92e50e886ba044ab255360e4271ffc))
* **picker:** getters and setters for cwd ([2c2ff4c](https://github.com/folke/snacks.nvim/commit/2c2ff4caf85ba1cfee3d946ea6ab9fd595ec3667))
* **picker:** multi source picker. Combine multiple pickers (as opposed to just finders) in one picker ([9434986](https://github.com/folke/snacks.nvim/commit/9434986ff15acfca7e010f159460f9ecfee81363))
* **picker:** persistent history. Closes [#528](https://github.com/folke/snacks.nvim/issues/528) ([ea665eb](https://github.com/folke/snacks.nvim/commit/ea665ebad18a8ccd6444df7476237de4164af64a))
* **picker:** preview window horizontal scrolling ([#686](https://github.com/folke/snacks.nvim/issues/686)) ([bc47e0b](https://github.com/folke/snacks.nvim/commit/bc47e0b1dd0102b58a90aba87f22e0cc0a48985c))
* **picker:** syntax highlighting for command and search history ([efb6d1f](https://github.com/folke/snacks.nvim/commit/efb6d1f8b8057e5f8455452c47ab769358902a18))
* **profiler:** added support for `Snacks.profiler` and dropped support for fzf-lua / telescope. Closes [#695](https://github.com/folke/snacks.nvim/issues/695) ([ada83de](https://github.com/folke/snacks.nvim/commit/ada83de9528d0825928726a6d252fb97271fb73a))
### Bug Fixes
* **picker.actions:** `checktime` after `git_checkout` ([b86d90e](https://github.com/folke/snacks.nvim/commit/b86d90e3e9c68f4d24a0208e873d35b0074c12b0))
* **picker.async:** better handling of abort and schedule/defer util function ([dfcf27e](https://github.com/folke/snacks.nvim/commit/dfcf27e2a90d4b262d2bd0e54c1b576dba296c73))
* **picker.async:** fixed aborting a coroutine from the coroutine itself. See [#665](https://github.com/folke/snacks.nvim/issues/665) ([c1e2c61](https://github.com/folke/snacks.nvim/commit/c1e2c619b229a3f2ccdc000a6fadddc7ca9f482d))
* **picker.files:** include symlinks ([dc9c6fb](https://github.com/folke/snacks.nvim/commit/dc9c6fbd028e0488a9292e030c788b72b16cbeca))
* **picker.frecency:** track visit on BufWinEnter instead of BufReadPost and exclude floating windows ([024a448](https://github.com/folke/snacks.nvim/commit/024a448e52563aadf9e5b234ddfb17168aa5ada7))
* **picker.git_branches:** handle detached HEAD ([#671](https://github.com/folke/snacks.nvim/issues/671)) ([390f687](https://github.com/folke/snacks.nvim/commit/390f6874318addcf48b668f900ef62d316c44602))
* **picker.git:** `--follow` only works for `git_log_file`. Closes [#666](https://github.com/folke/snacks.nvim/issues/666) ([23a8668](https://github.com/folke/snacks.nvim/commit/23a8668ef0b0c9d910c7bbcd57651d8889b0fa65))
* **picker.git:** parse all detached states. See [#671](https://github.com/folke/snacks.nvim/issues/671) ([2cac667](https://github.com/folke/snacks.nvim/commit/2cac6678a95f89a7e23ed668c9634eff9e60dbe5))
* **picker.grep:** off-by-one for grep results col ([e3455ef](https://github.com/folke/snacks.nvim/commit/e3455ef4dc96fac3b53f76e12c487007a5fca9e7))
* **picker.icons:** bump build for nerd fonts ([ba108e2](https://github.com/folke/snacks.nvim/commit/ba108e2aa86909168905e522342859ec9ed4e220))
* **picker.icons:** fix typo in Nerd Fonts and display the full category name ([#716](https://github.com/folke/snacks.nvim/issues/716)) ([a4b0a85](https://github.com/folke/snacks.nvim/commit/a4b0a85e3bc68fe1aeca1ee4161053dabaeb856c))
* **picker.icons:** opts.icons -> opts.icon_sources. Fixes [#715](https://github.com/folke/snacks.nvim/issues/715) ([9e7bfc0](https://github.com/folke/snacks.nvim/commit/9e7bfc05d5e4a0f079f695cdd6869c219c762224))
* **picker.input:** better handling of `stopinsert` with prompt buffers. Closes [#723](https://github.com/folke/snacks.nvim/issues/723) ([c2916cb](https://github.com/folke/snacks.nvim/commit/c2916cb526d42fb6726cf9f7252ceb44516fc2f6))
* **picker.input:** correct cursor position in input when cycling / focus. Fixes [#688](https://github.com/folke/snacks.nvim/issues/688) ([93cca7a](https://github.com/folke/snacks.nvim/commit/93cca7a4b3923c291726305b301a51316b275bf2))
* **picker.lsp:** include_current on Windows. Closes [#678](https://github.com/folke/snacks.nvim/issues/678) ([66d2854](https://github.com/folke/snacks.nvim/commit/66d2854ea0c83339042b6340b29dfdc48982e75a))
* **picker.lsp:** make `lsp_symbols` work for unloaded buffers ([9db49b7](https://github.com/folke/snacks.nvim/commit/9db49b7e6c5ded7edeff8bec6327322fb6125695))
* **picker.lsp:** schedule_wrap cancel functions and resume when no clients ([6cbca8a](https://github.com/folke/snacks.nvim/commit/6cbca8adffd4014e9f67ba327f9c164f0412b685))
* **picker.lsp:** use async from ctx ([b878caa](https://github.com/folke/snacks.nvim/commit/b878caaddc7b91386ec95b3b2f034b275dc7f49a))
* **picker.lsp:** use correct buf/win ([8006caa](https://github.com/folke/snacks.nvim/commit/8006caadb3eedf2553a587497c508c01aadf098b))
* **picker.preview:** clear buftype for file previews ([5429dff](https://github.com/folke/snacks.nvim/commit/5429dff1cd51ceaa10134dbff4faf447823de017))
* **picker.undo:** use new API. Closes [#707](https://github.com/folke/snacks.nvim/issues/707) ([79a6eab](https://github.com/folke/snacks.nvim/commit/79a6eabd318d2b65d5786c4e3c2419eaa91c6240))
* **picker.util:** for `--` args require a space before ([ee6f21b](https://github.com/folke/snacks.nvim/commit/ee6f21bbd636e82691a0386f39f0c8310f8cadd8))
* **picker.util:** more relaxed resolve_loc ([964beb1](https://github.com/folke/snacks.nvim/commit/964beb11489afc2a2a1004bbb1b2b3286da9a8ac))
* **picker.util:** prevent empty shortened paths if it's the cwd. Fixes [#721](https://github.com/folke/snacks.nvim/issues/721) ([14f16ce](https://github.com/folke/snacks.nvim/commit/14f16ceb5d4dc53ddbd9b56992335658105d1d5f))
* **picker:** better handling of buffers with custom URIs. Fixes [#677](https://github.com/folke/snacks.nvim/issues/677) ([cd5eddb](https://github.com/folke/snacks.nvim/commit/cd5eddb1dea0ab69a451702395104cf716678b36))
* **picker:** don't jump to invalid positions. Fixes [#712](https://github.com/folke/snacks.nvim/issues/712) ([51adb67](https://github.com/folke/snacks.nvim/commit/51adb6792e1819c9cf0153606f506403f97647fe))
* **picker:** don't try showing the preview when the picker is closed. Fixes [#714](https://github.com/folke/snacks.nvim/issues/714) ([11c0761](https://github.com/folke/snacks.nvim/commit/11c07610557f0a6c6eb40bca60c60982ff6e3b93))
* **picker:** resume. Closes [#709](https://github.com/folke/snacks.nvim/issues/709) ([9b55a90](https://github.com/folke/snacks.nvim/commit/9b55a907bd0468752c3e5d9cd7e607cab206a6d7))
* **picker:** starting a picker from the picker sometimes didnt start in insert mode. Fixes [#718](https://github.com/folke/snacks.nvim/issues/718) ([08d4f14](https://github.com/folke/snacks.nvim/commit/08d4f14cd85466fd37d63b7123437c7d15bc87f6))
* **picker:** update title on find. Fixes [#717](https://github.com/folke/snacks.nvim/issues/717) ([431a24e](https://github.com/folke/snacks.nvim/commit/431a24e24e2a7066e44272f83410d7b44f497e26))
* **scroll:** handle buffer changes while animating ([3da0b0e](https://github.com/folke/snacks.nvim/commit/3da0b0ec11dff6c88e68c91194688c9ff3513e86))
* **win:** better way of finding a main window when fixbuf is `true` ([84ee7dd](https://github.com/folke/snacks.nvim/commit/84ee7ddf543aa1249ca4e29873200073e28f693f))
* **zen:** parent buf. Fixes [#720](https://github.com/folke/snacks.nvim/issues/720) ([f314676](https://github.com/folke/snacks.nvim/commit/f31467637ac91406efba15981d53cd6da09718e0))
### Performance Improvements
* **picker.frecency:** cache all deadlines on load ([5b3625b](https://github.com/folke/snacks.nvim/commit/5b3625bcea5ed78e7cddbeb038159a0041110c71))
* **picker:** gc optims ([3fa2ea3](https://github.com/folke/snacks.nvim/commit/3fa2ea3115c2e8203ec44025ff4be054c5f1e917))
* **picker:** small optims ([ee76e9b](https://github.com/folke/snacks.nvim/commit/ee76e9ba674e6b67a3d687868f27751745e2baad))
* **picker:** small optims for abort ([317a209](https://github.com/folke/snacks.nvim/commit/317a2093ea0cdd62a34f3a414e625f3313e5e2e8))
* **picker:** use picker ref in progress updater. Fixes [#710](https://github.com/folke/snacks.nvim/issues/710) ([37f3888](https://github.com/folke/snacks.nvim/commit/37f3888dccc922e4044ee1713c25dba51b4290d2))
## [2.14.0](https://github.com/folke/snacks.nvim/compare/v2.13.0...v2.14.0) (2025-01-20)
### Features
* **picker.buffer:** add filetype to bufname for buffers without name ([83baea0](https://github.com/folke/snacks.nvim/commit/83baea06d65d616f1f800501d0d82e4ad117abf2))
* **picker.debug:** debug option to detect garbage collection leaks ([b59f4ff](https://github.com/folke/snacks.nvim/commit/b59f4ff477a18cdc3673a240c2e992a2bccd48fe))
* **picker.matcher:** new `opts.matcher.file_pos` which defaults to `true` to support patterns like `file:line:col` or `file:line`. Closes [#517](https://github.com/folke/snacks.nvim/issues/517). Closes [#496](https://github.com/folke/snacks.nvim/issues/496). Closes [#651](https://github.com/folke/snacks.nvim/issues/651) ([5e00b0a](https://github.com/folke/snacks.nvim/commit/5e00b0ab271149f1bd74d5d5afe106b440f45a9d))
* **picker:** added `args` option for `files` and `grep`. Closes [#621](https://github.com/folke/snacks.nvim/issues/621) ([781b6f6](https://github.com/folke/snacks.nvim/commit/781b6f6ab0cd5f65a685bf8bac284f4a12e43589))
* **picker:** added `undo` picker to navigate the undo tree. Closes [#638](https://github.com/folke/snacks.nvim/issues/638) ([5c45f1c](https://github.com/folke/snacks.nvim/commit/5c45f1c193f2ed2fa639146df373f341d7410e8b))
* **picker:** added support for item.resolve that gets called if needed during list rendering / preview ([b0d3266](https://github.com/folke/snacks.nvim/commit/b0d32669856b8ad9c75fa7c6c4b643566001c8bc))
* **terminal:** allow overriding default shell. Closes [#450](https://github.com/folke/snacks.nvim/issues/450) ([3146fd1](https://github.com/folke/snacks.nvim/commit/3146fd139b89760526f32fd9d3ac4c91af010f0c))
* **terminal:** close terminals on `ExitPre`. Fixes [#419](https://github.com/folke/snacks.nvim/issues/419) ([2abf208](https://github.com/folke/snacks.nvim/commit/2abf208f2c43a387ca6c55c33b5ebbc7869c189c))
### Bug Fixes
* **dashboard:** added optional filter for recent files ([32cd343](https://github.com/folke/snacks.nvim/commit/32cd34383c8ac5d0e43408aba559308546555962))
* **debug.run:** schedule only nvim_buf_set_extmark in on_print ([#425](https://github.com/folke/snacks.nvim/issues/425)) ([81572b5](https://github.com/folke/snacks.nvim/commit/81572b5f97c3cb2f2e254972762f4b816e790fde))
* **indent:** use correct hl based on indent. Fixes [#422](https://github.com/folke/snacks.nvim/issues/422) ([627af73](https://github.com/folke/snacks.nvim/commit/627af7342cf5bea06793606c33992d2cc882655b))
* **input:** put the cursor right after the default prompt ([#549](https://github.com/folke/snacks.nvim/issues/549)) ([f904481](https://github.com/folke/snacks.nvim/commit/f904481439706e678e93225372b30f97281cfc2c))
* **notifier:** added `SnacksNotifierMinimal`. Closes [#410](https://github.com/folke/snacks.nvim/issues/410) ([daa575e](https://github.com/folke/snacks.nvim/commit/daa575e3cd42f003e171dbb8a3e992e670d5032c))
* **notifier:** win:close instead of win:hide ([f29f7a4](https://github.com/folke/snacks.nvim/commit/f29f7a433a2d9ea95f43c163d57df2f647700115))
* **picker.buffers:** add buf number to text ([70106a7](https://github.com/folke/snacks.nvim/commit/70106a79306525a281a3156bae1499f70c183d1d))
* **picker.buffer:** unselect on delete. Fixes [#653](https://github.com/folke/snacks.nvim/issues/653) ([0ac5605](https://github.com/folke/snacks.nvim/commit/0ac5605bfbeb31cee4bb91a6ca7a2bfe8c4d468f))
* **picker.grep:** correctly insert args from pattern. See [#601](https://github.com/folke/snacks.nvim/issues/601) ([8601a8c](https://github.com/folke/snacks.nvim/commit/8601a8ced398145d95f118737b29f3bd5f7eb700))
* **picker.grep:** debug ([f0d51ce](https://github.com/folke/snacks.nvim/commit/f0d51ce03835815aba0a6d748b54c3277ff38b70))
* **picker.lsp.symbols:** only include filename for search with workspace symbols ([eb0e5b7](https://github.com/folke/snacks.nvim/commit/eb0e5b7efe603bea7a0823ffaed13c52b395d04b))
* **picker.lsp:** backward compat with Neovim 0.95 ([3df2408](https://github.com/folke/snacks.nvim/commit/3df2408713efdbc72f9a8fcedc8586aed50ab023))
* **picker.lsp:** lazy resolve item lsp locations. Fixes [#650](https://github.com/folke/snacks.nvim/issues/650) ([d0a0046](https://github.com/folke/snacks.nvim/commit/d0a0046e37d274d8acdfcde653f3cadb12be6ba1))
* **picker.preview:** disable relativenumber by default. Closes [#664](https://github.com/folke/snacks.nvim/issues/664) ([384b9a7](https://github.com/folke/snacks.nvim/commit/384b9a7a36b5e30959fd89d3d857855105f65611))
* **picker.preview:** off-by-one for cmd output ([da5556a](https://github.com/folke/snacks.nvim/commit/da5556aa6bceb3428700607ab3005e5b44cb8b2e))
* **picker.preview:** reset before notify ([e50f2e3](https://github.com/folke/snacks.nvim/commit/e50f2e39094d4511506329044713ac69541f4135))
* **picker.undo:** disable number and signcolumn in preview ([40cea79](https://github.com/folke/snacks.nvim/commit/40cea79697acc97c3e4f814ca99a2d261fd6a4ee))
* **picker.util:** item.resolve for nil item ([2ff21b4](https://github.com/folke/snacks.nvim/commit/2ff21b4394d1f34887cb3425e32f18a793b749c7))
* **picker.util:** relax pattern for args ([6b7705c](https://github.com/folke/snacks.nvim/commit/6b7705c7edc9b93f16179d1343f9b2ae062340f9))
* **scope:** parse treesitter injections. Closes [#430](https://github.com/folke/snacks.nvim/issues/430) ([985ada3](https://github.com/folke/snacks.nvim/commit/985ada3c14346cc6df6a6013564a6541c66f6ce9))
* **statusline:** fix status line cache key ([#656](https://github.com/folke/snacks.nvim/issues/656)) ([af55934](https://github.com/folke/snacks.nvim/commit/af559349e591afaaaf75a8b3ecf5ee6f6711dde0))
* **win:** always close created scratch buffers when win closes ([abd7e61](https://github.com/folke/snacks.nvim/commit/abd7e61b7395af10a7862cec5bc746253a3b7917))
* **zen:** properly handle close ([920a9d2](https://github.com/folke/snacks.nvim/commit/920a9d28f1b1bf5ca06755236f9bbb8853adfea8))
* **zen:** sync cursor with parent window ([#547](https://github.com/folke/snacks.nvim/issues/547)) ([ba45c28](https://github.com/folke/snacks.nvim/commit/ba45c280dd9a35a6441a89d830b72f7cc8849b74)), closes [#539](https://github.com/folke/snacks.nvim/issues/539)
### Performance Improvements
* **picker:** fixed some issues with closed pickers not always being garbage collected ([eebf44a](https://github.com/folke/snacks.nvim/commit/eebf44a34e9e004f988437116140712834efd745))
## [2.13.0](https://github.com/folke/snacks.nvim/compare/v2.12.0...v2.13.0) (2025-01-19)
### Features
* **picker.actions:** added support for action options. Fixes [#598](https://github.com/folke/snacks.nvim/issues/598) ([8035398](https://github.com/folke/snacks.nvim/commit/8035398e523588df7eac928fd23e6692522f6e1e))
* **picker.buffers:** del buffer with ctrl+x ([2479ff7](https://github.com/folke/snacks.nvim/commit/2479ff7cf41392130bd660fb787e3b1730863657))
* **picker.buffers:** delete buffers with dd ([2ab18a0](https://github.com/folke/snacks.nvim/commit/2ab18a0b9f425ccbc697adc53a01b26ea38abe0d))
* **picker.commands:** added builtin commands. Fixes [#634](https://github.com/folke/snacks.nvim/issues/634) ([ee988fa](https://github.com/folke/snacks.nvim/commit/ee988fa4b018ae617a16e2a4078b4586f08364f2))
* **picker.frecency:** cleanup old entries from sqlite3 database ([320a4a6](https://github.com/folke/snacks.nvim/commit/320a4a62a159f9d3177251e21d81cb96156291b9))
* **picker.git:** added `git_diff` picker for diff hunks ([#519](https://github.com/folke/snacks.nvim/issues/519)) ([cc69043](https://github.com/folke/snacks.nvim/commit/cc690436892d6ab0b8d5ee51ad60ff91c3a5d640))
* **picker.git:** git diff/show can now use native or neovim for preview. defaults to neovim. Closes [#500](https://github.com/folke/snacks.nvim/issues/500). Closes [#494](https://github.com/folke/snacks.nvim/issues/494). Closes [#491](https://github.com/folke/snacks.nvim/issues/491). Closes [#478](https://github.com/folke/snacks.nvim/issues/478) ([e36e6af](https://github.com/folke/snacks.nvim/commit/e36e6af96cb2ac0574199ab9d229735fb6d9f016))
* **picker.git:** stage/unstage files in git status with `<tab>` key ([0892db4](https://github.com/folke/snacks.nvim/commit/0892db4f42fc538df0a0b8fd66600d1e2d41b9e4))
* **picker.grep:** added `ft` (rg's `type`) and `regex` (rg's `--fixed-strings`) options ([0437cfd](https://github.com/folke/snacks.nvim/commit/0437cfd98ea9767836685ef8f100b7a758239624))
* **picker.list:** added debug option to show scores ([821e231](https://github.com/folke/snacks.nvim/commit/821e23101fdfcc28819e27596177eaa64eebf0c2))
* **picker.list:** added select_all action mapped to ctrl+a ([c9e2695](https://github.com/folke/snacks.nvim/commit/c9e2695969687285fbf53c86336b75c4dae3b609))
* **picker.list:** better way of highlighting field patterns ([924a988](https://github.com/folke/snacks.nvim/commit/924a988d9af72bf1abba122fa9f02a4eb917f15a))
* **picker.list:** make `conceallevel` configurable. Fixes [#635](https://github.com/folke/snacks.nvim/issues/635) ([d88eab6](https://github.com/folke/snacks.nvim/commit/d88eab6e3fec20e162f52e618114b869f561e3fd))
* **picker.lsp:** added `lsp_workspace_symbols`. Supports live search. Closes [#473](https://github.com/folke/snacks.nvim/issues/473) ([348307a](https://github.com/folke/snacks.nvim/commit/348307a82e4ae139fcb02b4cd4ae95dbf46f32c7))
* **picker.matcher:** added opts.matcher.sort_empty and opts.matcher.filename_bonus ([ed91078](https://github.com/folke/snacks.nvim/commit/ed91078625996106ddd31dfb4bac634d2895f61f))
* **picker.matcher:** better scoring algorithm based on fzf. Closes [#512](https://github.com/folke/snacks.nvim/issues/512). Fixes [#513](https://github.com/folke/snacks.nvim/issues/513) ([e4e2e88](https://github.com/folke/snacks.nvim/commit/e4e2e88c769d54094194d6e3d68fbfae87b20cbe))
* **picker.matcher:** integrate custom item scores ([7267e24](https://github.com/folke/snacks.nvim/commit/7267e2493b5962a550d874f142aaf64c3873fb7e))
* **picker.matcher:** moved length tiebreak to sorter instead ([d5ccb30](https://github.com/folke/snacks.nvim/commit/d5ccb301c1fe2adb874dd8f4f675797d983a8284))
* **picker.recent:** include open files in recent files. Closes [#487](https://github.com/folke/snacks.nvim/issues/487) ([96ffaba](https://github.com/folke/snacks.nvim/commit/96ffaba71bed87cf8bf75c6d945dedae3fa40af2))
* **picker.score:** prioritize matches in filenames ([5cf5ec1](https://github.com/folke/snacks.nvim/commit/5cf5ec1a314b38d4e361f7f26cb6eb14febd4d69))
* **picker.smart:** better frecency bonus ([74feefc](https://github.com/folke/snacks.nvim/commit/74feefc52284e2ebf93ad815ec5aaeec918d4dc2))
* **picker.sort:** default sorter can now sort by len of a field ([6ae87d9](https://github.com/folke/snacks.nvim/commit/6ae87d9f62a17124db9283c789b1bd968a55a85a))
* **picker.sources:** lines just sorts by score/idx. Smart sorts on empty ([be42182](https://github.com/folke/snacks.nvim/commit/be421822d5498ad962481b134e6272defff9118e))
* **picker:** add qflist_all action to send all even when already selโฆ ([#600](https://github.com/folke/snacks.nvim/issues/600)) ([c7354d8](https://github.com/folke/snacks.nvim/commit/c7354d83486d60d0a965426fa920d341759b69c6))
* **picker:** add some source aliases like the Telescope / FzfLua names ([5a83a8e](https://github.com/folke/snacks.nvim/commit/5a83a8e32885d6b923319cb8dc5ff1d1d97d0b10))
* **picker:** added `{preview}` and `{flags}` title placeholders. Closes [#557](https://github.com/folke/snacks.nvim/issues/557), Closes [#540](https://github.com/folke/snacks.nvim/issues/540) ([2e70b7f](https://github.com/folke/snacks.nvim/commit/2e70b7f42364e50df25407ddbd897e157a44c526))
* **picker:** added `git_branches` picker. Closes [#614](https://github.com/folke/snacks.nvim/issues/614) ([8563dfc](https://github.com/folke/snacks.nvim/commit/8563dfce682eeb260fa17e554b3e02de47e61f35))
* **picker:** added `inspect` action mapped to `<c-i>`. Useful to see what search fields are available on an item. ([2ba165b](https://github.com/folke/snacks.nvim/commit/2ba165b826d31ab0ebeaaff26632efe7013042b6))
* **picker:** added `smart` picker ([772f3e9](https://github.com/folke/snacks.nvim/commit/772f3e9b8970123db4050e9f7a5bdf2270575c6c))
* **picker:** added exclude option for files and grep. Closes [#581](https://github.com/folke/snacks.nvim/issues/581) ([192fb31](https://github.com/folke/snacks.nvim/commit/192fb31c4beda9aa4ebbc8bad0abe59df8bdde85))
* **picker:** added jump options jumplist(true for all), reuse_win & tagstack (true for lsp). Closes [#589](https://github.com/folke/snacks.nvim/issues/589). Closes [#568](https://github.com/folke/snacks.nvim/issues/568) ([84c3738](https://github.com/folke/snacks.nvim/commit/84c3738fb04fff83aba8e91c3af8ad9e74b089fd))
* **picker:** added preliminary support for combining finder results. More info coming soon ([000db17](https://github.com/folke/snacks.nvim/commit/000db17bf9f8bd243bbe944c0ae7e162d8cad572))
* **picker:** added spelling picker. Closes [#625](https://github.com/folke/snacks.nvim/issues/625) ([b170ced](https://github.com/folke/snacks.nvim/commit/b170ced527c03911a4658fb2df7139fa7040bcef))
* **picker:** added support for live args for `grep` and `files`. Closes [#601](https://github.com/folke/snacks.nvim/issues/601) ([50f3c3e](https://github.com/folke/snacks.nvim/commit/50f3c3e5b1c52c223a2689b1b2828c1ddae9e866))
* **picker:** added toggle/flag/action for `follow`. Closes [#633](https://github.com/folke/snacks.nvim/issues/633) ([aa53f6c](https://github.com/folke/snacks.nvim/commit/aa53f6c0799f1f6b80f6fb46472ec4773763f6b8))
* **picker:** allow disabling file icons ([76fbf9e](https://github.com/folke/snacks.nvim/commit/76fbf9e8a85485abfe1c53d096c74faad3fa2a6b))
* **picker:** allow setting a custom `opts.title`. Fixes [#620](https://github.com/folke/snacks.nvim/issues/620) ([6001fb2](https://github.com/folke/snacks.nvim/commit/6001fb2077306655afefba6593ec8b55e18abc39))
* **picker:** custom icon for unselected entries ([#588](https://github.com/folke/snacks.nvim/issues/588)) ([6402687](https://github.com/folke/snacks.nvim/commit/64026877ad8dac658eb5056e0c56f66e17401bdb))
* **picker:** restore cursor / topline on resume ([ca54948](https://github.com/folke/snacks.nvim/commit/ca54948f79917113dfcdf1c4ccaec573244a02aa))
* **pickers.format:** added `opts.picker.formatters.file.filename_first` ([98562ae](https://github.com/folke/snacks.nvim/commit/98562ae6a112bf1d80a9bec7fb2849605234a9d5))
* **picker:** use an sqlite3 database for frecency data when available ([c43969d](https://github.com/folke/snacks.nvim/commit/c43969dabd42e261c570f533c2f343f99a9d1f01))
* **scroll:** faster animations for scroll repeats after delay. (replaces spamming handling) ([d494a9e](https://github.com/folke/snacks.nvim/commit/d494a9e66447e9ae22e40c374e2e7d9a24b64d93))
* **snacks:** added `snacks.picker` ([#445](https://github.com/folke/snacks.nvim/issues/445)) ([559d6c6](https://github.com/folke/snacks.nvim/commit/559d6c6bf207e4e768a88e7f727ac12a87c768b7))
* **toggle:** allow toggling global options. Fixes [#534](https://github.com/folke/snacks.nvim/issues/534) ([b50effc](https://github.com/folke/snacks.nvim/commit/b50effc96763f0b84473b68c733ef3eff8a14be5))
* **win:** warn on duplicate keymaps that differ in case. See [#554](https://github.com/folke/snacks.nvim/issues/554) ([a71b7c0](https://github.com/folke/snacks.nvim/commit/a71b7c0d26b578ad2b758ad74139b2ddecf8c15f))
### Bug Fixes
* **animate:** never animate stopped animations ([197b0a9](https://github.com/folke/snacks.nvim/commit/197b0a9be93a6fa49b840fe159ce6373c7edcf98))
* **bigfile:** check existence of NoMatchParen before executing ([#561](https://github.com/folke/snacks.nvim/issues/561)) ([9b8f57b](https://github.com/folke/snacks.nvim/commit/9b8f57b96f823b83848572bf3384754f8ab46217))
* **config:** better vim.tbl_deep_extend that prevents issues with list-like tables. Fixes [#554](https://github.com/folke/snacks.nvim/issues/554) ([75eb16f](https://github.com/folke/snacks.nvim/commit/75eb16fd9c746bbd5e21992b6eb986d389dd246e))
* **config:** dont exclude metatables ([2d4a0b5](https://github.com/folke/snacks.nvim/commit/2d4a0b594a69c535704c15fc41c74d18c5f4d08b))
* **grep:** explicitely set `--no-hidden` because of the git filter ([ae2de9a](https://github.com/folke/snacks.nvim/commit/ae2de9aa8101dbff1ee1ab101d53e916f6e217dd))
* **indent:** dont redraw when list/shiftwidth/listchars change. Triggered way too often. Fixes [#613](https://github.com/folke/snacks.nvim/issues/613). Closes [#627](https://github.com/folke/snacks.nvim/issues/627) ([d212e3c](https://github.com/folke/snacks.nvim/commit/d212e3c99090eec3211e84e526b9fbdd000e020c))
* **input:** bring back `<c-w>`. Fixes [#426](https://github.com/folke/snacks.nvim/issues/426). Closes [#429](https://github.com/folke/snacks.nvim/issues/429) ([5affa72](https://github.com/folke/snacks.nvim/commit/5affa7214f621144526b9a7d93b83302fa6ea6f4))
* **layout:** allow root with relative=cursor. Closes [#479](https://github.com/folke/snacks.nvim/issues/479) ([f06f14c](https://github.com/folke/snacks.nvim/commit/f06f14c4ae4d131eb5e15f4c49994f8debddff42))
* **layout:** don't trigger events during re-layout on resize. Fixes [#552](https://github.com/folke/snacks.nvim/issues/552) ([d73a4a6](https://github.com/folke/snacks.nvim/commit/d73a4a64dfd203b9f3a4a9dedd76af398faa6652))
* **layout:** open/update windows in order of the layout to make sure offsets are correct ([034d50d](https://github.com/folke/snacks.nvim/commit/034d50d44e98af433260292001a88ac54d2466b6))
* **layout:** use eventignore when updating windows that are already visible to fix issues with synatx. Fixes [#552](https://github.com/folke/snacks.nvim/issues/552) ([f7d967c](https://github.com/folke/snacks.nvim/commit/f7d967c5157ee621168153502812a266c509bd97))
* **lsp:** use treesitter highlights for LSP locations ([fc06a36](https://github.com/folke/snacks.nvim/commit/fc06a363b95312eba0f3335f1190c745d0e5ea26))
* **notifier:** content width. Fixes [#631](https://github.com/folke/snacks.nvim/issues/631) ([0e27737](https://github.com/folke/snacks.nvim/commit/0e277379ea7d25c97d109d31da33abacf26da841))
* **picker.actions:** added hack to make folds work. Fixes [#514](https://github.com/folke/snacks.nvim/issues/514) ([df1060f](https://github.com/folke/snacks.nvim/commit/df1060fa501d06758d588a341d5cdec650cbfc67))
* **picker.actions:** close existing empty buffer if it's the current buffer ([0745505](https://github.com/folke/snacks.nvim/commit/0745505f2f43d2983867f48805bd4f700ad06c73))
* **picker.actions:** full path for qflist and loclist actions ([3e39250](https://github.com/folke/snacks.nvim/commit/3e392507963f784a4d57708585f8e012f1b95768))
* **picker.actions:** only delete empty buffer if it's not displayed in a window. Fixes [#566](https://github.com/folke/snacks.nvim/issues/566) ([b7ab888](https://github.com/folke/snacks.nvim/commit/b7ab888dd0c5bb0bafe9d01209f6a63320621b11))
* **picker.actions:** return action result. Fixes [#612](https://github.com/folke/snacks.nvim/issues/612). See [#611](https://github.com/folke/snacks.nvim/issues/611) ([4a482be](https://github.com/folke/snacks.nvim/commit/4a482bea3c5cac7af66a7a3d5cee5f97fca6c9d8))
* **picker.colorscheme:** nil check. Fixes [#575](https://github.com/folke/snacks.nvim/issues/575) ([de01907](https://github.com/folke/snacks.nvim/commit/de01907930bb125d1b67b4a1fb372f21d972f70b))
* **picker.config:** allow merging list-like layouts with table layout options ([706b1ab](https://github.com/folke/snacks.nvim/commit/706b1abc1697ca050314dc667e0900d53cad8aa4))
* **picker.config:** better config merging and tests ([9986b47](https://github.com/folke/snacks.nvim/commit/9986b47707bbe76cf3b901c3048e55b2ba2bb4a8))
* **picker.config:** normalize keys before merging so you can override `<c-s>` with `<C-S>` ([afef949](https://github.com/folke/snacks.nvim/commit/afef949d88b6fa3dde8515b27066b132cfdb0a70))
* **picker.db:** remove tests ([71f69e5](https://github.com/folke/snacks.nvim/commit/71f69e5e57f355f40251e274d45560af7d8dd365))
* **picker.diagnostics:** sort on empty pattern. Fixes [#641](https://github.com/folke/snacks.nvim/issues/641) ([c6c76a6](https://github.com/folke/snacks.nvim/commit/c6c76a6aa338af47e2725cff35cc814fcd2ad1e7))
* **picker.files:** ignore errors since it's not possible to know if the error isbecause of an incomplete pattern. Fixes [#551](https://github.com/folke/snacks.nvim/issues/551) ([4823f2d](https://github.com/folke/snacks.nvim/commit/4823f2da65a5e11c10242af5e0d1c977474288b3))
* **picker.format:** filename ([a194bbc](https://github.com/folke/snacks.nvim/commit/a194bbc3747f73416ec2fd25cb39c233fcc7a656))
* **picker.format:** use forward slashes for paths. Closes [#624](https://github.com/folke/snacks.nvim/issues/624) ([5f82ffd](https://github.com/folke/snacks.nvim/commit/5f82ffde0befbcbfbedb9b5066bf4f3a5d667495))
* **picker.git:** git log file/line for a file not in cwd. Fixes [#616](https://github.com/folke/snacks.nvim/issues/616) ([9034319](https://github.com/folke/snacks.nvim/commit/903431903b0151f97f45087353ebe8fa1cb8ef80))
* **picker.git:** git_file and git_line should only show diffs including the file. Fixes [#522](https://github.com/folke/snacks.nvim/issues/522) ([1481a90](https://github.com/folke/snacks.nvim/commit/1481a90affedb24291997f5ebde0637cafc1d20e))
* **picker.git:** use Snacks.git.get_root instead vim.fs.root for backward compatibility ([a2fb70e](https://github.com/folke/snacks.nvim/commit/a2fb70e8ba2bb2ce5c60ed1ee7505d6f6d7be061))
* **picker.highlight:** properly deal with multiline treesitter captures ([27b72ec](https://github.com/folke/snacks.nvim/commit/27b72ecd005743ecf5855cd3b430fce74bd4f2e3))
* **picker.input:** don't set prompt interrupt, but use a `<c-c>` mapping instead that can be changed ([123f0d9](https://github.com/folke/snacks.nvim/commit/123f0d9e5d7be5b23ef9b28b9ddde403e4b2d061))
* **picker.input:** leave insert mode when closing and before executing confirm. Fixes [#543](https://github.com/folke/snacks.nvim/issues/543) ([05eb22c](https://github.com/folke/snacks.nvim/commit/05eb22c4fbe09f9bed53a752301d5c2a8a060a4e))
* **picker.input:** statuscolumn on resize / re-layout. Fixes [#643](https://github.com/folke/snacks.nvim/issues/643) ([4d8d844](https://github.com/folke/snacks.nvim/commit/4d8d844027a3ea04ac7ecb0ab6cd63e39e96d06f))
* **picker.input:** strip newllines from pattern (mainly due to pasting in the input box) ([c6a9955](https://github.com/folke/snacks.nvim/commit/c6a9955516b686d1b6bd815e1df0c808baa60bd3))
* **picker.input:** use `Snacks.util.wo` instead of `vim.wo`. Fixes [#643](https://github.com/folke/snacks.nvim/issues/643) ([d6284d5](https://github.com/folke/snacks.nvim/commit/d6284d51ff748f43c5431c35ffed7f7c02e51069))
* **picker.list:** disable folds ([5582a84](https://github.com/folke/snacks.nvim/commit/5582a84020a1e11d9001660252cdee6a424ba159))
* **picker.list:** include `search` filter for highlighting items (live search). See [#474](https://github.com/folke/snacks.nvim/issues/474) ([1693fbb](https://github.com/folke/snacks.nvim/commit/1693fbb0dcf1b82f2212a325379ebb0257d582e5))
* **picker.list:** newlines in text. Fixes [#607](https://github.com/folke/snacks.nvim/issues/607). Closes [#580](https://github.com/folke/snacks.nvim/issues/580) ([c45a940](https://github.com/folke/snacks.nvim/commit/c45a94044b8e4c9f5deb420a7caa505281e1eed5))
* **picker.list:** possible issue with window options being set in the wrong window ([f1b6c55](https://github.com/folke/snacks.nvim/commit/f1b6c55027c6e75940fcb40fa8ac5ab717de1647))
* **picker.list:** scores debug ([9499b94](https://github.com/folke/snacks.nvim/commit/9499b944e79ff305769a59819c44a93911023fc7))
* **picker.lsp:** added support for single location result ([79d27f1](https://github.com/folke/snacks.nvim/commit/79d27f19dc62c0978d2688c6fac9348f253ef007))
* **picker.matcher:** initialize matcher with pattern from opts. Fixes [#596](https://github.com/folke/snacks.nvim/issues/596) ([c434eb8](https://github.com/folke/snacks.nvim/commit/c434eb89fe030672f4e518b4de1e506ffaf0e96e))
* **picker.matcher:** inverse scores ([1816931](https://github.com/folke/snacks.nvim/commit/1816931aadb1fdcd3e08606d773d31f3d51fabcc))
* **picker.minheap:** clear sorted on minheap clear. Fixes [#492](https://github.com/folke/snacks.nvim/issues/492) ([79bea58](https://github.com/folke/snacks.nvim/commit/79bea58b1ec92909d763c8b5788baf8da6c19a06))
* **picker.preview:** don't show line numbers for preview commands ([a652214](https://github.com/folke/snacks.nvim/commit/a652214f52694233b5e27d374db0d51d2f7cb43d))
* **picker.preview:** pattern to detect binary files was incorrect ([bbd1a08](https://github.com/folke/snacks.nvim/commit/bbd1a0885b3e89103a8a59f1f07d296f23c7d2ad))
* **picker.preview:** scratch buffer filetype. Fixes [#595](https://github.com/folke/snacks.nvim/issues/595) ([ece76b3](https://github.com/folke/snacks.nvim/commit/ece76b333a9ff372959bf5204ab22f58215383c1))
* **picker.proc:** correct offset for carriage returns. Fixes [#599](https://github.com/folke/snacks.nvim/issues/599) ([a01e0f5](https://github.com/folke/snacks.nvim/commit/a01e0f536815a0cc23443fae5ac10f7fdcb4f313))
* **picker.qf:** better quickfix item list. Fixes [#562](https://github.com/folke/snacks.nvim/issues/562) ([cb84540](https://github.com/folke/snacks.nvim/commit/cb845408dbc795582ea1567fba2bf4ba64c777ac))
* **picker.select:** allow main to be current. Fixes [#497](https://github.com/folke/snacks.nvim/issues/497) ([076259d](https://github.com/folke/snacks.nvim/commit/076259d263c927ed1d1c56c94b6e870230e77a3d))
* **picker.util:** cleanup func for key-value store (frecency) ([bd2da45](https://github.com/folke/snacks.nvim/commit/bd2da45c384ea7ce44bdd15a7b5e32ee3806cf8d))
* **picker:** add alias for `oldfiles` ([46554a6](https://github.com/folke/snacks.nvim/commit/46554a63425c0594eacaa0e8eaddec5dbf79b48e))
* **picker:** add keymaps for preview scratch buffers ([dc3f114](https://github.com/folke/snacks.nvim/commit/dc3f114c1f787218e4314d907866874a62253756))
* **picker:** always stopinsert, even when picker is already closed. Should not be needed, but some plugins misbehave. See [#579](https://github.com/folke/snacks.nvim/issues/579) ([29becb0](https://github.com/folke/snacks.nvim/commit/29becb0ecbeb20683b3ae71d4c082734b2f518af))
* **picker:** better buffer edit. Fixes [#593](https://github.com/folke/snacks.nvim/issues/593) ([716492c](https://github.com/folke/snacks.nvim/commit/716492c57870e11e04a5764bcc1e549859f563be))
* **picker:** better normkey. Fixes [#610](https://github.com/folke/snacks.nvim/issues/610) ([540ecbd](https://github.com/folke/snacks.nvim/commit/540ecbd9a4b4c4d4ed47db83367f9e5d04220c27))
* **picker:** changed inspect mapping to `<a-d>` since not all terminal differentiate between `<a-i>` and `<tab>` ([8386540](https://github.com/folke/snacks.nvim/commit/8386540c422774059a75fe26ce7cfb6ab3811c73))
* **picker:** correctly normalize path after fnamemodify ([f351dcf](https://github.com/folke/snacks.nvim/commit/f351dcfcaca069d5f70bcf6edbde244e7358d063))
* **picker:** deepcopy before config merging. Fixes [#554](https://github.com/folke/snacks.nvim/issues/554) ([7865df0](https://github.com/folke/snacks.nvim/commit/7865df0558fa24cce9ec27c4e002d5e179cab685))
* **picker:** don't throttle preview if it's the first item we're previewing ([b785167](https://github.com/folke/snacks.nvim/commit/b785167814c5481643b53d241487fc9802a1ab13))
* **picker:** dont fast path matcher when finder items have scores ([2ba5602](https://github.com/folke/snacks.nvim/commit/2ba5602834830e1a96e4f1a81e0fbb310481ca74))
* **picker:** format: one too many spaces for default icon in results โฆ ([#594](https://github.com/folke/snacks.nvim/issues/594)) ([d7f727f](https://github.com/folke/snacks.nvim/commit/d7f727f673a67b60882a3d2a96db4d1490566e73))
* **picker:** picker:items() should return filtered items, not finder items. Closes [#481](https://github.com/folke/snacks.nvim/issues/481) ([d67e093](https://github.com/folke/snacks.nvim/commit/d67e093bbc2a2069c5e6118babf99c9029b34675))
* **picker:** potential issue with preview winhl being set on the main window ([34208eb](https://github.com/folke/snacks.nvim/commit/34208ebe00a237a232a6050f81fb89f25d473180))
* **picker:** preview / lsp / diagnostics positions were wrong; Should all be (1-0) indexed. Fixes [#543](https://github.com/folke/snacks.nvim/issues/543) ([40d08bd](https://github.com/folke/snacks.nvim/commit/40d08bd901db740f4b270fb6e9b710312a2846df))
* **picker:** properly handle `opts.layout` being a string. Fixes [#636](https://github.com/folke/snacks.nvim/issues/636) ([b80c9d2](https://github.com/folke/snacks.nvim/commit/b80c9d275d05778c90df32bd361c8630b28d13fd))
* **picker:** select_and_prev should use list_up instead of list_down ([#471](https://github.com/folke/snacks.nvim/issues/471)) ([b993be7](https://github.com/folke/snacks.nvim/commit/b993be762ba9aa9c1efd858ae777eef3de28c609))
* **picker:** set correct cwd for git status picker ([#505](https://github.com/folke/snacks.nvim/issues/505)) ([2cc7cf4](https://github.com/folke/snacks.nvim/commit/2cc7cf42e94041c08f5654935f745424d10a15b1))
* **picker:** show all files in git status ([#586](https://github.com/folke/snacks.nvim/issues/586)) ([43c312d](https://github.com/folke/snacks.nvim/commit/43c312dfc1433b3bdf24c7a14bc0aac648fa8d33))
* **scope:** make sure to parse the ts tree. Fixes [#521](https://github.com/folke/snacks.nvim/issues/521) ([4c55f1c](https://github.com/folke/snacks.nvim/commit/4c55f1c2da103e4c2776274cb0f6fab0318ea811))
* **scratch:** autowrite right buffer. Fixes [#449](https://github.com/folke/snacks.nvim/issues/449). ([#452](https://github.com/folke/snacks.nvim/issues/452)) ([8d2e26c](https://github.com/folke/snacks.nvim/commit/8d2e26cf27330ead517193f7eeb898d189a973c2))
* **scroll:** don't animate for new changedtick. Fixes [#384](https://github.com/folke/snacks.nvim/issues/384) ([ac8b3cd](https://github.com/folke/snacks.nvim/commit/ac8b3cdfa08c2bba065c95b512887d3bbea91807))
* **scroll:** don't animate when recording or executing macros ([7dcdcb0](https://github.com/folke/snacks.nvim/commit/7dcdcb0b6ab6ecb2c6efdbaa4769bc03f5837832))
* **statuscolumn:** return "" when no signs and no numbers are needed. Closes [#570](https://github.com/folke/snacks.nvim/issues/570). ([c4980ef](https://github.com/folke/snacks.nvim/commit/c4980ef9b4e678d4057ece6fd2c13637a395f3a0))
* **util:** normkey ([cd58a14](https://github.com/folke/snacks.nvim/commit/cd58a14e20fdcd810b55e8aee535486a3ad8719f))
* **win:** clear syntax when setting filetype ([c49f38c](https://github.com/folke/snacks.nvim/commit/c49f38c5a919400689ab11669d45331f210ea91c))
* **win:** correctly deal with initial text containing newlines. Fixes [#542](https://github.com/folke/snacks.nvim/issues/542) ([825c106](https://github.com/folke/snacks.nvim/commit/825c106f40352dc2979724643e0d36af3a962eb1))
* **win:** duplicate keymap should take mode into account. Closes [#559](https://github.com/folke/snacks.nvim/issues/559) ([097e68f](https://github.com/folke/snacks.nvim/commit/097e68fc720a8fcdb370e6ccd2a3acad40b98952))
* **win:** exclude cursor from redraw. Fixes [#613](https://github.com/folke/snacks.nvim/issues/613) ([ad9b382](https://github.com/folke/snacks.nvim/commit/ad9b382f7d0e150d2420cb65d44d6fb81a6b62c8))
* **win:** fix relative=cursor again ([5b1cd46](https://github.com/folke/snacks.nvim/commit/5b1cd464e8759156d4d69f0398a0f5b34fa0b743))
* **win:** relative=cursor. Closes [#427](https://github.com/folke/snacks.nvim/issues/427). Closes [#477](https://github.com/folke/snacks.nvim/issues/477) ([743f8b3](https://github.com/folke/snacks.nvim/commit/743f8b3fee780780d8e201960a4a295dc5187e9b))
* **win:** special handling of `<C-J>`. Closes [#565](https://github.com/folke/snacks.nvim/issues/565). Closes [#592](https://github.com/folke/snacks.nvim/issues/592) ([5ac80f0](https://github.com/folke/snacks.nvim/commit/5ac80f0159239e44448fa9b08d8462e93342192d))
* **win:** win position with border offsets. Closes [#413](https://github.com/folke/snacks.nvim/issues/413). Fixes [#423](https://github.com/folke/snacks.nvim/issues/423) ([ee08b1f](https://github.com/folke/snacks.nvim/commit/ee08b1f32e06904318f8fa24714557d3abcdd215))
* **words:** added support for new name of the namespace used for lsp references. Fixes [#555](https://github.com/folke/snacks.nvim/issues/555) ([566f302](https://github.com/folke/snacks.nvim/commit/566f3029035143c525c0df7f5e7bbf9b3e939f54))
### Performance Improvements
* **notifier:** skip processing during search. See [#627](https://github.com/folke/snacks.nvim/issues/627) ([cf5f56a](https://github.com/folke/snacks.nvim/commit/cf5f56a1d82f4ece762843334c744e5830f4b4ef))
* **picker.matcher:** fast path when we already found a perfect match ([6bbf50c](https://github.com/folke/snacks.nvim/commit/6bbf50c5e3a3ab3bfc6a6747f6a2c66cbc9b7548))
* **picker.matcher:** only use filename_bonus for items that have a file field ([fd854ab](https://github.com/folke/snacks.nvim/commit/fd854ab9efdd13cf9cda192838f967551f332e36))
* **picker.matcher:** yield every 1ms to prevent ui locking in large repos ([19979c8](https://github.com/folke/snacks.nvim/commit/19979c88f37930f71bd98b96e1afa50ae26a09ae))
* **picker.util:** cache path calculation ([7117356](https://github.com/folke/snacks.nvim/commit/7117356b49ceedd7185c43a732dfe10c6a60cdbc))
* **picker:** dont use prompt buffer callbacks ([8293add](https://github.com/folke/snacks.nvim/commit/8293add1e524f48aee1aacd68f72d4204096aed2))
* **picker:** matcher optims ([5295741](https://github.com/folke/snacks.nvim/commit/529574128783c0fc4a146b207ea532950f48732f))
## [2.12.0](https://github.com/folke/snacks.nvim/compare/v2.11.0...v2.12.0) (2025-01-05)
### Features
* **debug:** system & memory metrics useful for debugging ([cba16bd](https://github.com/folke/snacks.nvim/commit/cba16bdb35199c941c8d78b8fb9ddecf568c0b1f))
* **input:** disable completion engines in input ([37038df](https://github.com/folke/snacks.nvim/commit/37038df00d6b47a65de24266c25683ff5a781a40))
* **scope:** disable treesitter blocks by default ([8ec6e6a](https://github.com/folke/snacks.nvim/commit/8ec6e6adc5b098674c41005530d1c8af126480ae))
* **statuscolumn:** allow changing the marks hl group. Fixes [#390](https://github.com/folke/snacks.nvim/issues/390) ([8a6e5b9](https://github.com/folke/snacks.nvim/commit/8a6e5b9685bb8c596a179256b048043a51a64e09))
* **util:** `Snacks.util.ref` ([7383eda](https://github.com/folke/snacks.nvim/commit/7383edaec842609deac50b114a3567c2983b54f4))
* **util:** throttle ([737980d](https://github.com/folke/snacks.nvim/commit/737980d987cdb4d3c2b18e0b3b8613fde974a2e9))
* **win:** `Snacks.win:border_size` ([4cd0647](https://github.com/folke/snacks.nvim/commit/4cd0647eb5bda07431e125374c1419059783a741))
* **win:** `Snacks.win:redraw` ([0711a82](https://github.com/folke/snacks.nvim/commit/0711a82b7a77c0ab35251e28cf1a7be0b3bde6d4))
* **win:** `Snacks.win:scroll` ([a1da66e](https://github.com/folke/snacks.nvim/commit/a1da66e3bf2768273f1dfb556b29269fd8ba153d))
* **win:** allow setting `desc` for window actions ([402494b](https://github.com/folke/snacks.nvim/commit/402494bdee8800c8ac3eeceb8c5e78e00f72f265))
* **win:** better dimension calculation for windows (use by upcoming layouts) ([cc0b528](https://github.com/folke/snacks.nvim/commit/cc0b52872b99e3af7d80536e8a9cbc28d47e7f19))
* **win:** top,right,bottom,left borders ([320ecbc](https://github.com/folke/snacks.nvim/commit/320ecbc15c25a240fee2c2970f826259d809ed72))
### Bug Fixes
* **dashboard:** hash dashboard terminal section caching key to support long commands ([#381](https://github.com/folke/snacks.nvim/issues/381)) ([d312053](https://github.com/folke/snacks.nvim/commit/d312053f78b4fb55523def179ac502438dd93193))
* **debug:** make debug.inpect work in fast events ([b70edc2](https://github.com/folke/snacks.nvim/commit/b70edc29dbc8c9718af246a181b05d4d190ad260))
* **debug:** make sure debug can be required in fast events ([6cbdbb9](https://github.com/folke/snacks.nvim/commit/6cbdbb9afa748e84af4c35d17fc4737b18638a35))
* **indent:** allow rendering over blank lines. Fixes [#313](https://github.com/folke/snacks.nvim/issues/313) ([766e671](https://github.com/folke/snacks.nvim/commit/766e67145259e30ae7d63dfd6d51b8d8ef0840ae))
* **indent:** better way to deal with `breakindent`. Fixes [#329](https://github.com/folke/snacks.nvim/issues/329) ([235427a](https://github.com/folke/snacks.nvim/commit/235427abcbf3e2b251a8b75f0e409dfbb6c737d6))
* **indent:** breakdinent ([972c61c](https://github.com/folke/snacks.nvim/commit/972c61cc1cd254ef3b43ec1dfd51eefbdc441a7d))
* **indent:** correct calculation of partial indent when leftcol > 0 ([6f3cbf8](https://github.com/folke/snacks.nvim/commit/6f3cbf8ad328d181a694cdded344477e81cd094d))
* **indent:** do animate check in bufcall ([c62e7a2](https://github.com/folke/snacks.nvim/commit/c62e7a2561351c9fe3a8e7e9fc8602f3b61abf53))
* **indent:** don't render scopes in closed folds. Fixes [#352](https://github.com/folke/snacks.nvim/issues/352) ([94ec568](https://github.com/folke/snacks.nvim/commit/94ec5686a64218c9477de7761af4fd34dd4a665b))
* **indent:** off-by-one for indent guide hl group ([551e644](https://github.com/folke/snacks.nvim/commit/551e644ca311d065b3a6882db900846c1e66e636))
* **indent:** repeat_linbebreak only works on Neovim >= 0.10. Fixes [#353](https://github.com/folke/snacks.nvim/issues/353) ([b93201b](https://github.com/folke/snacks.nvim/commit/b93201bdf36bd62b07daf7d40bc305998f9da52c))
* **indent:** simplify indent guide logic and never overwrite blanks. Fixes [#334](https://github.com/folke/snacks.nvim/issues/334) ([282be8b](https://github.com/folke/snacks.nvim/commit/282be8bfa8e6f46d6994ff46638d1c155b90753f))
* **indent:** typo for underline ([66cce2f](https://github.com/folke/snacks.nvim/commit/66cce2f512e11a961a8f187eac802acbf8725d05))
* **indent:** use space instead of full blank for indent offset. See [#313](https://github.com/folke/snacks.nvim/issues/313) ([58081bc](https://github.com/folke/snacks.nvim/commit/58081bcecb31db8c6f12ad876c70786582a7f6a8))
* **input:** change buftype to prompt. Fixes [#350](https://github.com/folke/snacks.nvim/issues/350) ([2990bf0](https://github.com/folke/snacks.nvim/commit/2990bf0c7a79f5780a0268a47bae69ef004cec99))
* **input:** make sure to show input window with a higher zindex of the parent window (if float) ([3123e6e](https://github.com/folke/snacks.nvim/commit/3123e6e9882f178411ea6e9fbf5e9552134b82b0))
* **input:** refactor for win changes and ensure modified=false. Fixes [#403](https://github.com/folke/snacks.nvim/issues/403). Fixes [#402](https://github.com/folke/snacks.nvim/issues/402) ([8930630](https://github.com/folke/snacks.nvim/commit/89306308f357e12510683758c35d08f368db2b2c))
* **input:** use correct highlight group for input prompt ([#328](https://github.com/folke/snacks.nvim/issues/328)) ([818da33](https://github.com/folke/snacks.nvim/commit/818da334ac8f655235b5861bb50577921e4e6bd8))
* **lazygit:** enable boolean values in config ([#377](https://github.com/folke/snacks.nvim/issues/377)) ([ec34684](https://github.com/folke/snacks.nvim/commit/ec346843e0adb51b45e595dd0ef34bf9e64d4627))
* **notifier:** open history window with correct style ([#307](https://github.com/folke/snacks.nvim/issues/307)) ([d2b5680](https://github.com/folke/snacks.nvim/commit/d2b5680359ee8feb34b095fd574b4f9b3f013629))
* **notifier:** rename style `notification.history` -> `notification_history` ([fd9ef30](https://github.com/folke/snacks.nvim/commit/fd9ef30206185e3dd4d3294c74e2fd0dee9722d1))
* **scope:** allow treesitter scopes when treesitter highlighting is disabled. See [#231](https://github.com/folke/snacks.nvim/issues/231) ([58ae580](https://github.com/folke/snacks.nvim/commit/58ae580c2c12275755bb3e2003aebd06d550f2db))
* **scope:** don't expand to invalid range. Fixes [#339](https://github.com/folke/snacks.nvim/issues/339) ([1244305](https://github.com/folke/snacks.nvim/commit/1244305bedb8e60a946d949c78453263a714a4ad))
* **scope:** properly caluclate start indent when `cursor=true` for indent scopes. See [#5068](https://github.com/folke/snacks.nvim/issues/5068) ([e63fa7b](https://github.com/folke/snacks.nvim/commit/e63fa7bf05d22f4306c5fff594d48bc01e382238))
* **scope:** use virtcol for calculating scopes at the cursor ([6a36f32](https://github.com/folke/snacks.nvim/commit/6a36f32eaa7d5d59e681b7b8112a85a58a2d563d))
* **scroll:** check for invalid window. Fixes [#340](https://github.com/folke/snacks.nvim/issues/340) ([b6032e8](https://github.com/folke/snacks.nvim/commit/b6032e8f1b5cba55b5a2cf138ab4f172c4decfbd))
* **scroll:** don't animate when leaving cmdline search with incsearch enabled. Fixes [#331](https://github.com/folke/snacks.nvim/issues/331) ([fc0a99b](https://github.com/folke/snacks.nvim/commit/fc0a99b8493c34e6a930b3571ee8491e23831bca))
* **util:** throttle now autonatically schedules when in fast event ([9840331](https://github.com/folke/snacks.nvim/commit/98403313c749e26e5ae9a8ff51343c97f76ce170))
* **win:** backdrop having bright cell at top right ([#400](https://github.com/folke/snacks.nvim/issues/400)) ([373d0f9](https://github.com/folke/snacks.nvim/commit/373d0f9b6d6d83cdba641937b6303b0a0a18119f))
* **win:** don't enter when focusable is `false` ([ca233c7](https://github.com/folke/snacks.nvim/commit/ca233c7448c930658e8c7da9745e8d98884c3852))
* **win:** force-close any buffer that is not a file ([dd50e53](https://github.com/folke/snacks.nvim/commit/dd50e53a9efea11329e21c4a61ca35ae5122ceca))
* **win:** unset `winblend` when transparent ([0617e28](https://github.com/folke/snacks.nvim/commit/0617e28f8289002310fed5986acc29fde38e01b5))
* **words:** only check modes for `is_enabled` when needed ([80dcb88](https://github.com/folke/snacks.nvim/commit/80dcb88ede1a96f79edd3b7ede0bc41d51dd8a2d))
* **zen:** set zindex to 40, lower than hover (45). Closes [#345](https://github.com/folke/snacks.nvim/issues/345) ([05f4981](https://github.com/folke/snacks.nvim/commit/05f49814f3a2f3ecb83d9e72b7f8f2af40351aad))
## [2.11.0](https://github.com/folke/snacks.nvim/compare/v2.10.0...v2.11.0) (2024-12-15)
### Features
* **indent:** properly handle continuation indents. Closes [#286](https://github.com/folke/snacks.nvim/issues/286) ([f2bb7fa](https://github.com/folke/snacks.nvim/commit/f2bb7fa94e4b9b1fa7f84066bbedea8b3d9875e3))
* **input:** allow configuring position of prompt and icon ([d0cb707](https://github.com/folke/snacks.nvim/commit/d0cb7070e98d6a2ca31d94dd04d7048c9b258f33))
* **notifier:** notification `history` option ([#297](https://github.com/folke/snacks.nvim/issues/297)) ([8f56e19](https://github.com/folke/snacks.nvim/commit/8f56e19f916f8075e2bfb534d723e3d850e256a4))
* **scope:** `Scope:inner` for indent based and treesitter scopes ([8a8b1c9](https://github.com/folke/snacks.nvim/commit/8a8b1c976fc2736a3b91697750074fd3b23a24c9))
* **scope:** added `__tostring` for debugging ([94e0849](https://github.com/folke/snacks.nvim/commit/94e0849c3aae3b818cad2804c256c57318256c72))
* **scope:** added `opts.cursor` to take cursor column into account for scope detection. (defaults to true). Closes [#282](https://github.com/folke/snacks.nvim/issues/282) ([54bc6ba](https://github.com/folke/snacks.nvim/commit/54bc6bab2dbd07270c8c3fd447e8b72f825c315c))
* **scope:** text objects now use treesitter scopes by default. See [#231](https://github.com/folke/snacks.nvim/issues/231) ([a953697](https://github.com/folke/snacks.nvim/commit/a9536973a9111c3c7b66fb51bc5f62be27850884))
* **statuscolumn:** allow left/right to be a function. Closes [#288](https://github.com/folke/snacks.nvim/issues/288) ([cb42b95](https://github.com/folke/snacks.nvim/commit/cb42b952c5d4047f8e805c02c7aa596eb4e45ef2))
* **util:** on_key handler ([002d5eb](https://github.com/folke/snacks.nvim/commit/002d5eb5c2710a4e7456dd572543369e8424fd64))
* **win:** win:line() ([17494ad](https://github.com/folke/snacks.nvim/commit/17494ad9bf98e82c6a16f032cb3c9c82e072371a))
### Bug Fixes
* **dashboard:** telescope can't be run from a `vim.schedule` for some reason ([dcc5338](https://github.com/folke/snacks.nvim/commit/dcc5338e6f2a825b78791c96829d7e5a29e3ea5d))
* **indent:** `opts.indent.blank` now defaults to `listchars.space`. Closes [#291](https://github.com/folke/snacks.nvim/issues/291) ([31bc409](https://github.com/folke/snacks.nvim/commit/31bc409342b00d406963de3e1f38f3a2f84cfdcb))
* **indent:** fixup ([14d71c3](https://github.com/folke/snacks.nvim/commit/14d71c3fb2856634a8697f7c9f01704980e49bd0))
* **indent:** honor lead listchar ([#303](https://github.com/folke/snacks.nvim/issues/303)) ([7db0cc9](https://github.com/folke/snacks.nvim/commit/7db0cc9281b23c71155422433b6f485675674932))
* **indent:** honor listchars and list when blank is `nil`. Closes [#296](https://github.com/folke/snacks.nvim/issues/296) ([0e150f5](https://github.com/folke/snacks.nvim/commit/0e150f5510e381753ddd18f29facba14716d5669))
* **indent:** lower priorities of indent guides ([7f66818](https://github.com/folke/snacks.nvim/commit/7f668185ea810304cef5cb166a51665d4859124b))
* **input:** check if parent win still exists. Fixes [#287](https://github.com/folke/snacks.nvim/issues/287) ([db768a5](https://github.com/folke/snacks.nvim/commit/db768a5497301aad7fcddae2fe578cb320cc9ca2))
* **input:** go back to insert mode if input was started from insert mode. Fixes [#287](https://github.com/folke/snacks.nvim/issues/287) ([5d00e6d](https://github.com/folke/snacks.nvim/commit/5d00e6dec5686d7d2a6d97288287892d117d579b))
* **input:** missing padding if neither title nor icon positioned left ([#292](https://github.com/folke/snacks.nvim/issues/292)) ([97542a7](https://github.com/folke/snacks.nvim/commit/97542a7d9bfc7f242acbaa9851a62c649222fec8))
* **input:** open input window with `noautocmd=true` set. Fixes [#287](https://github.com/folke/snacks.nvim/issues/287) ([26b7d4c](https://github.com/folke/snacks.nvim/commit/26b7d4cbd9f803d9f759fc00d0dc4caa0141048b))
* **scope:** add `indent` to `__eq` ([be2779e](https://github.com/folke/snacks.nvim/commit/be2779e942bee0932e9c14ef4ed3e4002be861ce))
* **scope:** better treesitter scope edge detection ([b7355c1](https://github.com/folke/snacks.nvim/commit/b7355c16fb441e33be993ade74130464b62304cf))
* **scroll:** check mousescroll before spamming ([3d67bda](https://github.com/folke/snacks.nvim/commit/3d67bda1e29b8e8108dd74d611bf5c8b42883838))
* **util:** on_key compat with Neovim 0.9 ([effa885](https://github.com/folke/snacks.nvim/commit/effa885120670ca8a1775fc16ab2ec9e8040c288))
## [2.10.0](https://github.com/folke/snacks.nvim/compare/v2.9.0...v2.10.0) (2024-12-13)
### Features
* **animate:** add done to animation object ([ec73346](https://github.com/folke/snacks.nvim/commit/ec73346b7d4a25e440538141d5b8c68e42a1047d))
* **lazygit:** respect existing LG_CONFIG_FILE when setting config paths ([#208](https://github.com/folke/snacks.nvim/issues/208)) ([ef114c0](https://github.com/folke/snacks.nvim/commit/ef114c0efede3339221df5bc5b250aa9f8328b8d))
* **scroll:** added spamming detection and disable animations when user is spamming keys :) ([c58605f](https://github.com/folke/snacks.nvim/commit/c58605f8b3abf974e984ca5483cbe6ab9d2afc6e))
* **scroll:** improve smooth scrolling when user is spamming keys ([5532ba0](https://github.com/folke/snacks.nvim/commit/5532ba07be1306eb05c727a27368a8311bae3eeb))
* **zen:** added on_open / on_close callbacks ([5851de1](https://github.com/folke/snacks.nvim/commit/5851de157a08c96a0ca15580ced2ea53063fd65d))
* **zen:** make zen/zoom mode work for floating windows. Closes [#5028](https://github.com/folke/snacks.nvim/issues/5028) ([05bb957](https://github.com/folke/snacks.nvim/commit/05bb95739a362f8bec382f164f07c53137244627))
### Bug Fixes
* **dashboard:** set cursor to non-hidden actionable items. Fixes [#273](https://github.com/folke/snacks.nvim/issues/273) ([7c7b18f](https://github.com/folke/snacks.nvim/commit/7c7b18fdeeb7e228463b41d805cb47327f3d03f1))
* **indent:** fix rendering issues when `only_scope` is set for indent. Fixes [#268](https://github.com/folke/snacks.nvim/issues/268) ([370703d](https://github.com/folke/snacks.nvim/commit/370703da81a19db9d8bf41bb518e7b6959e53cea))
* **indent:** only render adjusted top/bottom. See [#268](https://github.com/folke/snacks.nvim/issues/268) ([54294cb](https://github.com/folke/snacks.nvim/commit/54294cba6a17ec048a63837fa341e6a663f3217d))
* **notifier:** set `modifiable=false` for notifier history ([12e68a3](https://github.com/folke/snacks.nvim/commit/12e68a33b5a1fd3648a7a558ef027fbb245125f7))
* **scope:** change from/to selection to make more sense ([e8dd394](https://github.com/folke/snacks.nvim/commit/e8dd394c01699276e8f7214957625222c30c8e9e))
* **scope:** possible loop? See [#278](https://github.com/folke/snacks.nvim/issues/278) ([ac6a748](https://github.com/folke/snacks.nvim/commit/ac6a74823b29cc1839df82fc839b81400ca80d45))
* **scratch:** normalize filename ([5200a8b](https://github.com/folke/snacks.nvim/commit/5200a8baa59a96e73786c11192282d2d3e10deeb))
* **scroll:** don't animate scroll distance 1 ([a986851](https://github.com/folke/snacks.nvim/commit/a986851a74512683c3331fa72a220751026fd611))
## [2.9.0](https://github.com/folke/snacks.nvim/compare/v2.8.0...v2.9.0) (2024-12-12)
### Features
* **animate:** allow disabling all animations globally or per buffer ([25c290d](https://github.com/folke/snacks.nvim/commit/25c290d7c093f0c57473ffcccf56780b6d58dd37))
* **animate:** allow toggling buffer-local / global animations with or without id ([50912dc](https://github.com/folke/snacks.nvim/commit/50912dc2fd926a49e3574d7029aed11fae3fb45b))
* **dashboard:** add dashboard startuptime icon option ([#214](https://github.com/folke/snacks.nvim/issues/214)) ([63506d5](https://github.com/folke/snacks.nvim/commit/63506d5168d2bb7679026cab80df1adfe3cd98b8))
* **indent:** animation styles `out`, `up_down`, `up`, `down` ([0a9b013](https://github.com/folke/snacks.nvim/commit/0a9b013ff13f6d1a550af2eac366c73d25e55e0a))
* **indent:** don't animate indents when new scope overlaps with the previous one, taking white-space into account. See [#264](https://github.com/folke/snacks.nvim/issues/264) ([9b4a859](https://github.com/folke/snacks.nvim/commit/9b4a85905aaa114e04a9371585953e96b3095f93))
* **indent:** move animate settings top-level, since they impact both scope and chunk ([baf8c18](https://github.com/folke/snacks.nvim/commit/baf8c180d9dda5797b4da538f7af122f4349f554))
* **toggle:** added zoom toggle ([3367705](https://github.com/folke/snacks.nvim/commit/336770581348c137bc2cb3967cc2af90b2ff51a2))
* **toggle:** return toggle after map ([4f22016](https://github.com/folke/snacks.nvim/commit/4f22016b4b765f3335ae7682fb5b3b79b414ecbd))
* **util:** get var either from buffer or global ([4243912](https://github.com/folke/snacks.nvim/commit/42439123c4fbc088fbe0bdd636a6bdc501794491))
### Bug Fixes
* **indent:** make sure cursor line is in scope for the `out` style. Fixes [#264](https://github.com/folke/snacks.nvim/issues/264) ([39c009f](https://github.com/folke/snacks.nvim/commit/39c009fe0b45243ccbbd372e659dcbd9409a68df))
* **indent:** when at edge of two blocks, prefer the one below. See [#231](https://github.com/folke/snacks.nvim/issues/231) ([2457d91](https://github.com/folke/snacks.nvim/commit/2457d913dc92835da12fc071b43bce3a03d31470))
## [2.8.0](https://github.com/folke/snacks.nvim/compare/v2.7.0...v2.8.0) (2024-12-11)
### Features
* **animate:** added animate plugin ([971229e](https://github.com/folke/snacks.nvim/commit/971229e8a93dab7dc73fe379110cdb47a7fd1387))
* **animate:** added animation context to callbacks ([1091280](https://github.com/folke/snacks.nvim/commit/109128087709fe5cba39e6983b8722b60cce8120))
* **dim:** added dim plugin ([4dda551](https://github.com/folke/snacks.nvim/commit/4dda5516e88a64c2b387727662d4ecd645582c55))
* **indent:** added indent plugin ([2c4021c](https://github.com/folke/snacks.nvim/commit/2c4021c4663ff4fe5da5b95c3e06a4f6eb416502))
* **indent:** allow disabling indent guides. See [#230](https://github.com/folke/snacks.nvim/issues/230) ([4a4ad63](https://github.com/folke/snacks.nvim/commit/4a4ad633dc9f864532716af4387b5e035d57768c))
* **indent:** allow disabling scope highlighting ([99207ee](https://github.com/folke/snacks.nvim/commit/99207ee44d3a2b4d14c915b08407bae708749235))
* **indent:** optional rendering of scopes as chunks. Closes [#230](https://github.com/folke/snacks.nvim/issues/230) ([109a0d2](https://github.com/folke/snacks.nvim/commit/109a0d207eeee49e13a6640131b44383e31d0b0f))
* **input:** added `input` snack ([70902ee](https://github.com/folke/snacks.nvim/commit/70902eee9e5aca7791450c6065dd51bed4651f24))
* **profiler:** on_close can now be a function ([48a5879](https://github.com/folke/snacks.nvim/commit/48a58792a0dd2e3c9249cfa4b1df73a8ea86a290))
* **scope:** added scope plugin ([63a279c](https://github.com/folke/snacks.nvim/commit/63a279c4e2e84ed02b5a2a6c2f84d68daf8f906a))
* **scope:** fill the range for treesitter scopes ([38ed01b](https://github.com/folke/snacks.nvim/commit/38ed01b5a229fc0c41b07dde08e9119de9ff1c4e))
* **scope:** text objects and jumping for scopes. Closes [#231](https://github.com/folke/snacks.nvim/issues/231) ([8faafb3](https://github.com/folke/snacks.nvim/commit/8faafb34831c48f3ff777d6bd0ced1c68c8ab82f))
* **scroll:** added smooth scrolling plugin ([38a5ccc](https://github.com/folke/snacks.nvim/commit/38a5ccc3a6436ba67fba71f6a2a9693ee1c2f142))
* **scroll:** allow disabling scroll globally or for some buffers ([04f15c1](https://github.com/folke/snacks.nvim/commit/04f15c1ba29afa6d1b085eb0d85a654c88be8fde))
* **scroll:** use `on_key` to track mouse scrolling ([26c3e49](https://github.com/folke/snacks.nvim/commit/26c3e4960f37320bcd418ec18f859b0e24d1e7d8))
* **scroll:** user virtual columns while scrolling ([fefa6fd](https://github.com/folke/snacks.nvim/commit/fefa6fd6920a2f8a6e717ae856c14e32d5d76ddb))
* **snacks:** zen mode ([c509ea5](https://github.com/folke/snacks.nvim/commit/c509ea52b7b3487e3d904d9f3d55d20ad136facb))
* **toggle:** add which-key mappings when which-key loads ([c9f494b](https://github.com/folke/snacks.nvim/commit/c9f494bd9a4729722186d2631ca91192ffc19b40))
* **toggle:** add zen mode toggle ([#243](https://github.com/folke/snacks.nvim/issues/243)) ([9454ba3](https://github.com/folke/snacks.nvim/commit/9454ba35f8c6ad3baeda4132fe1e5c96a5850960))
* **toggle:** added toggle for smooth scroll ([aeec09c](https://github.com/folke/snacks.nvim/commit/aeec09c5413c87df7ca827bd6b7c3fbf0f4d2909))
* **toggle:** toggles for new plugins ([bddae83](https://github.com/folke/snacks.nvim/commit/bddae83141d9e18b23a5d7a9ccc52c76ad736ca2))
* **util:** added Snacks.util.on_module to execute a callback when a module loads (or immediately when already loaded) ([f540b7b](https://github.com/folke/snacks.nvim/commit/f540b7b6cc10223adcbd6d9747155a076ddfa9a4))
* **util:** set_hl no longer sets default=true when not specified ([d6309c6](https://github.com/folke/snacks.nvim/commit/d6309c62b8e5910407449975b9e333c2699d06d0))
* **win:** added actions to easily combine actions in keymaps ([46362a5](https://github.com/folke/snacks.nvim/commit/46362a5a9c2583094bd0416dd6dea17996eaecf9))
* **win:** allow configuring initial text to display in the buffer ([003ea8d](https://github.com/folke/snacks.nvim/commit/003ea8d6edcf6d813bfdc143ffe4fa6cc55c0ea5))
* **win:** allow customizing backdrop window ([cdb495c](https://github.com/folke/snacks.nvim/commit/cdb495cb8f7b801d9d731cdfa2c6f92fadf1317d))
* **win:** col/row can be negative calculated on height/end of parent ([bd49d2f](https://github.com/folke/snacks.nvim/commit/bd49d2f32e567cbe42adf0bd8582b7829de6c1dc))
* **words:** added toggle for words ([bd7cf03](https://github.com/folke/snacks.nvim/commit/bd7cf038234a84b48d1c1f09dffae9e64910ff7e))
* **zen:** `zz` when entering zen mode ([b5cb90f](https://github.com/folke/snacks.nvim/commit/b5cb90f91dedaa692c4da1dfa216d13e58ad219d))
* **zen:** added zen plugin ([afb89ea](https://github.com/folke/snacks.nvim/commit/afb89ea159a20e1241656af5aa46f638327d2f5a))
* **zen:** added zoom indicator ([8459e2a](https://github.com/folke/snacks.nvim/commit/8459e2adc090aaf59865a60836c360744d82ed0a))
### Bug Fixes
* **compat:** fixes for Neovim < 0.10 ([33fbb30](https://github.com/folke/snacks.nvim/commit/33fbb309f8c21c8ec30b99fe323a5cc55c84c5bc))
* **dashboard:** add filetype to terminal sections ([#215](https://github.com/folke/snacks.nvim/issues/215)) ([9c68a54](https://github.com/folke/snacks.nvim/commit/9c68a54af652ff69348848dad62c4cd901da59a0))
* **dashboard:** don't open with startup option args ([#222](https://github.com/folke/snacks.nvim/issues/222)) ([6b78172](https://github.com/folke/snacks.nvim/commit/6b78172864ef94cd5f2ab184c0f98cf36f5a8e74))
* **dashboard:** override foldmethod ([47ad2a7](https://github.com/folke/snacks.nvim/commit/47ad2a7bfa49c3eb5c20083de82a39f59fb8f17a))
* **debug:** schedule wrap print ([3a107af](https://github.com/folke/snacks.nvim/commit/3a107afbf8dffabf6c2754750c51d740707b76af))
* **dim:** check if win still exist when animating. Closes [#259](https://github.com/folke/snacks.nvim/issues/259) ([69018d0](https://github.com/folke/snacks.nvim/commit/69018d070c9a0db76abc0f34539287e1c181a5d4))
* **health:** health checks ([72eba84](https://github.com/folke/snacks.nvim/commit/72eba841801928b00a1f1f74e1f976a31534a674))
* **indent:** always align indents with shiftwidth ([1de6c15](https://github.com/folke/snacks.nvim/commit/1de6c152883b576524201a465e1b8a09622a6041))
* **indent:** always render underline regardless of leftcol ([4e96e69](https://github.com/folke/snacks.nvim/commit/4e96e692e8a3c6c67f9c9b2971b6fa263461054b))
* **indent:** always use scope hl to render underlines. Fixes [#234](https://github.com/folke/snacks.nvim/issues/234) ([8723945](https://github.com/folke/snacks.nvim/commit/8723945183aac31671d1fa27481c90dc7c665c02))
* **indent:** better way of dealing with indents on blank lines. See [#246](https://github.com/folke/snacks.nvim/issues/246) ([c129683](https://github.com/folke/snacks.nvim/commit/c1296836f5c36e75b508aae9a76aa0931058feec))
* **indent:** expand scopes to inlude end_pos based on the end_pos scope. See [#231](https://github.com/folke/snacks.nvim/issues/231) ([897f801](https://github.com/folke/snacks.nvim/commit/897f8019248009eca191185cf7094e04c9371a85))
* **indent:** gradually increase scope when identical to visual selection for text objects ([bc7f96b](https://github.com/folke/snacks.nvim/commit/bc7f96bdee77368d4ddae2613823f085266529ab))
* **indent:** properly deal with empty lines when highlighting scopes. Fixes [#246](https://github.com/folke/snacks.nvim/issues/246). Fixes [#245](https://github.com/folke/snacks.nvim/issues/245) ([d04cf1d](https://github.com/folke/snacks.nvim/commit/d04cf1dc4f332bade99c300283380bf0893f1996))
* **indent:** set max_size=1 for textobjects and jumps by default. See [#231](https://github.com/folke/snacks.nvim/issues/231) ([5f217bc](https://github.com/folke/snacks.nvim/commit/5f217bca6adc88a5dc6aa55e5bf0580b95025a52))
* **indent:** set shiftwidth to tabstop when 0 ([782b6ee](https://github.com/folke/snacks.nvim/commit/782b6ee3fca35ede62b8dba866a9ad5c50edfdce))
* **indent:** underline. See [#234](https://github.com/folke/snacks.nvim/issues/234) ([51f9569](https://github.com/folke/snacks.nvim/commit/51f95693aedcde10e65c8121c6fd1293a3ac3819))
* **indent:** use correct config options ([5352198](https://github.com/folke/snacks.nvim/commit/5352198b5a59968c871b962fa15f1d7ca4eb7b52))
* **init:** enabled check ([519a45b](https://github.com/folke/snacks.nvim/commit/519a45bfe5df7fdf5aea0323e978e20eb52e15bc))
* **init:** set input disabled by default. Fixes [#227](https://github.com/folke/snacks.nvim/issues/227) ([e9d0993](https://github.com/folke/snacks.nvim/commit/e9d099322fca1bb7b35e781230e4a7478ded86bf))
* **input:** health check. Fixes [#239](https://github.com/folke/snacks.nvim/issues/239) ([acf743f](https://github.com/folke/snacks.nvim/commit/acf743fcfc4e0e42e1c9fe5c06f677849fa38e8b))
* **input:** set current win before executing callback. Fixes [#257](https://github.com/folke/snacks.nvim/issues/257) ([c17c1b2](https://github.com/folke/snacks.nvim/commit/c17c1b2f6c99f0ed4f3ab8f00bf32bb39f9d0186))
* **input:** set current win in `vim.schedule` so that it works properly from `expr` keymaps. Fixes [#257](https://github.com/folke/snacks.nvim/issues/257) ([8c2410c](https://github.com/folke/snacks.nvim/commit/8c2410c2de0a86c095177a831993f8eea78a63b6))
* **input:** update window position in the context of the parent window to make sure position=cursor works as expected. Fixes [#254](https://github.com/folke/snacks.nvim/issues/254) ([6c27ff2](https://github.com/folke/snacks.nvim/commit/6c27ff2a365c961831c7620365dd87fa8d8ad633))
* **input:** various minor visual fixes ([#252](https://github.com/folke/snacks.nvim/issues/252)) ([e01668c](https://github.com/folke/snacks.nvim/commit/e01668c36771c0c1424a2ce3ab26a09cbb43d472))
* **notifier:** toggle show history. Fixes [#197](https://github.com/folke/snacks.nvim/issues/197) ([8b58b55](https://github.com/folke/snacks.nvim/commit/8b58b55e40221ca5124f156f47e46185310fbe1c))
* **scope:** better edge detection for treesitter scopes ([6b02a09](https://github.com/folke/snacks.nvim/commit/6b02a09e5e81e4e38a42e0fcc2d7f0350404c228))
* **scope:** return `nil` when buffer is empty for indent scope ([4aa378a](https://github.com/folke/snacks.nvim/commit/4aa378a35e8f3d3771410344525cc4bc9ac50e8a))
* **scope:** take edges into account for min_size ([e2e6c86](https://github.com/folke/snacks.nvim/commit/e2e6c86d214029bfeae5d50929aee72f7059b7b7))
* **scope:** typo for textobject ([0324125](https://github.com/folke/snacks.nvim/commit/0324125ca1e5a5e6810d28ea81bb2c7c0af1dc16))
* **scroll:** better toggle ([3dcaad8](https://github.com/folke/snacks.nvim/commit/3dcaad8d0aacc1a736f75fee5719adbf80cbbfa2))
* **scroll:** disable scroll by default for terminals ([7b5a78a](https://github.com/folke/snacks.nvim/commit/7b5a78a5c76cdf2c73abbeef47ac14bb8ccbee72))
* **scroll:** don't animate invalid windows ([41ca13d](https://github.com/folke/snacks.nvim/commit/41ca13d119b328872ed1da9c8f458c5c24962d31))
* **scroll:** don't bother setting cursor when scrolloff is larger than half of viewport. Fixes [#240](https://github.com/folke/snacks.nvim/issues/240) ([0ca9ca7](https://github.com/folke/snacks.nvim/commit/0ca9ca79926b3bf473172eee7072fa2838509fba))
* **scroll:** move scrollbind check to M.check ([7211ec0](https://github.com/folke/snacks.nvim/commit/7211ec08ce01da754544f66e965effb13fd22fd3))
* **scroll:** only animate the current window when scrollbind is active ([c9880ce](https://github.com/folke/snacks.nvim/commit/c9880ce872ca000d17ae8d62b10e913045f54735))
* **scroll:** set cursor to correct position when target is reached. Fixes [#236](https://github.com/folke/snacks.nvim/issues/236) ([4209929](https://github.com/folke/snacks.nvim/commit/4209929e6d4f67d3d216d1ab5f52dc387c8e27c2))
* **scroll:** use actual scrolling to perform the scroll to properly deal with folds etc. Fixes [#236](https://github.com/folke/snacks.nvim/issues/236) ([280a09e](https://github.com/folke/snacks.nvim/commit/280a09e4eef08157eface8398295eb7fa3f9a08d))
* **win:** ensure win is set when relative=win ([5d472b8](https://github.com/folke/snacks.nvim/commit/5d472b833b7f925033fea164de0ab9e389e31bef))
* **words:** incorrect enabled check. Fixes [#247](https://github.com/folke/snacks.nvim/issues/247) ([9c8f3d5](https://github.com/folke/snacks.nvim/commit/9c8f3d531874ebd20eebe259f5c30cea575a1bba))
* **zen:** properly close existing zen window on toggle ([14da56e](https://github.com/folke/snacks.nvim/commit/14da56ee9791143ef2503816fb93f8bd2bf0b58d))
* **zen:** return after closing. Fixes [#259](https://github.com/folke/snacks.nvim/issues/259) ([b13eaf6](https://github.com/folke/snacks.nvim/commit/b13eaf6bd9089d8832c79f4088e72affc449c8ee))
* **zen:** when Normal is transparent, show an opaque transparent backdrop. Fixes [#235](https://github.com/folke/snacks.nvim/issues/235) ([d93de7a](https://github.com/folke/snacks.nvim/commit/d93de7af6916d2c734c9420624b8703236f386ff))
### Performance Improvements
* **animate:** check for animation easing updates ouside the main loop and schedule an update when needed ([03c0774](https://github.com/folke/snacks.nvim/commit/03c0774e8555a38267624309d4f00a30e351c4be))
* **input:** lazy-load `vim.ui.input` ([614df63](https://github.com/folke/snacks.nvim/commit/614df63acfb5ce9b1ac174ea4f09e545a086af4d))
* **util:** redraw helpers ([9fb88c6](https://github.com/folke/snacks.nvim/commit/9fb88c67b60cbd9d4a56f9aadcb9285929118518))
## [2.7.0](https://github.com/folke/snacks.nvim/compare/v2.6.0...v2.7.0) (2024-12-07)
### Features
* **bigfile:** disable matchparen, set foldmethod=manual, set conceallevel=0 ([891648a](https://github.com/folke/snacks.nvim/commit/891648a483b6f5410ec9c8b74890d5a00b50fa4c))
* **dashbard:** explude files from stdpath data/cache/state in recent files and projects ([b99bc64](https://github.com/folke/snacks.nvim/commit/b99bc64ef910cd075e4ab9cf0914e99e1a1d61c1))
* **dashboard:** allow items to be hidden, but still create the keymaps etc ([7a47eb7](https://github.com/folke/snacks.nvim/commit/7a47eb76df2fd36bfcf3ed5c4da871542e1386be))
* **dashboard:** allow terminal sections to have actions. Closes [#189](https://github.com/folke/snacks.nvim/issues/189) ([78f44f7](https://github.com/folke/snacks.nvim/commit/78f44f720b1b0609930581965f4f92649efae95b))
* **dashboard:** hide title if section has no items. Fixes [#184](https://github.com/folke/snacks.nvim/issues/184) ([d370be6](https://github.com/folke/snacks.nvim/commit/d370be6d6966a298725901abad4bec90264859af))
* **dashboard:** make buffer not listed ([#191](https://github.com/folke/snacks.nvim/issues/191)) ([42d6277](https://github.com/folke/snacks.nvim/commit/42d62775d82b7af4dbe001b04be6a8a6e461e8ec))
* **dashboard:** when a section has a title, use that for action and key. If not put it in the section. Fixes [#189](https://github.com/folke/snacks.nvim/issues/189) ([045a17d](https://github.com/folke/snacks.nvim/commit/045a17da069aae6221b2b3eae8610c2aa5ca03ea))
* **debug:** added `Snacks.debug.run()` to execute the buffer or selection with inlined print and errors ([e1fe4f5](https://github.com/folke/snacks.nvim/commit/e1fe4f5afed5c679fd2eed3486f17e8c0994b982))
* **gitbrowse:** added `line_count`. See [#186](https://github.com/folke/snacks.nvim/issues/186) ([f03727c](https://github.com/folke/snacks.nvim/commit/f03727c77f739503fd297dd12a826c2aca3490f9))
* **gitbrowse:** opts.notify ([a856952](https://github.com/folke/snacks.nvim/commit/a856952ab24757f4eaf4ae2e1728d097f1866681))
* **gitbrowse:** url pattern can now also be a function ([0a48c2e](https://github.com/folke/snacks.nvim/commit/0a48c2e726e6ca90370260a05618f45345dbb66a))
* **notifier:** reverse notif history by default for `show_history` ([5a50738](https://github.com/folke/snacks.nvim/commit/5a50738b8e952519658570f31ff5f24e06882f18))
* **scratch:** `opts.ft` can now be a function and defaults to the ft of the current buffer or markdown ([652303e](https://github.com/folke/snacks.nvim/commit/652303e6de5fa746709979425f4bed763e3fcbfa))
* **scratch:** change keymap to execute buffer/selection to `<cr>` ([7db0ed4](https://github.com/folke/snacks.nvim/commit/7db0ed4239a2f67c0ca288aaac21bc6aa65212a7))
* **scratch:** use `Snacks.debug.run()` to execute buffer/selection ([32c46b4](https://github.com/folke/snacks.nvim/commit/32c46b4e2f61c026e41b3fa128d01b0e89da106c))
* **snacks:** added `Snacks.profiler` ([8088799](https://github.com/folke/snacks.nvim/commit/808879951f960399844c89efef9aec1724f83402))
* **snacks:** added new `scratch` snack ([1cec695](https://github.com/folke/snacks.nvim/commit/1cec695fefb6e42ee644cfaf282612c213009aed))
* **toggle:** toggles for the profiler ([999ae07](https://github.com/folke/snacks.nvim/commit/999ae07808858df08d30eb099a8dbce401527008))
* **util:** encode/decode a string to be used as a filename ([e6f6397](https://github.com/folke/snacks.nvim/commit/e6f63970de2225ad44ed08af7ffd8a0f37d8fc58))
* **util:** simple function to get an icon ([7c29848](https://github.com/folke/snacks.nvim/commit/7c29848e89861b40e751cc15c557cf1e574acf66))
* **win:** added `opts.fixbuf` to configure fixed window buffers ([1f74d1c](https://github.com/folke/snacks.nvim/commit/1f74d1ce77d2015e2802027c93b9e0bcd548e4d1))
* **win:** backdrop can now be made opaque ([681b9c9](https://github.com/folke/snacks.nvim/commit/681b9c9d650e7b01a5e54567656f646fbd3b8d46))
* **win:** width/height can now be a function ([964d7ae](https://github.com/folke/snacks.nvim/commit/964d7ae99af1f45949175e1494562a796e2ef99b))
### Bug Fixes
* **dashboard:** calculate proper offset when item has no text ([6e3b954](https://github.com/folke/snacks.nvim/commit/6e3b9546de4871a696652cfcee6768c39e7b8ee9))
* **dashboard:** prevent possible duplicate recent files. Fixes [#171](https://github.com/folke/snacks.nvim/issues/171) ([93b254d](https://github.com/folke/snacks.nvim/commit/93b254d65845aa44ad1e01000c26e1faf5efb9a6))
* **dashboard:** take hidden items into account when calculating padding. Fixes [#194](https://github.com/folke/snacks.nvim/issues/194) ([736ce44](https://github.com/folke/snacks.nvim/commit/736ce447e8815eb231271abf7d49d8fa7d96e225))
* **dashboard:** take indent into account when calculating terminal width ([cda695e](https://github.com/folke/snacks.nvim/commit/cda695e53ffb34c7569dc3536134c9e432b2a1c1))
* **dashboard:** truncate file names when too long. Fixes [#183](https://github.com/folke/snacks.nvim/issues/183) ([4bdf7da](https://github.com/folke/snacks.nvim/commit/4bdf7daece384ab8a5472e6effd5fd6167a5ce6a))
* **debug:** better way of getting visual selection. See [#190](https://github.com/folke/snacks.nvim/issues/190) ([af41cb0](https://github.com/folke/snacks.nvim/commit/af41cb088d3ff8da9dede9fbdd5c81860bc37e64))
* **gitbrowse:** opts.notify ([2436557](https://github.com/folke/snacks.nvim/commit/243655796e4adddf58ce581f1b86a283130ecf41))
* **gitbrowse:** removed debug ([f894952](https://github.com/folke/snacks.nvim/commit/f8949523ed3f27f976e5346051a6658957d9492a))
* **gitbrowse:** use line_start and line_end directly in patterns. Closes [#186](https://github.com/folke/snacks.nvim/issues/186) ([adf0433](https://github.com/folke/snacks.nvim/commit/adf0433e8fca3fbc7287ac7b05f01f10ac354283))
* **profiler:** startup opts ([85f5132](https://github.com/folke/snacks.nvim/commit/85f51320b2662830a6435563668a04ab21686178))
* **scratch:** always set filetype on the buffer. Fixes [#179](https://github.com/folke/snacks.nvim/issues/179) ([6db50cf](https://github.com/folke/snacks.nvim/commit/6db50cfe2d1b333512e8175d072a2f82e796433d))
* **scratch:** floating window title/footer hl groups ([6c25ab1](https://github.com/folke/snacks.nvim/commit/6c25ab1108d12ef3642e97e3757710e69782cbd1))
* **scratch:** make sure win.opts.keys exists. See [#190](https://github.com/folke/snacks.nvim/issues/190) ([50bd510](https://github.com/folke/snacks.nvim/commit/50bd5103ba0a15294b1a931fda14900e7fd10161))
* **scratch:** sort keys. Fixes [#193](https://github.com/folke/snacks.nvim/issues/193) ([0df7a08](https://github.com/folke/snacks.nvim/commit/0df7a08b01b037e434efe7cd25e7d4608a282a92))
* **scratch:** weirdness with visual selection and inclusive/exclusive. See [#190](https://github.com/folke/snacks.nvim/issues/190) ([f955f08](https://github.com/folke/snacks.nvim/commit/f955f082e09683d02df3fd0f8b621b938f38e6aa))
* **statuscolumn:** add virtnum and relnum to cache key. See [#198](https://github.com/folke/snacks.nvim/issues/198) ([3647ca7](https://github.com/folke/snacks.nvim/commit/3647ca7d8a47362a01b539f5b6efc2d5339b5e8e))
* **statuscolumn:** don't show signs on virtual ligns. See [#198](https://github.com/folke/snacks.nvim/issues/198) ([f5fb59c](https://github.com/folke/snacks.nvim/commit/f5fb59cc4c62e25745bbefd2ef55665a67196245))
* **util:** better support for nvim-web-devicons ([ddaa2aa](https://github.com/folke/snacks.nvim/commit/ddaa2aaba59bbd05c03992bfb295c98ccd3b3e50))
* **util:** make sure to always return an icon ([ca7188c](https://github.com/folke/snacks.nvim/commit/ca7188c531350fe313c211ad60a59d642749f93e))
* **win:** allow resolving nil window option values. Fixes [#179](https://github.com/folke/snacks.nvim/issues/179) ([0043fa9](https://github.com/folke/snacks.nvim/commit/0043fa9ee142b63ab653507f2e6f45395e8a23d5))
* **win:** don't force close modified buffers ([d517b11](https://github.com/folke/snacks.nvim/commit/d517b11cabf94bf833d020c7a0781122d0f48c06))
* **win:** update opts.wo for padding instead of vim.wo directly ([446f502](https://github.com/folke/snacks.nvim/commit/446f50208fe823787ce60a8b216a622a4b6b63dd))
* **win:** update window local options when the buffer changes ([630d96c](https://github.com/folke/snacks.nvim/commit/630d96cf1f0403352580f2d119fc3b3ba29e33a4))
### Performance Improvements
* **dashboard:** properly cleanup autocmds ([8e6d977](https://github.com/folke/snacks.nvim/commit/8e6d977ec985a1b3f12a53741df82881a7835f9a))
* **statuscolumn:** optimize caching ([d972bc0](https://github.com/folke/snacks.nvim/commit/d972bc0a471fbf3067a115924a4add852d15f5f0))
## [2.6.0](https://github.com/folke/snacks.nvim/compare/v2.5.0...v2.6.0) (2024-11-29)
### Features
* **config:** allow overriding resolved options for a plugin. See [#164](https://github.com/folke/snacks.nvim/issues/164) ([d730a13](https://github.com/folke/snacks.nvim/commit/d730a13b5519fa901114cbdd0b2d484067068cce))
* **config:** make it easier to use examples in your config ([6e3cb7e](https://github.com/folke/snacks.nvim/commit/6e3cb7e53c0a1b314203d392dc1b7df8207a31a6))
* **dashboard:** allow passing win=0, buf=0 to use for the dashboard instead of creating a new window ([417e07c](https://github.com/folke/snacks.nvim/commit/417e07c0d22173a0a50ed8207e913ba25b96088e))
* **dashboard:** always render cache even when expired. Then refresh when needed. ([59f8f0d](https://github.com/folke/snacks.nvim/commit/59f8f0db99e7a2d4f6a181f02f3fe77355c016c8))
* **gitbrowse:** add Bitbucket URL patterns ([#163](https://github.com/folke/snacks.nvim/issues/163)) ([53441c9](https://github.com/folke/snacks.nvim/commit/53441c97030dbc15b4a22d56e33054749a13750f))
* **gitbrowse:** open commit when word is valid hash ([#161](https://github.com/folke/snacks.nvim/issues/161)) ([59c8eb3](https://github.com/folke/snacks.nvim/commit/59c8eb36ae6933dd54d87811fec22decfe4f303c))
* **health:** check that snacks.nvim plugin spec is correctly setup ([2c7b4b7](https://github.com/folke/snacks.nvim/commit/2c7b4b7971c8b488cfc9949f402f6c0307e24fce))
* **notifier:** added history opts.reverse ([bebd7e7](https://github.com/folke/snacks.nvim/commit/bebd7e70cdd336dcc582227c2f3bd6ea0cef60d9))
* **win:** go back to the previous window, when closing a snacks window ([51996df](https://github.com/folke/snacks.nvim/commit/51996dfeac5f0936aa1196e90b28760eb028ac1a))
### Bug Fixes
* **config:** check correct var for single config result. Fixes [#167](https://github.com/folke/snacks.nvim/issues/167) ([45fd0ef](https://github.com/folke/snacks.nvim/commit/45fd0efe41a453f1fa54a0892d352b931d6f88bb))
* **dashboard:** fixed mini.sessions.read. Fixes [#144](https://github.com/folke/snacks.nvim/issues/144) ([4e04b70](https://github.com/folke/snacks.nvim/commit/4e04b70ea3f6f91ae47e0fc7671e53e801171290))
* **dashboard:** terminal commands get 5 seconds to complete to trigger caching ([f83a7b0](https://github.com/folke/snacks.nvim/commit/f83a7b0ffb13adfae55a464f4d99fe3d4b578fe6))
* **git:** make git.get_root work for work-trees and cache git root checks. Closes [#136](https://github.com/folke/snacks.nvim/issues/136). Fixes [#115](https://github.com/folke/snacks.nvim/issues/115) ([9462273](https://github.com/folke/snacks.nvim/commit/9462273bf7c0e627da0f412c02daee907947078d))
* **init:** use rawget when loading modules to prevent possible recursive loading with invalid module fields ([d0794dc](https://github.com/folke/snacks.nvim/commit/d0794dcf8e988cf70c8db705a6e65867ba3b6e30))
* **notifier:** always show notifs directly when blocking ([0c7f7c5](https://github.com/folke/snacks.nvim/commit/0c7f7c5970d204d62488a4e351f1f1514a2a42e5))
* **notifier:** gracefully handle E565 errors ([0bbc9e7](https://github.com/folke/snacks.nvim/commit/0bbc9e7ae65820bc5ee356e1321656a7106d409a))
* **statuscolumn:** bad copy/paste!! Fixes [#152](https://github.com/folke/snacks.nvim/issues/152) ([7564a30](https://github.com/folke/snacks.nvim/commit/7564a30cad803c01f8ecc15683a280d2f0e9bdb7))
* **statuscolumn:** never error (in case of E565 for example). Fixes [#150](https://github.com/folke/snacks.nvim/issues/150) ([cf84008](https://github.com/folke/snacks.nvim/commit/cf840087c5adf1c076b61fdd044ac960b31e4e1e))
* **win:** handle E565 errors on close ([0b02044](https://github.com/folke/snacks.nvim/commit/0b020449ad8496c6bfd34e10bc69f807b52970f8))
### Performance Improvements
* **statuscolumn:** some small optims ([985be4a](https://github.com/folke/snacks.nvim/commit/985be4a759f6fe83e569679da431eeb7d2db5286))
## [2.5.0](https://github.com/folke/snacks.nvim/compare/v2.4.0...v2.5.0) (2024-11-22)
### Features
* **dashboard:** added Snacks.dashboard.update(). Closes [#121](https://github.com/folke/snacks.nvim/issues/121) ([c770ebe](https://github.com/folke/snacks.nvim/commit/c770ebeaf7b19abad8a447ef55b48cec71e7db54))
* **debug:** profile title ([0177079](https://github.com/folke/snacks.nvim/commit/017707955f465335900c4fd483c32df018fd3427))
* **notifier:** show indicator when notif has more lines. Closes [#112](https://github.com/folke/snacks.nvim/issues/112) ([cf72c06](https://github.com/folke/snacks.nvim/commit/cf72c06ee61f3102bf828ee7e8dde20316310374))
* **terminal:** added Snacks.terminal.get(). Closes [#122](https://github.com/folke/snacks.nvim/issues/122) ([7f63d4f](https://github.com/folke/snacks.nvim/commit/7f63d4fefb7ba22f6e98986f7adeb04f9f9369b1))
* **util:** get hl color ([b0da066](https://github.com/folke/snacks.nvim/commit/b0da066536493b6ed977744e4ee91fac01fcc2a8))
* **util:** set_hl managed ([9642695](https://github.com/folke/snacks.nvim/commit/96426953a029b12d02ad45849e086c1ee14e065b))
### Bug Fixes
* **dashboard:** `vim.pesc` for auto keys. Fixes [#134](https://github.com/folke/snacks.nvim/issues/134) ([aebffe5](https://github.com/folke/snacks.nvim/commit/aebffe535b09237b28d2c61bb3febab12bc95ae8))
* **dashboard:** align should always set width even if no alignment is needed. Fixes [#137](https://github.com/folke/snacks.nvim/issues/137) ([54d521c](https://github.com/folke/snacks.nvim/commit/54d521cd0fde5e3ccf36716f23371707d0267768))
* **dashboard:** better git check for advanced example. See [#126](https://github.com/folke/snacks.nvim/issues/126) ([b4a293a](https://github.com/folke/snacks.nvim/commit/b4a293aac747fbde7aafa72242a2d26dc17e325d))
* **dashboard:** open fullscreen on relaunch ([853240b](https://github.com/folke/snacks.nvim/commit/853240bb207ed7a2366c6c63ffc38f3b26fd484f))
* **dashboard:** randomseed needs argument on stable ([c359164](https://github.com/folke/snacks.nvim/commit/c359164872e82646e11c652fb0fbe723e58bfdd8))
* **debug:** include `main` in caller ([33d31af](https://github.com/folke/snacks.nvim/commit/33d31af1501ec154dba6008064d17ab72ec37d00))
* **git:** get_root should work for non file buffers ([723d8ea](https://github.com/folke/snacks.nvim/commit/723d8eac849749e9015d9e9598f99974684ca3bb))
* **notifier:** hide existing nofif if higher prio notif arrives and no free space for lower notif ([7a061de](https://github.com/folke/snacks.nvim/commit/7a061de75f758db23cf2c2ee0822a76356b54035))
* **quickfile:** don't load when bigfile detected. Fixes [#116](https://github.com/folke/snacks.nvim/issues/116) ([978424c](https://github.com/folke/snacks.nvim/commit/978424ce280ec85e78e9660b200aee9aa12e9ef2))
* **sessions:** change persisted.nvim load session command ([#118](https://github.com/folke/snacks.nvim/issues/118)) ([26bec4b](https://github.com/folke/snacks.nvim/commit/26bec4b51d617cd275218e9935fdff5390c18a87))
* **terminal:** hide on `q` instead of close ([30a0721](https://github.com/folke/snacks.nvim/commit/30a0721d56993a7125a247a07116f1a07e0efda4))
## [2.4.0](https://github.com/folke/snacks.nvim/compare/v2.3.0...v2.4.0) (2024-11-19)
### Features
* **dashboard:** hide tabline and statusline when loading during startup ([75dc74c](https://github.com/folke/snacks.nvim/commit/75dc74c5dc933b81cde85e8bc368a384343af69f))
* **dashboard:** when an item is wider than pane width and only one pane, then center it. See [#108](https://github.com/folke/snacks.nvim/issues/108) ([c15953e](https://github.com/folke/snacks.nvim/commit/c15953ee885cf8afb40dcd478569d7de2edae939))
* **gitbrowse:** open also visual selection range ([#89](https://github.com/folke/snacks.nvim/issues/89)) ([c29c0d4](https://github.com/folke/snacks.nvim/commit/c29c0d48500cb976c9210bb2d42909ad203cd4aa))
* **win:** detect alien buffers opening in managed windows and open them somewhere else. Fixes [#110](https://github.com/folke/snacks.nvim/issues/110) ([9c0d2e2](https://github.com/folke/snacks.nvim/commit/9c0d2e2e93615e70627e5c09c7bbb04e93eab2c6))
### Bug Fixes
* **dashboard:** always hide cursor ([68fcc25](https://github.com/folke/snacks.nvim/commit/68fcc258023404a0a0341a7cc93db47cd17f85f4))
* **dashboard:** check session managers in order ([1acea8b](https://github.com/folke/snacks.nvim/commit/1acea8b94005620dad70dfde6a6344c130a57c59))
* **dashboard:** fix race condition when sending data while closing ([4188446](https://github.com/folke/snacks.nvim/commit/4188446f86b5c6abae090eb6abca65d5d9bb8003))
* **dashboard:** minimum one pane even when it doesn't fit the screen. Fixes [#104](https://github.com/folke/snacks.nvim/issues/104) ([be8feef](https://github.com/folke/snacks.nvim/commit/be8feef4ab584f50aaa96b69d50b3f86a35aacff))
* **dashboard:** only check for piped stdin when in TUI. Ignore GUIs ([3311d75](https://github.com/folke/snacks.nvim/commit/3311d75f893191772a1b9525b18b94d8c3a8943a))
* **dashboard:** remove weird preset.keys function override. Just copy defaults if you want to change them ([0b9e09c](https://github.com/folke/snacks.nvim/commit/0b9e09cbd97c178ebe5db78fd373448448c5511b))
## [2.3.0](https://github.com/folke/snacks.nvim/compare/v2.2.0...v2.3.0) (2024-11-18)
### Features
* added dashboard health checks ([deb00d0](https://github.com/folke/snacks.nvim/commit/deb00d0ddc57d77f5f6c3e5510ba7c2f07e593eb))
* **dashboard:** added support for mini.sessions ([c8e209e](https://github.com/folke/snacks.nvim/commit/c8e209e6be9e8d8cdee19842a99ae7b89ac4248d))
* **dashboard:** allow opts.preset.keys to be a function with default keymaps as arg ([b7775ec](https://github.com/folke/snacks.nvim/commit/b7775ec879e14362d8e4082b7ed97a752bbb654a))
* **dashboard:** automatically detect streaming commands and don't cache those. tty-clock, cmatrix galore. Fixes [#100](https://github.com/folke/snacks.nvim/issues/100) ([082beb5](https://github.com/folke/snacks.nvim/commit/082beb508ccf3584aebfee845c1271d9f8b8abb6))
* **notifier:** timeout=0 keeps the notif visible till manually hidden. Closes [#102](https://github.com/folke/snacks.nvim/issues/102) ([0cf22a8](https://github.com/folke/snacks.nvim/commit/0cf22a8d87f28759c083969d67b55498e568a1b7))
### Bug Fixes
* **dashboard:** check uis for headless and stdin_tty. Fixes [#97](https://github.com/folke/snacks.nvim/issues/97). Fixes [#98](https://github.com/folke/snacks.nvim/issues/98) ([4ff08f1](https://github.com/folke/snacks.nvim/commit/4ff08f1c4d7b7b5d3e1da3b2cc9d6c341cd4dc1a))
* **dashboard:** debug output ([c0129da](https://github.com/folke/snacks.nvim/commit/c0129da4f839fd4306627b087cb722ea54c50c18))
* **dashboard:** disable `vim.wo.colorcolumn` ([#101](https://github.com/folke/snacks.nvim/issues/101)) ([43b4abb](https://github.com/folke/snacks.nvim/commit/43b4abb9f11a07d7130b461f9bd96b3e4e3c5b94))
* **dashboard:** notify on errors. Fixes [#99](https://github.com/folke/snacks.nvim/issues/99) ([2ae4108](https://github.com/folke/snacks.nvim/commit/2ae410889cbe6f59fb52f40cb86b25d6f7e874e2))
* **debug:** MYVIMRC is not always set ([735f4d8](https://github.com/folke/snacks.nvim/commit/735f4d8c9de6fcff31bce671495569f345818ea0))
* **notifier:** also handle timeout = false / timeout = true. See [#102](https://github.com/folke/snacks.nvim/issues/102) ([99f1f49](https://github.com/folke/snacks.nvim/commit/99f1f49104d413dabee9ee45bc22366aee97056e))
## [2.2.0](https://github.com/folke/snacks.nvim/compare/v2.1.0...v2.2.0) (2024-11-18)
### Features
* **dashboard:** added new `dashboard` snack ([#77](https://github.com/folke/snacks.nvim/issues/77)) ([d540fa6](https://github.com/folke/snacks.nvim/commit/d540fa607c415b55f5a0d773f561c19cd6287de4))
* **debug:** Snacks.debug.trace and Snacks.debug.stats for hierarchical traces (like lazy profile) ([b593598](https://github.com/folke/snacks.nvim/commit/b593598859b1bb3946671fc78ee1896d32460552))
* **notifier:** global keep when in cmdline ([73b1e20](https://github.com/folke/snacks.nvim/commit/73b1e20d38d4d238316ed391faf3d7ad4c3e71be))
## [2.1.0](https://github.com/folke/snacks.nvim/compare/v2.0.0...v2.1.0) (2024-11-16)
### Features
* **notifier:** allow specifying a minimal level to show notifications. See [#82](https://github.com/folke/snacks.nvim/issues/82) ([ec9cfb3](https://github.com/folke/snacks.nvim/commit/ec9cfb36b1ea2b4bf21b5812791c8bfee3bcf322))
* **terminal:** when terminal terminates too quickly, don't close the window and show an error message. See [#80](https://github.com/folke/snacks.nvim/issues/80) ([313954e](https://github.com/folke/snacks.nvim/commit/313954efdfb064a85df731b29fa9b86bc711044a))
### Bug Fixes
* **docs:** typo in README.md ([#78](https://github.com/folke/snacks.nvim/issues/78)) ([dc0f404](https://github.com/folke/snacks.nvim/commit/dc0f4041dcc8da860bdf84c3bf27d41a6a4debf3))
* **example:** rename file. Closes [#76](https://github.com/folke/snacks.nvim/issues/76) ([00c7a67](https://github.com/folke/snacks.nvim/commit/00c7a674004665999fbea310a322f1e105e1cfb5))
* **notifier:** no gap in border without title/icon ([#85](https://github.com/folke/snacks.nvim/issues/85)) ([bc80bdc](https://github.com/folke/snacks.nvim/commit/bc80bdcc62efd236617dbbd183ce5882aded2145))
* **win:** delay when closing windows ([#81](https://github.com/folke/snacks.nvim/issues/81)) ([d3dc8e7](https://github.com/folke/snacks.nvim/commit/d3dc8e7c27a663e4b30579e4e1ca3313052d0874))
## [2.0.0](https://github.com/folke/snacks.nvim/compare/v1.2.0...v2.0.0) (2024-11-14)
### โ BREAKING CHANGES
* **config:** plugins are no longer enabled by default. Pass any options, or set `enabled = true`.
### Features
* **config:** plugins are no longer enabled by default. Pass any options, or set `enabled = true`. ([797708b](https://github.com/folke/snacks.nvim/commit/797708b0384ddfd66118651c48c3b399e376cb77))
* **health:** added health checks to plugins ([1c4c748](https://github.com/folke/snacks.nvim/commit/1c4c74828fcca382f54817f4446649b201d56557))
* **terminal:** added `Snacks.terminal.colorize()` to replace ansi codes by colors ([519b684](https://github.com/folke/snacks.nvim/commit/519b6841c42c575aec2ffc6c79c4e0a1a13e74bd))
### Bug Fixes
* **lazygit:** not needed to use deprecated fallback for set_hl ([14f076e](https://github.com/folke/snacks.nvim/commit/14f076e039aa876ba086449a45053d847bddb3db))
* **notifier:** disable `colorcolumn` by default ([#66](https://github.com/folke/snacks.nvim/issues/66)) ([7627b81](https://github.com/folke/snacks.nvim/commit/7627b81d9f3453bd2e979d48d3eff2787e6029e9))
* **statuscolumn:** ensure Snacks exists when loading before plugin loaded ([97e0e1e](https://github.com/folke/snacks.nvim/commit/97e0e1ec7f1088ee026efdaa789d102461ad49d4))
* **terminal:** properly deal with args in `vim.o.shell`. Fixes [#69](https://github.com/folke/snacks.nvim/issues/69) ([2ccb70f](https://github.com/folke/snacks.nvim/commit/2ccb70fd3a42d188c95db233bfb7469259d56fb6))
* **win:** take border into account for window position ([#64](https://github.com/folke/snacks.nvim/issues/64)) ([f0e47fd](https://github.com/folke/snacks.nvim/commit/f0e47fd5dc3ccc71cdd8866e2ce82749d3797fbb))
## [1.2.0](https://github.com/folke/snacks.nvim/compare/v1.1.0...v1.2.0) (2024-11-11)
### Features
* **bufdelete:** added `wipe` option. Closes [#38](https://github.com/folke/snacks.nvim/issues/38) ([5914cb1](https://github.com/folke/snacks.nvim/commit/5914cb101070956a73462dcb1c81c8462e9e77d7))
* **lazygit:** allow overriding extra lazygit config options ([d2f4f19](https://github.com/folke/snacks.nvim/commit/d2f4f1937e6fa97a48d5839d49f1f3012067bf45))
* **notifier:** added `refresh` option configurable ([df8c9d7](https://github.com/folke/snacks.nvim/commit/df8c9d7724ade9f3c63277f08b237ac3b32b6cfe))
* **notifier:** added backward compatibility for nvim-notify's replace option ([9b9777e](https://github.com/folke/snacks.nvim/commit/9b9777ec3bba97b3ddb37bd824a9ef9a46955582))
* **words:** add `fold_open` and `set_jump_point` config options ([#31](https://github.com/folke/snacks.nvim/issues/31)) ([5dc749b](https://github.com/folke/snacks.nvim/commit/5dc749b045e62e30a156ca8522416a6d1ca9a959))
### Bug Fixes
* added compatibility with Neovim >= 0.9.4 ([4f99818](https://github.com/folke/snacks.nvim/commit/4f99818b0ab98510ab8987a0427afc515fb5f76b))
* **bufdelete:** opts.wipe. See [#38](https://github.com/folke/snacks.nvim/issues/38) ([0efbb93](https://github.com/folke/snacks.nvim/commit/0efbb93e0a4405b955d574746eb57ef6d48ae386))
* **notifier:** take title/footer into account to determine notification width. Fixes [#54](https://github.com/folke/snacks.nvim/issues/54) ([09a6f17](https://github.com/folke/snacks.nvim/commit/09a6f17eccbb551797f522403033f48e63a25f74))
* **notifier:** update layout on vim resize ([7f9f691](https://github.com/folke/snacks.nvim/commit/7f9f691a12d0665146b25a44323f21e18aa46c24))
* **terminal:** `gf` properly opens file ([#45](https://github.com/folke/snacks.nvim/issues/45)) ([340cc27](https://github.com/folke/snacks.nvim/commit/340cc2756e9d7ef0ae9a6f55cdfbfdca7a9defa7))
* **terminal:** pass a list of strings to termopen to prevent splitting. Fixes [#59](https://github.com/folke/snacks.nvim/issues/59) ([458a84b](https://github.com/folke/snacks.nvim/commit/458a84bd1db856c21f234a504ec384191a9899cf))
### Performance Improvements
* **notifier:** only force redraw for new windows and for updated while search is not active. Fixes [#52](https://github.com/folke/snacks.nvim/issues/52) ([da86b1d](https://github.com/folke/snacks.nvim/commit/da86b1deff9a0b1bb66f344241fb07577b6463b8))
* **win:** don't try highlighting snacks internal filetypes ([eb8ab37](https://github.com/folke/snacks.nvim/commit/eb8ab37f6ac421eeda2570257d2279bd12700667))
* **win:** prevent treesitter and syntax attaching to scratch buffers ([cc80f6d](https://github.com/folke/snacks.nvim/commit/cc80f6dc1b7a286cb06c6321bfeb1046f7a59418))
## [1.1.0](https://github.com/folke/snacks.nvim/compare/v1.0.0...v1.1.0) (2024-11-08)
### Features
* **bufdelete:** optional filter and shortcuts to delete `all` and `other` buffers. Closes [#11](https://github.com/folke/snacks.nvim/issues/11) ([71a2346](https://github.com/folke/snacks.nvim/commit/71a234608ffeebfa8a04c652834342fa9ce508c3))
* **debug:** simple log function to quickly log something to a debug.log file ([fc2a8e7](https://github.com/folke/snacks.nvim/commit/fc2a8e74686c7c347ed0aaa5eb607874ecdca288))
* **docs:** docs for highlight groups ([#13](https://github.com/folke/snacks.nvim/issues/13)) ([964cd6a](https://github.com/folke/snacks.nvim/commit/964cd6aa76f3608c7e379b8b1a483ae19f57e279))
* **gitbrowse:** choose to open repo, branch or file. Closes [#10](https://github.com/folke/snacks.nvim/issues/10). Closes [#17](https://github.com/folke/snacks.nvim/issues/17) ([92da87c](https://github.com/folke/snacks.nvim/commit/92da87c910a9b1421e8baae2e67020565526fba8))
* **notifier:** added history to notifier. Closes [#14](https://github.com/folke/snacks.nvim/issues/14) ([65d8c8f](https://github.com/folke/snacks.nvim/commit/65d8c8f00b6589b44410301b790d97c268f86f85))
* **notifier:** added option to show notifs top-down or bottom-up. Closes [#9](https://github.com/folke/snacks.nvim/issues/9) ([080e0d4](https://github.com/folke/snacks.nvim/commit/080e0d403924e1e62d3b88412a41f3ab22594049))
* **notifier:** allow overriding hl groups per notification ([8bcb2bc](https://github.com/folke/snacks.nvim/commit/8bcb2bc805a1785208f96ad7ad96690eee50c925))
* **notifier:** allow setting dynamic options ([36e9f45](https://github.com/folke/snacks.nvim/commit/36e9f45302bc9c200c76349ecd79a319a5944d8c))
* **win:** added default hl groups for windows ([8c0f10b](https://github.com/folke/snacks.nvim/commit/8c0f10b9dade154d355e31aa3f9c8c0ba212205e))
* **win:** allow setting `ft` just for highlighting without actually changing the `filetype` ([cad236f](https://github.com/folke/snacks.nvim/commit/cad236f9bbe46fbb53127014731d8507a3bc80af))
* **win:** disable winblend when colorscheme is transparent. Fixes [#26](https://github.com/folke/snacks.nvim/issues/26) ([12077bc](https://github.com/folke/snacks.nvim/commit/12077bcf65554b585b1f094c69746df402433132))
* **win:** equalize splits ([e982aab](https://github.com/folke/snacks.nvim/commit/e982aabefdf0b1d00ddd850152921e577cd980cc))
* **win:** util methods to handle buffer text ([d3efb92](https://github.com/folke/snacks.nvim/commit/d3efb92aa546eb160782e24e305f74a559eec212))
* **win:** win:focus() ([476fb56](https://github.com/folke/snacks.nvim/commit/476fb56bfd8e32a2805f46fadafbc4eee7878597))
* **words:** `jump` optionally shows notification with reference count ([#23](https://github.com/folke/snacks.nvim/issues/23)) ([6a3f865](https://github.com/folke/snacks.nvim/commit/6a3f865357005c934e2b5ad2cfadaa038775e9e0))
* **words:** configurable mode to show references. Defaults to n, i, c. Closes [#18](https://github.com/folke/snacks.nvim/issues/18) ([d079fbf](https://github.com/folke/snacks.nvim/commit/d079fbfe354ebfec18c4e1bfd7fee695703e3692))
### Bug Fixes
* **config:** deepcopy config where needed ([6c76f91](https://github.com/folke/snacks.nvim/commit/6c76f913981663ec0dba39686018cbc2ff3220b8))
* **config:** fix reading config during setup. Fixes [#2](https://github.com/folke/snacks.nvim/issues/2) ([0d91a4e](https://github.com/folke/snacks.nvim/commit/0d91a4e364866e407901020b59121883cbfb1cf1))
* **notifier:** re-apply winhl since level might have changed with a replace ([b8cc93e](https://github.com/folke/snacks.nvim/commit/b8cc93e273fd481f2b3b7785f64e301d70fd8e45))
* **notifier:** set default conceallevel=2 ([662795c](https://github.com/folke/snacks.nvim/commit/662795c2855b7bfd5e6ec254e469284dacdabb3f))
* **notifier:** try to keep layout when replacing notifs ([9bdb24e](https://github.com/folke/snacks.nvim/commit/9bdb24e735458ea4fd3974939c33ea78cbba0212))
* **terminal:** dont overwrite user opts ([0b08d28](https://github.com/folke/snacks.nvim/commit/0b08d280b605b2e460c1fd92bc87152e66f14430))
* **terminal:** user options ([334895c](https://github.com/folke/snacks.nvim/commit/334895c5bb2ed04f65800abaeb91ccb0487b0f1f))
* **win:** better winfixheight and winfixwidth for splits ([8be14c6](https://github.com/folke/snacks.nvim/commit/8be14c68a7825fff90ca071f0650657ba88da423))
* **win:** disable sidescroloff in minimal style ([107d10b](https://github.com/folke/snacks.nvim/commit/107d10b52e54828606a645517b55802dd807e8ad))
* **win:** dont center float when `relative="cursor"` ([4991e34](https://github.com/folke/snacks.nvim/commit/4991e347dcc6ff6c14443afe9b4d849a67b67944))
* **win:** properly resolve user styles as last ([cc5ee19](https://github.com/folke/snacks.nvim/commit/cc5ee192caf79446d58cbc09487268aa1f86f405))
* **win:** set border to none for backdrop windows ([#19](https://github.com/folke/snacks.nvim/issues/19)) ([f5602e6](https://github.com/folke/snacks.nvim/commit/f5602e60c325f0c60eb6f2869a7222beb88a773c))
* **win:** simpler way to add buffer padding ([f59237f](https://github.com/folke/snacks.nvim/commit/f59237f1dcdceb646bf2552b69b7e2040f80f603))
* **win:** update win/buf opts when needed ([5fd9c42](https://github.com/folke/snacks.nvim/commit/5fd9c426e850c02489943d7177d9e7fddec5e589))
* **words:** disable notify_jump by default ([9576081](https://github.com/folke/snacks.nvim/commit/9576081e871a801f60367e7180543fa41c384755))
### Performance Improvements
* **notifier:** index queue by id ([5df4394](https://github.com/folke/snacks.nvim/commit/5df4394c60958635bf4651d8d7e25f53f48a3965))
* **notifier:** optimize layout code ([8512896](https://github.com/folke/snacks.nvim/commit/8512896228b3e37e3d02c68fa739749c9f0b9838))
* **notifier:** skip processing queue when free space is smaller than min height ([08190a5](https://github.com/folke/snacks.nvim/commit/08190a545857ef09cb6ada4337fe7ec67d3602a9))
* **win:** skip events when setting buf/win options. Trigger FileType on BufEnter only if needed ([61496a3](https://github.com/folke/snacks.nvim/commit/61496a3ef00bd67afb7affcb4933905910a6283c))
## 1.0.0 (2024-11-06)
### Features
* added debug ([6cb43f6](https://github.com/folke/snacks.nvim/commit/6cb43f603360c6fc702b5d7c928dfde22d886e2f))
* added git ([f0a9991](https://github.com/folke/snacks.nvim/commit/f0a999134738c54dccb78ae462774eb228614221))
* added gitbrowse ([a638d8b](https://github.com/folke/snacks.nvim/commit/a638d8bafef85ac6046cfc02e415a8893e0391b9))
* added lazygit ([fc32619](https://github.com/folke/snacks.nvim/commit/fc32619734e4d3c024b8fc2db941c8ac19d2dd6c))
* added notifier ([44011dd](https://github.com/folke/snacks.nvim/commit/44011ddf0da07d0fa89734d21bb770f01a630077))
* added notify ([f4e0130](https://github.com/folke/snacks.nvim/commit/f4e0130ec3cb0299a3a85c589250c114d46f53c2))
* added toggle ([28c3029](https://github.com/folke/snacks.nvim/commit/28c30296991ac5549b49b7ecfb49f108f70d76ba))
* better buffer/window vars for terminal and float ([1abce78](https://github.com/folke/snacks.nvim/commit/1abce78a8b826943d5055464636cd9fad074b4bb))
* bigfile ([8d62b28](https://github.com/folke/snacks.nvim/commit/8d62b285d5026e3d7c064d435c424bab40d1910a))
* **bigfile:** show message when bigfile was detected ([fdc0d3d](https://github.com/folke/snacks.nvim/commit/fdc0d3d1f80a6be64e85a5a25dc34693edadd73f))
* bufdelete ([cc5353f](https://github.com/folke/snacks.nvim/commit/cc5353f6b3f3f3869e2110b2d3d1a95418653213))
* config & setup ([c98c4c0](https://github.com/folke/snacks.nvim/commit/c98c4c030711a59e6791d8e5cab7550e33ac2d2d))
* **config:** get config for snack with defaults and custom opts ([b3d08be](https://github.com/folke/snacks.nvim/commit/b3d08beb8c60fddc6bfbf96ac9f45c4db49e64af))
* **debug:** added simple profile function ([e1f736d](https://github.com/folke/snacks.nvim/commit/e1f736d71fb9020a09019a49d645d4fe6d9f30db))
* **docs:** better handling of overloads ([038b283](https://github.com/folke/snacks.nvim/commit/038b28319c3a4eba7220a679a5759c06e69b8493))
* ensure Snacks global is available when not using setup ([f0458ba](https://github.com/folke/snacks.nvim/commit/f0458bafb059da9885de4fbab1ae5cb6ce2cd0bb))
* float ([d106107](https://github.com/folke/snacks.nvim/commit/d106107cdccc7ecb9931e011a89df6011eed44c4))
* **float:** added support for splits ([977a3d3](https://github.com/folke/snacks.nvim/commit/977a3d345b6da2b819d9bc4870d3d8a7e026728e))
* **float:** better key mappings ([a171a81](https://github.com/folke/snacks.nvim/commit/a171a815b3acd72dd779781df5586a7cd6ddd649))
* initial commit ([63a24f6](https://github.com/folke/snacks.nvim/commit/63a24f6eb047530234297460a9b7ccd6af0b9858))
* **notifier:** add 1 cell left/right padding and make wrapping work properly ([efc9699](https://github.com/folke/snacks.nvim/commit/efc96996e5a98b619e87581e9527c871177dee52))
* **notifier:** added global keep config option ([f32d82d](https://github.com/folke/snacks.nvim/commit/f32d82d1b705512eb56c901d4d7de68eedc827b1))
* **notifier:** added minimal style ([b29a6d5](https://github.com/folke/snacks.nvim/commit/b29a6d5972943cb8fcfdfb94610d850f0ba050b3))
* **notifier:** allow closing notifs with `q` ([97acbbb](https://github.com/folke/snacks.nvim/commit/97acbbb654d13a0d38792fd6383973a2ca01a2bf))
* **notifier:** allow config of default filetype ([8a96888](https://github.com/folke/snacks.nvim/commit/8a968884098be83acb42f31a573e62b63420268e))
* **notifier:** enable wrapping by default ([d02aa2f](https://github.com/folke/snacks.nvim/commit/d02aa2f7cb49273330fd778818124ddb39838372))
* **notifier:** keep notif open when it's the current window ([1e95800](https://github.com/folke/snacks.nvim/commit/1e9580039b706cfc1f526fea2e46b6857473420b))
* quickfile ([d0ce645](https://github.com/folke/snacks.nvim/commit/d0ce6454f95fe056c65324a0f59a250532a658f3))
* rename ([fa33688](https://github.com/folke/snacks.nvim/commit/fa336883019110b8f525081665bf55c19df5f0aa))
* statuscolumn ([99b1700](https://github.com/folke/snacks.nvim/commit/99b170001592fe054368a220599da546de64894e))
* terminal ([e6cc7c9](https://github.com/folke/snacks.nvim/commit/e6cc7c998afa63eaf126d169f4702953f548d39f))
* **terminal:** allow to override the default terminal implementation (like toggleterm) ([11c9ee8](https://github.com/folke/snacks.nvim/commit/11c9ee83aa133f899dad966224df0e2d7de236f2))
* **terminal:** better defaults and winbar ([7ceeb47](https://github.com/folke/snacks.nvim/commit/7ceeb47e545619dff6dd8853f0a368afae7d3ec8))
* **terminal:** better double esc to go to normal mode ([a4af729](https://github.com/folke/snacks.nvim/commit/a4af729b2489714b066ca03f008bf5fe42c93343))
* **win:** better api to deal with sizes ([ac1a50c](https://github.com/folke/snacks.nvim/commit/ac1a50c810c5f67909921592afcebffa566ee3d3))
* **win:** custom views ([12d6f86](https://github.com/folke/snacks.nvim/commit/12d6f863f73cbd3580295adc5bc546c9d10e9e7f))
* words ([73445af](https://github.com/folke/snacks.nvim/commit/73445af400457722508395d18d2c974965c53fe2))
### Bug Fixes
* **config:** don't change defaults in merge ([6e825f5](https://github.com/folke/snacks.nvim/commit/6e825f509ed0e41dbafe5bca0236157772344554))
* **config:** merging of possible nil values ([f5bbb44](https://github.com/folke/snacks.nvim/commit/f5bbb446ed012361bbd54362558d1f32476206c7))
* **debug:** exclude vimrc from callers ([8845a6a](https://github.com/folke/snacks.nvim/commit/8845a6a912a528f63216ffe4b991b025c8955447))
* **float:** don't use backdrop for splits ([5eb64c5](https://github.com/folke/snacks.nvim/commit/5eb64c52aeb7271a3116751f1ec61b00536cdc08))
* **float:** only set default filetype if no ft is set ([66b2525](https://github.com/folke/snacks.nvim/commit/66b252535c7a78f0cd73755fad22b07b814309f1))
* **float:** proper closing of backdrop ([a528e77](https://github.com/folke/snacks.nvim/commit/a528e77397daea422ff84dde64124d4a7e352bc2))
* **notifier:** modifiable ([fd57c24](https://github.com/folke/snacks.nvim/commit/fd57c243015e6f2c863bb6c89e1417e77f3e0ea4))
* **notifier:** modifiable = false ([9ef9e69](https://github.com/folke/snacks.nvim/commit/9ef9e69620fc51d368fcee830a59bc9279594d43))
* **notifier:** show notifier errors with nvim_err_writeln ([e8061bc](https://github.com/folke/snacks.nvim/commit/e8061bcda095e3e9a3110ce697cdf7155e178d6e))
* **notifier:** sorting ([d9a1f23](https://github.com/folke/snacks.nvim/commit/d9a1f23e216230fcb2060e74056778d57d1d7676))
* simplify setup ([787b53e](https://github.com/folke/snacks.nvim/commit/787b53e7635f322bf42a42279f647340daf77770))
* **win:** backdrop ([71dd912](https://github.com/folke/snacks.nvim/commit/71dd912763918fd6b7fd07dd66ccd16afd4fea78))
* **win:** better implementation of window styles (previously views) ([6681097](https://github.com/folke/snacks.nvim/commit/66810971b9bd08e212faae467d884758bf142ffe))
* **win:** dont error when augroup is already deleted ([8c43597](https://github.com/folke/snacks.nvim/commit/8c43597f10dc2916200a8c857026f3f15fd3ae65))
* **win:** dont update win opt noautocmd ([a06e3ed](https://github.com/folke/snacks.nvim/commit/a06e3ed8fcd08aaf43fc2454bb1b0f935053aca7))
* **win:** no need to set EndOfBuffer winhl ([7a7f221](https://github.com/folke/snacks.nvim/commit/7a7f221020e024da831c2a3d72f8a9a0c330d711))
* **win:** use syntax as fallback for treesitter ([f3b69a6](https://github.com/folke/snacks.nvim/commit/f3b69a617a57597571fcf4263463f989fa3b663d))
### Performance Improvements
* **win:** set options with eventignore and handle ft manually ([80d9a89](https://github.com/folke/snacks.nvim/commit/80d9a894f9d6b2087e0dfee6d777e7b78490ba93)) | {
"source": "folke/snacks.nvim",
"title": "CHANGELOG.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/CHANGELOG.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 227532
} |
# ๐ฟ `snacks.nvim`
A collection of small QoL plugins for Neovim.
## โจ Features
<!-- toc:start -->
| Snack | Description | Setup |
| ----- | ----------- | :---: |
| [animate](https://github.com/folke/snacks.nvim/blob/main/docs/animate.md) | Efficient animations including over 45 easing functions _(library)_ | |
| [bigfile](https://github.com/folke/snacks.nvim/blob/main/docs/bigfile.md) | Deal with big files | โผ๏ธ |
| [bufdelete](https://github.com/folke/snacks.nvim/blob/main/docs/bufdelete.md) | Delete buffers without disrupting window layout | |
| [dashboard](https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md) | Beautiful declarative dashboards | โผ๏ธ |
| [debug](https://github.com/folke/snacks.nvim/blob/main/docs/debug.md) | Pretty inspect & backtraces for debugging | |
| [dim](https://github.com/folke/snacks.nvim/blob/main/docs/dim.md) | Focus on the active scope by dimming the rest | |
| [explorer](https://github.com/folke/snacks.nvim/blob/main/docs/explorer.md) | A file explorer (picker in disguise) | โผ๏ธ |
| [git](https://github.com/folke/snacks.nvim/blob/main/docs/git.md) | Git utilities | |
| [gitbrowse](https://github.com/folke/snacks.nvim/blob/main/docs/gitbrowse.md) | Open the current file, branch, commit, or repo in a browser (e.g. GitHub, GitLab, Bitbucket) | |
| [image](https://github.com/folke/snacks.nvim/blob/main/docs/image.md) | Image viewer using Kitty Graphics Protocol, supported by `kitty`, `wezterm` and `ghostty` | โผ๏ธ |
| [indent](https://github.com/folke/snacks.nvim/blob/main/docs/indent.md) | Indent guides and scopes | |
| [input](https://github.com/folke/snacks.nvim/blob/main/docs/input.md) | Better `vim.ui.input` | โผ๏ธ |
| [layout](https://github.com/folke/snacks.nvim/blob/main/docs/layout.md) | Window layouts | |
| [lazygit](https://github.com/folke/snacks.nvim/blob/main/docs/lazygit.md) | Open LazyGit in a float, auto-configure colorscheme and integration with Neovim | |
| [notifier](https://github.com/folke/snacks.nvim/blob/main/docs/notifier.md) | Pretty `vim.notify` | โผ๏ธ |
| [notify](https://github.com/folke/snacks.nvim/blob/main/docs/notify.md) | Utility functions to work with Neovim's `vim.notify` | |
| [picker](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) | Picker for selecting items | โผ๏ธ |
| [profiler](https://github.com/folke/snacks.nvim/blob/main/docs/profiler.md) | Neovim lua profiler | |
| [quickfile](https://github.com/folke/snacks.nvim/blob/main/docs/quickfile.md) | When doing `nvim somefile.txt`, it will render the file as quickly as possible, before loading your plugins. | โผ๏ธ |
| [rename](https://github.com/folke/snacks.nvim/blob/main/docs/rename.md) | LSP-integrated file renaming with support for plugins like [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) and [mini.files](https://github.com/echasnovski/mini.files). | |
| [scope](https://github.com/folke/snacks.nvim/blob/main/docs/scope.md) | Scope detection, text objects and jumping based on treesitter or indent | โผ๏ธ |
| [scratch](https://github.com/folke/snacks.nvim/blob/main/docs/scratch.md) | Scratch buffers with a persistent file | |
| [scroll](https://github.com/folke/snacks.nvim/blob/main/docs/scroll.md) | Smooth scrolling | โผ๏ธ |
| [statuscolumn](https://github.com/folke/snacks.nvim/blob/main/docs/statuscolumn.md) | Pretty status column | โผ๏ธ |
| [terminal](https://github.com/folke/snacks.nvim/blob/main/docs/terminal.md) | Create and toggle floating/split terminals | |
| [toggle](https://github.com/folke/snacks.nvim/blob/main/docs/toggle.md) | Toggle keymaps integrated with which-key icons / colors | |
| [util](https://github.com/folke/snacks.nvim/blob/main/docs/util.md) | Utility functions for Snacks _(library)_ | |
| [win](https://github.com/folke/snacks.nvim/blob/main/docs/win.md) | Create and manage floating windows or splits | |
| [words](https://github.com/folke/snacks.nvim/blob/main/docs/words.md) | Auto-show LSP references and quickly navigate between them | โผ๏ธ |
| [zen](https://github.com/folke/snacks.nvim/blob/main/docs/zen.md) | Zen mode โข distraction-free coding | |
<!-- toc:end -->
## โก๏ธ Requirements
- **Neovim** >= 0.9.4
- for proper icons support:
- [mini.icons](https://github.com/echasnovski/mini.icons) _(optional)_
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) _(optional)_
- a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_**
## ๐ฆ Installation
Install the plugin with your package manager:
### [lazy.nvim](https://github.com/folke/lazy.nvim)
> [!important]
> A couple of plugins **require** `snacks.nvim` to be set-up early.
> Setup creates some autocmds and does not load any plugins.
> Check the [code](https://github.com/folke/snacks.nvim/blob/main/lua/snacks/init.lua) to see what it does.
> [!caution]
> You need to explicitly pass options for a plugin or set `enabled = true` to enable it.
> [!tip]
> It's a good idea to run `:checkhealth snacks` to see if everything is set up correctly.
```lua
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
bigfile = { enabled = true },
dashboard = { enabled = true },
explorer = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
picker = { enabled = true },
notifier = { enabled = true },
quickfile = { enabled = true },
scope = { enabled = true },
scroll = { enabled = true },
statuscolumn = { enabled = true },
words = { enabled = true },
},
}
```
For an in-depth setup of `snacks.nvim` with `lazy.nvim`, check the [example](https://github.com/folke/snacks.nvim?tab=readme-ov-file#-usage) below.
## โ๏ธ Configuration
Please refer to the readme of each plugin for their specific configuration.
<details><summary>Default Options</summary>
<!-- config:start -->
```lua
---@class snacks.Config
---@field animate? snacks.animate.Config
---@field bigfile? snacks.bigfile.Config
---@field dashboard? snacks.dashboard.Config
---@field dim? snacks.dim.Config
---@field explorer? snacks.explorer.Config
---@field gitbrowse? snacks.gitbrowse.Config
---@field image? snacks.image.Config
---@field indent? snacks.indent.Config
---@field input? snacks.input.Config
---@field layout? snacks.layout.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config
---@field picker? snacks.picker.Config
---@field profiler? snacks.profiler.Config
---@field quickfile? snacks.quickfile.Config
---@field scope? snacks.scope.Config
---@field scratch? snacks.scratch.Config
---@field scroll? snacks.scroll.Config
---@field statuscolumn? snacks.statuscolumn.Config
---@field terminal? snacks.terminal.Config
---@field toggle? snacks.toggle.Config
---@field win? snacks.win.Config
---@field words? snacks.words.Config
---@field zen? snacks.zen.Config
---@field styles? table<string, snacks.win.Config>
---@field image? snacks.image.Config|{}
{
image = {
-- define these here, so that we don't need to load the image module
formats = {
"png",
"jpg",
"jpeg",
"gif",
"bmp",
"webp",
"tiff",
"heic",
"avif",
"mp4",
"mov",
"avi",
"mkv",
"webm",
"pdf",
},
},
}
```
<!-- config:end -->
</details>
Some plugins have examples in their documentation. You can include them in your
config like this:
```lua
{
dashboard = { example = "github" }
}
```
If you want to customize options for a plugin after they have been resolved, you
can use the `config` function:
```lua
{
gitbrowse = {
config = function(opts, defaults)
table.insert(opts.remote_patterns, { "my", "custom pattern" })
end
},
}
```
## ๐ Usage
See the example below for how to configure `snacks.nvim`.
<!-- example:start -->
```lua
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = { enabled = true },
explorer = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
notifier = {
enabled = true,
timeout = 3000,
},
picker = { enabled = true },
quickfile = { enabled = true },
scope = { enabled = true },
scroll = { enabled = true },
statuscolumn = { enabled = true },
words = { enabled = true },
styles = {
notification = {
-- wo = { wrap = true } -- Wrap notifications
}
}
},
keys = {
-- Top Pickers & Explorer
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
-- find
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
-- git
{ "<leader>gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" },
{ "<leader>gl", function() Snacks.picker.git_log() end, desc = "Git Log" },
{ "<leader>gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" },
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" },
{ "<leader>gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" },
-- Grep
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
-- search
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
{ '<leader>s/', function() Snacks.picker.search_history() end, desc = "Search History" },
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
-- LSP
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
{ "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" },
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
-- Other
{ "<leader>z", function() Snacks.zen() end, desc = "Toggle Zen Mode" },
{ "<leader>Z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom" },
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
{ "<leader>n", function() Snacks.notifier.show_history() end, desc = "Notification History" },
{ "<leader>bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" },
{ "<leader>cR", function() Snacks.rename.rename_file() end, desc = "Rename File" },
{ "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } },
{ "<leader>gg", function() Snacks.lazygit() end, desc = "Lazygit" },
{ "<leader>un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications" },
{ "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal" },
{ "<c-_>", function() Snacks.terminal() end, desc = "which_key_ignore" },
{ "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" } },
{ "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" } },
{
"<leader>N",
desc = "Neovim News",
function()
Snacks.win({
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
width = 0.6,
height = 0.6,
wo = {
spell = false,
wrap = false,
signcolumn = "yes",
statuscolumn = " ",
conceallevel = 3,
},
})
end,
}
},
init = function()
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
-- Setup some globals for debugging (lazy-loaded)
_G.dd = function(...)
Snacks.debug.inspect(...)
end
_G.bt = function()
Snacks.debug.backtrace()
end
vim.print = _G.dd -- Override print to use snacks for `:=` command
-- Create some toggle mappings
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
Snacks.toggle.diagnostics():map("<leader>ud")
Snacks.toggle.line_number():map("<leader>ul")
Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map("<leader>uc")
Snacks.toggle.treesitter():map("<leader>uT")
Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("<leader>ub")
Snacks.toggle.inlay_hints():map("<leader>uh")
Snacks.toggle.indent():map("<leader>ug")
Snacks.toggle.dim():map("<leader>uD")
end,
})
end,
}
```
<!-- example:end -->
## ๐ Highlight Groups
Snacks defines **a lot** of highlight groups and it's impossible to document them all.
Instead, you can use the picker to see all the highlight groups.
```lua
Snacks.picker.highlights({pattern = "hl_group:^Snacks"})
``` | {
"source": "folke/snacks.nvim",
"title": "README.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/README.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 16422
} |
## Description
<!-- 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>
-->
## Screenshots
<!-- Add screenshots of the changes if applicable. --> | {
"source": "folke/snacks.nvim",
"title": ".github/PULL_REQUEST_TEMPLATE.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/.github/PULL_REQUEST_TEMPLATE.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 332
} |
# ๐ฟ animate
Efficient animation library including over 45 easing functions:
- [Emmanuel Oga's easing functions](https://github.com/EmmanuelOga/easing)
- [Easing functions overview](https://github.com/kikito/tween.lua?tab=readme-ov-file#easing-functions)
There's at any given time at most one timer running, that takes
care of all active animations, controlled by the `fps` setting.
You can at any time disable all animations with:
- `vim.g.snacks_animate = false` globally
- `vim.b.snacks_animate = false` locally for the buffer
Doing this, will disable `scroll`, `indent`, `dim` and all other animations.
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
animate = {
-- your animate configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.animate.Config
---@field easing? snacks.animate.easing|snacks.animate.easing.Fn
{
---@type snacks.animate.Duration|number
duration = 20, -- ms per step
easing = "linear",
fps = 60, -- frames per second. Global setting for all animations
}
```
## ๐ Types
All easing functions take these parameters:
* `t` _(time)_: should go from 0 to duration
* `b` _(begin)_: value of the property being ease.
* `c` _(change)_: ending value of the property - beginning value of the property
* `d` _(duration)_: total duration of the animation
Some functions allow additional modifiers, like the elastic functions
which also can receive an amplitud and a period parameters (defaults
are included)
```lua
---@alias snacks.animate.easing.Fn fun(t: number, b: number, c: number, d: number): number
```
Duration can be specified as the total duration or the duration per step.
When both are specified, the minimum of both is used.
```lua
---@class snacks.animate.Duration
---@field step? number duration per step in ms
---@field total? number total duration in ms
```
```lua
---@class snacks.animate.Opts: snacks.animate.Config
---@field buf? number optional buffer to check if animations should be enabled
---@field int? boolean interpolate the value to an integer
---@field id? number|string unique identifier for the animation
```
```lua
---@class snacks.animate.ctx
---@field anim snacks.animate.Animation
---@field prev number
---@field done boolean
```
```lua
---@alias snacks.animate.cb fun(value:number, ctx: snacks.animate.ctx)
```
## ๐ฆ Module
### `Snacks.animate()`
```lua
---@type fun(from: number, to: number, cb: snacks.animate.cb, opts?: snacks.animate.Opts): snacks.animate.Animation
Snacks.animate()
```
### `Snacks.animate.add()`
Add an animation
```lua
---@param from number
---@param to number
---@param cb snacks.animate.cb
---@param opts? snacks.animate.Opts
Snacks.animate.add(from, to, cb, opts)
```
### `Snacks.animate.del()`
Delete an animation
```lua
---@param id number|string
Snacks.animate.del(id)
```
### `Snacks.animate.enabled()`
Check if animations are enabled.
Will return false if `snacks_animate` is set to false or if the buffer
local variable `snacks_animate` is set to false.
```lua
---@param opts? {buf?: number, name?: string}
Snacks.animate.enabled(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/animate.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/animate.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3255
} |
# ๐ฟ bigfile
`bigfile` adds a new filetype `bigfile` to Neovim that triggers when the file is
larger than the configured size. This automatically prevents things like LSP
and Treesitter attaching to the buffer.
Use the `setup` config function to further make changes to a `bigfile` buffer.
The context provides the actual filetype.
The default implementation enables `syntax` for the buffer and disables
[mini.animate](https://github.com/echasnovski/mini.animate) (if used)
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
bigfile = {
-- your bigfile configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.bigfile.Config
---@field enabled? boolean
{
notify = true, -- show notification when big file detected
size = 1.5 * 1024 * 1024, -- 1.5MB
line_length = 1000, -- average line length (useful for minified files)
-- Enable or disable features when big file detected
---@param ctx {buf: number, ft:string}
setup = function(ctx)
if vim.fn.exists(":NoMatchParen") ~= 0 then
vim.cmd([[NoMatchParen]])
end
Snacks.util.wo(0, { foldmethod = "manual", statuscolumn = "", conceallevel = 0 })
vim.b.minianimate_disable = true
vim.schedule(function()
if vim.api.nvim_buf_is_valid(ctx.buf) then
vim.bo[ctx.buf].syntax = ctx.ft
end
end)
end,
}
``` | {
"source": "folke/snacks.nvim",
"title": "docs/bigfile.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/bigfile.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 1504
} |
# ๐ฟ bufdelete
Delete buffers without disrupting window layout.
If the buffer you want to close has changes,
a prompt will be shown to save or discard.
<!-- docgen -->
## ๐ Types
```lua
---@class snacks.bufdelete.Opts
---@field buf? number Buffer to delete. Defaults to the current buffer
---@field file? string Delete buffer by file name. If provided, `buf` is ignored
---@field force? boolean Delete the buffer even if it is modified
---@field filter? fun(buf: number): boolean Filter buffers to delete
---@field wipe? boolean Wipe the buffer instead of deleting it (see `:h :bwipeout`)
```
## ๐ฆ Module
### `Snacks.bufdelete()`
```lua
---@type fun(buf?: number|snacks.bufdelete.Opts)
Snacks.bufdelete()
```
### `Snacks.bufdelete.all()`
Delete all buffers
```lua
---@param opts? snacks.bufdelete.Opts
Snacks.bufdelete.all(opts)
```
### `Snacks.bufdelete.delete()`
Delete a buffer:
- either the current buffer if `buf` is not provided
- or the buffer `buf` if it is a number
- or every buffer for which `buf` returns true if it is a function
```lua
---@param opts? number|snacks.bufdelete.Opts
Snacks.bufdelete.delete(opts)
```
### `Snacks.bufdelete.other()`
Delete all buffers except the current one
```lua
---@param opts? snacks.bufdelete.Opts
Snacks.bufdelete.other(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/bufdelete.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/bufdelete.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 1294
} |
# ๐ฟ dashboard
## โจ Features
- declarative configuration
- flexible layouts
- multiple vertical panes
- built-in sections:
- **header**: show a header
- **keys**: show keymaps
- **projects**: show recent projects
- **recent_files**: show recent files
- **session**: session support
- **startup**: startup time (lazy.nvim)
- **terminal**: colored terminal output
- super fast `terminal` sections with automatic caching
## ๐ Usage
The dashboard comes with a set of default sections, that
can be customized with `opts.preset` or
fully replaced with `opts.sections`.
The default preset comes with support for:
- pickers:
- [fzf-lua](https://github.com/ibhagwan/fzf-lua)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
- [mini.pick](https://github.com/echasnovski/mini.pick)
- session managers: (only works with [lazy.nvim](https://github.com/folke/lazy.nvim))
- [persistence.nvim](https://github.com/folke/persistence.nvim)
- [persisted.nvim](https://github.com/olimorris/persisted.nvim)
- [neovim-session-manager](https://github.com/Shatur/neovim-session-manager)
- [posession.nvim](https://github.com/jedrzejboczar/possession.nvim)
- [mini.sessions](https://github.com/echasnovski/mini.sessions)
### Section actions
A section can have an `action` property that will be executed as:
- a command if it starts with `:`
- a keymap if it's a string not starting with `:`
- a function if it's a function
```lua
-- command
{
action = ":Telescope find_files",
key = "f",
},
```
```lua
-- keymap
{
action = "<leader>ff",
key = "f",
},
```
```lua
-- function
{
action = function()
require("telescope.builtin").find_files()
end,
key = "h",
},
```
### Item text
Every item should have a `text` property with an array of `snacks.dashboard.Text` objects.
If the `text` property is not provided, the `snacks.dashboard.Config.formats`
will be used to generate the text.
In the example below, both sections are equivalent.
```lua
{
text = {
{ "๏ ", hl = "SnacksDashboardIcon" },
{ "Find File", hl = "SnacksDashboardDesc", width = 50 },
{ "[f]", hl = "SnacksDashboardKey" },
},
action = ":Telescope find_files",
key = "f",
},
```
```lua
{
action = ":Telescope find_files",
key = "f",
desc = "Find File",
icon = "๏ ",
},
```
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
dashboard = {
-- your dashboard configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.dashboard.Config
---@field enabled? boolean
---@field sections snacks.dashboard.Section
---@field formats table<string, snacks.dashboard.Text|fun(item:snacks.dashboard.Item, ctx:snacks.dashboard.Format.ctx):snacks.dashboard.Text>
{
width = 60,
row = nil, -- dashboard position. nil for center
col = nil, -- dashboard position. nil for center
pane_gap = 4, -- empty columns between vertical panes
autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -- autokey sequence
-- These settings are used by some built-in sections
preset = {
-- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick`
---@type fun(cmd:string, opts:table)|nil
pick = nil,
-- Used by the `keys` section to show keymaps.
-- Set your custom keymaps here.
-- When using a function, the `items` argument are the default keymaps.
---@type snacks.dashboard.Item[]
keys = {
{ icon = "๏ ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
{ icon = "๏
", key = "n", desc = "New File", action = ":ene | startinsert" },
{ icon = "๏ข ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
{ icon = "๏
", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
{ icon = "๏ฃ ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
{ icon = "๎ ", key = "s", desc = "Restore Session", section = "session" },
{ icon = "๓ฐฒ ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil },
{ icon = "๏ฆ ", key = "q", desc = "Quit", action = ":qa" },
},
-- Used by the `header` section
header = [[
โโโโ โโโโโโโโโโโ โโโโโโโ โโโ โโโโโโโโโโ โโโโ
โโโโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโ โโโโโ
โโโโโโ โโโโโโโโโ โโโ โโโโโโ โโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโ โโโ โโโโโโโ โโโโโโโโโโโโโโโโโโ
โโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโ โโโโโโ โโโ โโโ
โโโ โโโโโโโโโโโโโ โโโโโโโ โโโโโ โโโโโโ โโโ]],
},
-- item field formatters
formats = {
icon = function(item)
if item.file and item.icon == "file" or item.icon == "directory" then
return M.icon(item.file, item.icon)
end
return { item.icon, width = 2, hl = "icon" }
end,
footer = { "%s", align = "center" },
header = { "%s", align = "center" },
file = function(item, ctx)
local fname = vim.fn.fnamemodify(item.file, ":~")
fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname
if #fname > ctx.width then
local dir = vim.fn.fnamemodify(fname, ":h")
local file = vim.fn.fnamemodify(fname, ":t")
if dir and file then
file = file:sub(-(ctx.width - #dir - 2))
fname = dir .. "/โฆ" .. file
end
end
local dir, file = fname:match("^(.*)/(.+)$")
return dir and { { dir .. "/", hl = "dir" }, { file, hl = "file" } } or { { fname, hl = "file" } }
end,
},
sections = {
{ section = "header" },
{ section = "keys", gap = 1, padding = 1 },
{ section = "startup" },
},
}
```
## ๐ Examples
### `advanced`
A more advanced example using multiple panes

```lua
{
sections = {
{ section = "header" },
{
pane = 2,
section = "terminal",
cmd = "colorscript -e square",
height = 5,
padding = 1,
},
{ section = "keys", gap = 1, padding = 1 },
{ pane = 2, icon = "๏
", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
{ pane = 2, icon = "๏ผ ", title = "Projects", section = "projects", indent = 2, padding = 1 },
{
pane = 2,
icon = "๎ฅ ",
title = "Git Status",
section = "terminal",
enabled = function()
return Snacks.git.get_root() ~= nil
end,
cmd = "git status --short --branch --renames",
height = 5,
padding = 1,
ttl = 5 * 60,
indent = 3,
},
{ section = "startup" },
},
}
```
### `chafa`
An example using the `chafa` command to display an image

```lua
{
sections = {
{
section = "terminal",
cmd = "chafa ~/.config/wall.png --format symbols --symbols vhalf --size 60x17 --stretch; sleep .1",
height = 17,
padding = 1,
},
{
pane = 2,
{ section = "keys", gap = 1, padding = 1 },
{ section = "startup" },
},
},
}
```
### `compact_files`
A more compact version of the `files` example

```lua
{
sections = {
{ section = "header" },
{ icon = "๏ ", title = "Keymaps", section = "keys", indent = 2, padding = 1 },
{ icon = "๏
", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
{ icon = "๏ผ ", title = "Projects", section = "projects", indent = 2, padding = 1 },
{ section = "startup" },
},
}
```
### `doom`
Similar to the Emacs Doom dashboard

```lua
{
sections = {
{ section = "header" },
{ section = "keys", gap = 1, padding = 1 },
{ section = "startup" },
},
}
```
### `files`
A simple example with a header, keys, recent files, and projects

```lua
{
sections = {
{ section = "header" },
{ section = "keys", gap = 1 },
{ icon = "๏
", title = "Recent Files", section = "recent_files", indent = 2, padding = { 2, 2 } },
{ icon = "๏ผ ", title = "Projects", section = "projects", indent = 2, padding = 2 },
{ section = "startup" },
},
}
```
### `github`
Advanced example using the GitHub CLI.

```lua
{
sections = {
{ section = "header" },
{
pane = 2,
section = "terminal",
cmd = "colorscript -e square",
height = 5,
padding = 1,
},
{ section = "keys", gap = 1, padding = 1 },
{
pane = 2,
icon = "๎ ",
desc = "Browse Repo",
padding = 1,
key = "b",
action = function()
Snacks.gitbrowse()
end,
},
function()
local in_git = Snacks.git.get_root() ~= nil
local cmds = {
{
title = "Notifications",
cmd = "gh notify -s -a -n5",
action = function()
vim.ui.open("https://github.com/notifications")
end,
key = "n",
icon = "๏ณ ",
height = 5,
enabled = true,
},
{
title = "Open Issues",
cmd = "gh issue list -L 3",
key = "i",
action = function()
vim.fn.jobstart("gh issue list --web", { detach = true })
end,
icon = "๏ ",
height = 7,
},
{
icon = "๏ ",
title = "Open PRs",
cmd = "gh pr list -L 3",
key = "P",
action = function()
vim.fn.jobstart("gh pr list --web", { detach = true })
end,
height = 7,
},
{
icon = "๎ฅ ",
title = "Git Status",
cmd = "git --no-pager diff --stat -B -M -C",
height = 10,
},
}
return vim.tbl_map(function(cmd)
return vim.tbl_extend("force", {
pane = 2,
section = "terminal",
enabled = in_git,
padding = 1,
ttl = 5 * 60,
indent = 3,
}, cmd)
end, cmds)
end,
{ section = "startup" },
},
}
```
### `pokemon`
Pokemons, because why not?

```lua
{
sections = {
{ section = "header" },
{ section = "keys", gap = 1, padding = 1 },
{ section = "startup" },
{
section = "terminal",
cmd = "pokemon-colorscripts -r --no-title; sleep .1",
random = 10,
pane = 2,
indent = 4,
height = 30,
},
},
}
```
### `startify`
Similar to the Vim Startify dashboard

```lua
{
formats = {
key = function(item)
return { { "[", hl = "special" }, { item.key, hl = "key" }, { "]", hl = "special" } }
end,
},
sections = {
{ section = "terminal", cmd = "fortune -s | cowsay", hl = "header", padding = 1, indent = 8 },
{ title = "MRU", padding = 1 },
{ section = "recent_files", limit = 8, padding = 1 },
{ title = "MRU ", file = vim.fn.fnamemodify(".", ":~"), padding = 1 },
{ section = "recent_files", cwd = true, limit = 8, padding = 1 },
{ title = "Sessions", padding = 1 },
{ section = "projects", padding = 1 },
{ title = "Bookmarks", padding = 1 },
{ section = "keys" },
},
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `dashboard`
The default style for the dashboard.
When opening the dashboard during startup, only the `bo` and `wo` options are used.
The other options are used with `:lua Snacks.dashboard()`
```lua
{
zindex = 10,
height = 0,
width = 0,
bo = {
bufhidden = "wipe",
buftype = "nofile",
buflisted = false,
filetype = "snacks_dashboard",
swapfile = false,
undofile = false,
},
wo = {
colorcolumn = "",
cursorcolumn = false,
cursorline = false,
foldmethod = "manual",
list = false,
number = false,
relativenumber = false,
sidescrolloff = 0,
signcolumn = "no",
spell = false,
statuscolumn = "",
statusline = "",
winbar = "",
winhighlight = "Normal:SnacksDashboardNormal,NormalFloat:SnacksDashboardNormal",
wrap = false,
},
}
```
## ๐ Types
```lua
---@class snacks.dashboard.Item
---@field indent? number
---@field align? "left" | "center" | "right"
---@field gap? number the number of empty lines between child items
---@field padding? number | {[1]:number, [2]:number} bottom or {bottom, top} padding
--- The action to run when the section is selected or the key is pressed.
--- * if it's a string starting with `:`, it will be run as a command
--- * if it's a string, it will be executed as a keymap
--- * if it's a function, it will be called
---@field action? snacks.dashboard.Action
---@field enabled? boolean|fun(opts:snacks.dashboard.Opts):boolean if false, the section will be disabled
---@field section? string the name of a section to include. See `Snacks.dashboard.sections`
---@field [string] any section options
---@field key? string shortcut key
---@field hidden? boolean when `true`, the item will not be shown, but the key will still be assigned
---@field autokey? boolean automatically assign a numerical key
---@field label? string
---@field desc? string
---@field file? string
---@field footer? string
---@field header? string
---@field icon? string
---@field title? string
---@field text? string|snacks.dashboard.Text[]
```
```lua
---@alias snacks.dashboard.Format.ctx {width?:number}
---@alias snacks.dashboard.Action string|fun(self:snacks.dashboard.Class)
---@alias snacks.dashboard.Gen fun(self:snacks.dashboard.Class):snacks.dashboard.Section?
---@alias snacks.dashboard.Section snacks.dashboard.Item|snacks.dashboard.Gen|snacks.dashboard.Section[]
```
```lua
---@class snacks.dashboard.Text
---@field [1] string the text
---@field hl? string the highlight group
---@field width? number the width used for alignment
---@field align? "left" | "center" | "right"
```
```lua
---@class snacks.dashboard.Opts: snacks.dashboard.Config
---@field buf? number the buffer to use. If not provided, a new buffer will be created
---@field win? number the window to use. If not provided, a new floating window will be created
```
## ๐ฆ Module
### `Snacks.dashboard()`
```lua
---@type fun(opts?: snacks.dashboard.Opts): snacks.dashboard.Class
Snacks.dashboard()
```
### `Snacks.dashboard.have_plugin()`
Checks if the plugin is installed.
Only works with [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
---@param name string
Snacks.dashboard.have_plugin(name)
```
### `Snacks.dashboard.health()`
```lua
Snacks.dashboard.health()
```
### `Snacks.dashboard.icon()`
Get an icon
```lua
---@param name string
---@param cat? string
---@return snacks.dashboard.Text
Snacks.dashboard.icon(name, cat)
```
### `Snacks.dashboard.oldfiles()`
```lua
---@param opts? {filter?: table<string, boolean>}
---@return fun():string?
Snacks.dashboard.oldfiles(opts)
```
### `Snacks.dashboard.open()`
```lua
---@param opts? snacks.dashboard.Opts
---@return snacks.dashboard.Class
Snacks.dashboard.open(opts)
```
### `Snacks.dashboard.pick()`
Used by the default preset to pick something
```lua
---@param cmd? string
Snacks.dashboard.pick(cmd, opts)
```
### `Snacks.dashboard.sections.header()`
```lua
---@return snacks.dashboard.Gen
Snacks.dashboard.sections.header()
```
### `Snacks.dashboard.sections.keys()`
```lua
---@return snacks.dashboard.Gen
Snacks.dashboard.sections.keys()
```
### `Snacks.dashboard.sections.projects()`
Get the most recent projects based on git roots of recent files.
The default action will change the directory to the project root,
try to restore the session and open the picker if the session is not restored.
You can customize the behavior by providing a custom action.
Use `opts.dirs` to provide a list of directories to use instead of the git roots.
```lua
---@param opts? {limit?:number, dirs?:(string[]|fun():string[]), pick?:boolean, session?:boolean, action?:fun(dir)}
Snacks.dashboard.sections.projects(opts)
```
### `Snacks.dashboard.sections.recent_files()`
Get the most recent files, optionally filtered by the
current working directory or a custom directory.
```lua
---@param opts? {limit?:number, cwd?:string|boolean, filter?:fun(file:string):boolean?}
---@return snacks.dashboard.Gen
Snacks.dashboard.sections.recent_files(opts)
```
### `Snacks.dashboard.sections.session()`
Adds a section to restore the session if any of the supported plugins are installed.
```lua
---@param item? snacks.dashboard.Item
---@return snacks.dashboard.Item?
Snacks.dashboard.sections.session(item)
```
### `Snacks.dashboard.sections.startup()`
Add the startup section
```lua
---@param opts? {icon?:string}
---@return snacks.dashboard.Section?
Snacks.dashboard.sections.startup(opts)
```
### `Snacks.dashboard.sections.terminal()`
```lua
---@param opts {cmd:string|string[], ttl?:number, height?:number, width?:number, random?:number}|snacks.dashboard.Item
---@return snacks.dashboard.Gen
Snacks.dashboard.sections.terminal(opts)
```
### `Snacks.dashboard.setup()`
Check if the dashboard should be opened
```lua
Snacks.dashboard.setup()
```
### `Snacks.dashboard.update()`
Update the dashboard
```lua
Snacks.dashboard.update()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/dashboard.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 17820
} |
# ๐ฟ debug
Utility functions you can use in your code.
Personally, I have the code below at the top of my `init.lua`:
```lua
_G.dd = function(...)
Snacks.debug.inspect(...)
end
_G.bt = function()
Snacks.debug.backtrace()
end
vim.print = _G.dd
```
What this does:
- Add a global `dd(...)` you can use anywhere to quickly show a
notification with a pretty printed dump of the object(s)
with lua treesitter highlighting
- Add a global `bt()` to show a notification with a pretty
backtrace.
- Override Neovim's `vim.print`, which is also used by `:= {something = 123}`

<!-- docgen -->
## ๐ Types
```lua
---@class snacks.debug.cmd
---@field cmd string|string[]
---@field level? snacks.notifier.level
---@field title? string
---@field args? string[]
---@field cwd? string
---@field group? boolean
---@field notify? boolean
---@field footer? string
---@field header? string
---@field props? table<string, string>
```
```lua
---@alias snacks.debug.Trace {name: string, time: number, [number]:snacks.debug.Trace}
---@alias snacks.debug.Stat {name:string, time:number, count?:number, depth?:number}
```
## ๐ฆ Module
### `Snacks.debug()`
```lua
---@type fun(...)
Snacks.debug()
```
### `Snacks.debug.backtrace()`
Show a notification with a pretty backtrace
```lua
---@param msg? string|string[]
---@param opts? snacks.notify.Opts
Snacks.debug.backtrace(msg, opts)
```
### `Snacks.debug.cmd()`
```lua
---@param opts snacks.debug.cmd
Snacks.debug.cmd(opts)
```
### `Snacks.debug.inspect()`
Show a notification with a pretty printed dump of the object(s)
with lua treesitter highlighting and the location of the caller
```lua
Snacks.debug.inspect(...)
```
### `Snacks.debug.log()`
Log a message to the file `./debug.log`.
- a timestamp will be added to every message.
- accepts multiple arguments and pretty prints them.
- if the argument is not a string, it will be printed using `vim.inspect`.
- if the message is smaller than 120 characters, it will be printed on a single line.
```lua
Snacks.debug.log("Hello", { foo = "bar" }, 42)
-- 2024-11-08 08:56:52 Hello { foo = "bar" } 42
```
```lua
Snacks.debug.log(...)
```
### `Snacks.debug.metrics()`
```lua
Snacks.debug.metrics()
```
### `Snacks.debug.profile()`
Very simple function to profile a lua function.
* **flush**: set to `true` to use `jit.flush` in every iteration.
* **count**: defaults to 100
```lua
---@param fn fun()
---@param opts? {count?: number, flush?: boolean, title?: string}
Snacks.debug.profile(fn, opts)
```
### `Snacks.debug.run()`
Run the current buffer or a range of lines.
Shows the output of `print` inlined with the code.
Any error will be shown as a diagnostic.
```lua
---@param opts? {name?:string, buf?:number, print?:boolean}
Snacks.debug.run(opts)
```
### `Snacks.debug.size()`
```lua
Snacks.debug.size(bytes)
```
### `Snacks.debug.stats()`
```lua
---@param opts? {min?: number, show?:boolean}
---@return {summary:table<string, snacks.debug.Stat>, trace:snacks.debug.Stat[], traces:snacks.debug.Trace[]}
Snacks.debug.stats(opts)
```
### `Snacks.debug.trace()`
```lua
---@param name string?
Snacks.debug.trace(name)
```
### `Snacks.debug.tracemod()`
```lua
---@param modname string
---@param mod? table
---@param suffix? string
Snacks.debug.tracemod(modname, mod, suffix)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/debug.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/debug.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3385
} |
# ๐ฟ dim
Focus on the active scope by dimming the rest.
Similar plugins:
- [twilight.nvim](https://github.com/folke/twilight.nvim)
- [limelight.vim](https://github.com/junegunn/limelight.vim)
- [goyo.vim](https://github.com/junegunn/goyo.vim)

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
dim = {
-- your dim configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.dim.Config
{
---@type snacks.scope.Config
scope = {
min_size = 5,
max_size = 20,
siblings = true,
},
-- animate scopes. Enabled by default for Neovim >= 0.10
-- Works on older versions but has to trigger redraws during animation.
---@type snacks.animate.Config|{enabled?: boolean}
animate = {
enabled = vim.fn.has("nvim-0.10") == 1,
easing = "outQuad",
duration = {
step = 20, -- ms per step
total = 300, -- maximum duration
},
},
-- what buffers to dim
filter = function(buf)
return vim.g.snacks_dim ~= false and vim.b[buf].snacks_dim ~= false and vim.bo[buf].buftype == ""
end,
}
```
## ๐ฆ Module
### `Snacks.dim()`
```lua
---@type fun(opts: snacks.dim.Config)
Snacks.dim()
```
### `Snacks.dim.disable()`
Disable dimming
```lua
Snacks.dim.disable()
```
### `Snacks.dim.enable()`
```lua
---@param opts? snacks.dim.Config
Snacks.dim.enable(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/dim.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/dim.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 1585
} |
# ๐ฟ explorer
A file explorer for snacks. This is actually a [picker](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#explorer) in disguise.
This module provide a shortcut to open the explorer picker and
a setup function to replace netrw with the explorer.
When the explorer and `replace_netrw` is enabled, the explorer will be opened:
- when you start `nvim` with a directory
- when you open a directory in vim
Configuring the explorer picker is done with the [picker options](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#explorer).
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
explorer = {
-- your explorer configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
picker = {
sources = {
explorer = {
-- your explorer picker configuration comes here
-- or leave it empty to use the default settings
}
}
}
}
}
```

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
explorer = {
-- your explorer configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
These are just the general explorer settings.
To configure the explorer picker, see `snacks.picker.explorer.Config`
```lua
---@class snacks.explorer.Config
{
replace_netrw = true, -- Replace netrw with the snacks explorer
}
```
## ๐ฆ Module
### `Snacks.explorer()`
```lua
---@type fun(opts?: snacks.picker.explorer.Config): snacks.Picker
Snacks.explorer()
```
### `Snacks.explorer.open()`
Shortcut to open the explorer picker
```lua
---@param opts? snacks.picker.explorer.Config|{}
Snacks.explorer.open(opts)
```
### `Snacks.explorer.reveal()`
Reveals the given file/buffer or the current buffer in the explorer
```lua
---@param opts? {file?:string, buf?:number}
Snacks.explorer.reveal(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/explorer.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/explorer.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 2143
} |
# ๐ฟ git
<!-- docgen -->
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `blame_line`
```lua
{
width = 0.6,
height = 0.6,
border = "rounded",
title = " Git Blame ",
title_pos = "center",
ft = "git",
}
```
## ๐ฆ Module
### `Snacks.git.blame_line()`
Show git log for the current line.
```lua
---@param opts? snacks.terminal.Opts | {count?: number}
Snacks.git.blame_line(opts)
```
### `Snacks.git.get_root()`
Gets the git root for a buffer or path.
Defaults to the current buffer.
```lua
---@param path? number|string buffer or path
---@return string?
Snacks.git.get_root(path)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/git.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/git.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 709
} |
# ๐ฟ gitbrowse
Open the repo of the active file in the browser (e.g., GitHub)
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
gitbrowse = {
-- your gitbrowse configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.gitbrowse.Config
---@field url_patterns? table<string, table<string, string|fun(fields:snacks.gitbrowse.Fields):string>>
{
notify = true, -- show notification on open
-- Handler to open the url in a browser
---@param url string
open = function(url)
if vim.fn.has("nvim-0.10") == 0 then
require("lazy.util").open(url, { system = true })
return
end
vim.ui.open(url)
end,
---@type "repo" | "branch" | "file" | "commit" | "permalink"
what = "commit", -- what to open. not all remotes support all types
branch = nil, ---@type string?
line_start = nil, ---@type number?
line_end = nil, ---@type number?
-- patterns to transform remotes to an actual URL
remote_patterns = {
{ "^(https?://.*)%.git$" , "%1" },
{ "^git@(.+):(.+)%.git$" , "https://%1/%2" },
{ "^git@(.+):(.+)$" , "https://%1/%2" },
{ "^git@(.+)/(.+)$" , "https://%1/%2" },
{ "^org%-%d+@(.+):(.+)%.git$" , "https://%1/%2" },
{ "^ssh://git@(.*)$" , "https://%1" },
{ "^ssh://([^:/]+)(:%d+)/(.*)$" , "https://%1/%3" },
{ "^ssh://([^/]+)/(.*)$" , "https://%1/%2" },
{ "ssh%.dev%.azure%.com/v3/(.*)/(.*)$", "dev.azure.com/%1/_git/%2" },
{ "^https://%w*@(.*)" , "https://%1" },
{ "^git@(.*)" , "https://%1" },
{ ":%d+" , "" },
{ "%.git$" , "" },
},
url_patterns = {
["github%.com"] = {
branch = "/tree/{branch}",
file = "/blob/{branch}/{file}#L{line_start}-L{line_end}",
permalink = "/blob/{commit}/{file}#L{line_start}-L{line_end}",
commit = "/commit/{commit}",
},
["gitlab%.com"] = {
branch = "/-/tree/{branch}",
file = "/-/blob/{branch}/{file}#L{line_start}-L{line_end}",
permalink = "/-/blob/{commit}/{file}#L{line_start}-L{line_end}",
commit = "/-/commit/{commit}",
},
["bitbucket%.org"] = {
branch = "/src/{branch}",
file = "/src/{branch}/{file}#lines-{line_start}-L{line_end}",
permalink = "/src/{commit}/{file}#lines-{line_start}-L{line_end}",
commit = "/commits/{commit}",
},
["git.sr.ht"] = {
branch = "/tree/{branch}",
file = "/tree/{branch}/item/{file}",
permalink = "/tree/{commit}/item/{file}#L{line_start}",
commit = "/commit/{commit}",
},
},
}
```
## ๐ Types
```lua
---@class snacks.gitbrowse.Fields
---@field branch? string
---@field file? string
---@field line_start? number
---@field line_end? number
---@field commit? string
---@field line_count? number
```
## ๐ฆ Module
### `Snacks.gitbrowse()`
```lua
---@type fun(opts?: snacks.gitbrowse.Config)
Snacks.gitbrowse()
```
### `Snacks.gitbrowse.get_url()`
```lua
---@param repo string
---@param fields snacks.gitbrowse.Fields
---@param opts? snacks.gitbrowse.Config
Snacks.gitbrowse.get_url(repo, fields, opts)
```
### `Snacks.gitbrowse.open()`
```lua
---@param opts? snacks.gitbrowse.Config
Snacks.gitbrowse.open(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/gitbrowse.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/gitbrowse.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3502
} |
# ๐ฟ health
<!-- docgen -->
## ๐ Types
```lua
---@class snacks.health.Tool
---@field cmd string|string[]
---@field version? string|false
---@field enabled? boolean
```
```lua
---@alias snacks.health.Tool.spec (string|snacks.health.Tool)[]|snacks.health.Tool|string
```
## ๐ฆ Module
```lua
---@class snacks.health
---@field ok fun(msg: string)
---@field warn fun(msg: string)
---@field error fun(msg: string)
---@field info fun(msg: string)
---@field start fun(msg: string)
Snacks.health = {}
```
### `Snacks.health.check()`
```lua
Snacks.health.check()
```
### `Snacks.health.has_lang()`
Check if the given languages are available in treesitter
```lua
---@param langs string[]|string
Snacks.health.has_lang(langs)
```
### `Snacks.health.have_tool()`
Check if any of the tools are available, with an optional version check
```lua
---@param tools snacks.health.Tool.spec
Snacks.health.have_tool(tools)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/health.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/health.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 915
} |
# ๐ฟ image

## โจ Features
- Image viewer using the [Kitty Graphics Protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/).
- open images in a wide range of formats:
`pdf`, `png`, `jpg`, `jpeg`, `gif`, `bmp`, `webp`, `tiff`, `heic`, `avif`, `mp4`, `mov`, `avi`, `mkv`, `webm`
- Supports inline image rendering in:
`markdown`, `html`, `norg`, `tsx`, `javascript`, `css`, `vue`, `svelte`, `scss`, `latex`, `typst`
- LaTex math expressions in `markdown` and `latex` documents
Terminal support:
- [kitty](https://sw.kovidgoyal.net/kitty/)
- [ghostty](https://ghostty.org/)
- [wezterm](https://wezfurlong.org/wezterm/)
Wezterm has only limited support for the kitty graphics protocol.
Inline image rendering is not supported.
- [tmux](https://github.com/tmux/tmux)
Snacks automatically tries to enable `allow-passthrough=on` for tmux,
but you may need to enable it manually in your tmux configuration.
- [zellij](https://github.com/zellij-org/zellij) is **not** supported,
since they don't have any support for passthrough
Image will be transferred to the terminal by filename or by sending the image
date in case `ssh` is detected.
In some cases you may need to force snacks to detect or not detect a certain
environment. You can do this by setting `SNACKS_${ENV_NAME}` to `true` or `false`.
For example, to force detection of **ghostty** you can set `SNACKS_GHOSTTY=true`.
In order to automatically display the image when opening an image file,
or to have imaged displayed in supported document formats like `markdown` or `html`,
you need to enable the `image` plugin in your `snacks` config.
[ImageMagick](https://imagemagick.org/index.php) is required to convert images
to the supported formats (all except PNG).
In case of issues, make sure to run `:checkhealth snacks`.
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
image = {
-- your image configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.image.Config
---@field enabled? boolean enable image viewer
---@field wo? vim.wo|{} options for windows showing the image
---@field bo? vim.bo|{} options for the image buffer
---@field formats? string[]
--- Resolves a reference to an image with src in a file (currently markdown only).
--- Return the absolute path or url to the image.
--- When `nil`, the path is resolved relative to the file.
---@field resolve? fun(file: string, src: string): string?
---@field convert? snacks.image.convert.Config
{
formats = {
"png",
"jpg",
"jpeg",
"gif",
"bmp",
"webp",
"tiff",
"heic",
"avif",
"mp4",
"mov",
"avi",
"mkv",
"webm",
"pdf",
},
force = false, -- try displaying the image, even if the terminal does not support it
doc = {
-- enable image viewer for documents
-- a treesitter parser must be available for the enabled languages.
enabled = true,
-- render the image inline in the buffer
-- if your env doesn't support unicode placeholders, this will be disabled
-- takes precedence over `opts.float` on supported terminals
inline = true,
-- render the image in a floating window
-- only used if `opts.inline` is disabled
float = true,
max_width = 80,
max_height = 40,
-- Set to `true`, to conceal the image text when rendering inline.
conceal = false, -- (experimental)
},
img_dirs = { "img", "images", "assets", "static", "public", "media", "attachments" },
-- window options applied to windows displaying image buffers
-- an image buffer is a buffer with `filetype=image`
wo = {
wrap = false,
number = false,
relativenumber = false,
cursorcolumn = false,
signcolumn = "no",
foldcolumn = "0",
list = false,
spell = false,
statuscolumn = "",
},
cache = vim.fn.stdpath("cache") .. "/snacks/image",
debug = {
request = false,
convert = false,
placement = false,
},
env = {},
---@class snacks.image.convert.Config
convert = {
notify = true, -- show a notification on error
---@type snacks.image.args
mermaid = function()
local theme = vim.o.background == "light" and "neutral" or "dark"
return { "-i", "{src}", "-o", "{file}", "-b", "transparent", "-t", theme, "-s", "{scale}" }
end,
---@type table<string,snacks.image.args>
magick = {
default = { "{src}[0]", "-scale", "1920x1080>" }, -- default for raster images
vector = { "-density", 192, "{src}[0]" }, -- used by vector images like svg
math = { "-density", 192, "{src}[0]", "-trim" },
pdf = { "-density", 192, "{src}[0]", "-background", "white", "-alpha", "remove", "-trim" },
},
},
math = {
enabled = true, -- enable math expression rendering
-- in the templates below, `${header}` comes from any section in your document,
-- between a start/end header comment. Comment syntax is language-specific.
-- * start comment: `// snacks: header start`
-- * end comment: `// snacks: header end`
typst = {
tpl = [[
#set page(width: auto, height: auto, margin: (x: 2pt, y: 2pt))
#show math.equation.where(block: false): set text(top-edge: "bounds", bottom-edge: "bounds")
#set text(size: 12pt, fill: rgb("${color}"))
${header}
${content}]],
},
latex = {
font_size = "Large", -- see https://www.sascha-frank.com/latex-font-size.html
-- for latex documents, the doc packages are included automatically,
-- but you can add more packages here. Useful for markdown documents.
packages = { "amsmath", "amssymb", "amsfonts", "amscd", "mathtools" },
tpl = [[
\documentclass[preview,border=2pt,varwidth,12pt]{standalone}
\usepackage{${packages}}
\begin{document}
${header}
{ \${font_size} \selectfont
\color[HTML]{${color}}
${content}}
\end{document}]],
},
},
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `snacks_image`
```lua
{
relative = "cursor",
border = "rounded",
focusable = false,
backdrop = false,
row = 1,
col = 1,
-- width/height are automatically set by the image size unless specified below
}
```
## ๐ Types
```lua
---@alias snacks.image.Size {width: number, height: number}
---@alias snacks.image.Pos {[1]: number, [2]: number}
---@alias snacks.image.Loc snacks.image.Pos|snacks.image.Size|{zindex?: number}
```
```lua
---@class snacks.image.Env
---@field name string
---@field env table<string, string|true>
---@field supported? boolean default: false
---@field placeholders? boolean default: false
---@field setup? fun(): boolean?
---@field transform? fun(data: string): string
---@field detected? boolean
---@field remote? boolean this is a remote client, so full transfer of the image data is required
```
```lua
---@class snacks.image.Opts
---@field pos? snacks.image.Pos (row, col) (1,0)-indexed. defaults to the top-left corner
---@field range? Range4
---@field inline? boolean render the image inline in the buffer
---@field width? number
---@field min_width? number
---@field max_width? number
---@field height? number
---@field min_height? number
---@field max_height? number
---@field on_update? fun(placement: snacks.image.Placement)
---@field on_update_pre? fun(placement: snacks.image.Placement)
```
## ๐ฆ Module
```lua
---@class snacks.image
---@field terminal snacks.image.terminal
---@field image snacks.Image
---@field placement snacks.image.Placement
---@field util snacks.image.util
---@field buf snacks.image.buf
---@field doc snacks.image.doc
---@field convert snacks.image.convert
Snacks.image = {}
```
### `Snacks.image.hover()`
Show the image at the cursor in a floating window
```lua
Snacks.image.hover()
```
### `Snacks.image.langs()`
```lua
---@return string[]
Snacks.image.langs()
```
### `Snacks.image.supports()`
Check if the file format is supported and the terminal supports the kitty graphics protocol
```lua
---@param file string
Snacks.image.supports(file)
```
### `Snacks.image.supports_file()`
Check if the file format is supported
```lua
---@param file string
Snacks.image.supports_file(file)
```
### `Snacks.image.supports_terminal()`
Check if the terminal supports the kitty graphics protocol
```lua
Snacks.image.supports_terminal()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/image.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/image.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 8643
} |
# ๐ฟ indent
Visualize indent guides and scopes based on treesitter or indent.
Similar plugins:
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
- [mini.indentscope](https://github.com/echasnovski/mini.indentscope)

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
indent = {
-- your indent configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.indent.Config
---@field enabled? boolean
{
indent = {
priority = 1,
enabled = true, -- enable indent guides
char = "โ",
only_scope = false, -- only show indent guides of the scope
only_current = false, -- only show indent guides in the current window
hl = "SnacksIndent", ---@type string|string[] hl groups for indent guides
-- can be a list of hl groups to cycle through
-- hl = {
-- "SnacksIndent1",
-- "SnacksIndent2",
-- "SnacksIndent3",
-- "SnacksIndent4",
-- "SnacksIndent5",
-- "SnacksIndent6",
-- "SnacksIndent7",
-- "SnacksIndent8",
-- },
},
-- animate scopes. Enabled by default for Neovim >= 0.10
-- Works on older versions but has to trigger redraws during animation.
---@class snacks.indent.animate: snacks.animate.Config
---@field enabled? boolean
--- * out: animate outwards from the cursor
--- * up: animate upwards from the cursor
--- * down: animate downwards from the cursor
--- * up_down: animate up or down based on the cursor position
---@field style? "out"|"up_down"|"down"|"up"
animate = {
enabled = vim.fn.has("nvim-0.10") == 1,
style = "out",
easing = "linear",
duration = {
step = 20, -- ms per step
total = 500, -- maximum duration
},
},
---@class snacks.indent.Scope.Config: snacks.scope.Config
scope = {
enabled = true, -- enable highlighting the current scope
priority = 200,
char = "โ",
underline = false, -- underline the start of the scope
only_current = false, -- only show scope in the current window
hl = "SnacksIndentScope", ---@type string|string[] hl group for scopes
},
chunk = {
-- when enabled, scopes will be rendered as chunks, except for the
-- top-level scope which will be rendered as a scope.
enabled = false,
-- only show chunk scopes in the current window
only_current = false,
priority = 200,
hl = "SnacksIndentChunk", ---@type string|string[] hl group for chunk scopes
char = {
corner_top = "โ",
corner_bottom = "โ",
-- corner_top = "โญ",
-- corner_bottom = "โฐ",
horizontal = "โ",
vertical = "โ",
arrow = ">",
},
},
-- filter for buffers to enable indent guides
filter = function(buf)
return vim.g.snacks_indent ~= false and vim.b[buf].snacks_indent ~= false and vim.bo[buf].buftype == ""
end,
}
```
## ๐ Types
```lua
---@class snacks.indent.Scope: snacks.scope.Scope
---@field win number
---@field step? number
---@field animate? {from: number, to: number}
```
## ๐ฆ Module
### `Snacks.indent.disable()`
Disable indent guides
```lua
Snacks.indent.disable()
```
### `Snacks.indent.enable()`
Enable indent guides
```lua
Snacks.indent.enable()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/indent.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/indent.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3457
} |
# ๐ฟ init
<!-- docgen -->
## โ๏ธ Config
```lua
---@class snacks.Config
---@field animate? snacks.animate.Config
---@field bigfile? snacks.bigfile.Config
---@field dashboard? snacks.dashboard.Config
---@field dim? snacks.dim.Config
---@field explorer? snacks.explorer.Config
---@field gitbrowse? snacks.gitbrowse.Config
---@field image? snacks.image.Config
---@field indent? snacks.indent.Config
---@field input? snacks.input.Config
---@field layout? snacks.layout.Config
---@field lazygit? snacks.lazygit.Config
---@field notifier? snacks.notifier.Config
---@field picker? snacks.picker.Config
---@field profiler? snacks.profiler.Config
---@field quickfile? snacks.quickfile.Config
---@field scope? snacks.scope.Config
---@field scratch? snacks.scratch.Config
---@field scroll? snacks.scroll.Config
---@field statuscolumn? snacks.statuscolumn.Config
---@field terminal? snacks.terminal.Config
---@field toggle? snacks.toggle.Config
---@field win? snacks.win.Config
---@field words? snacks.words.Config
---@field zen? snacks.zen.Config
---@field styles? table<string, snacks.win.Config>
---@field image? snacks.image.Config|{}
{
image = {
-- define these here, so that we don't need to load the image module
formats = {
"png",
"jpg",
"jpeg",
"gif",
"bmp",
"webp",
"tiff",
"heic",
"avif",
"mp4",
"mov",
"avi",
"mkv",
"webm",
"pdf",
},
},
}
```
## ๐ Types
```lua
---@class snacks.Config.base
---@field example? string
---@field config? fun(opts: table, defaults: table)
```
## ๐ฆ Module
```lua
---@class Snacks
---@field animate snacks.animate
---@field bigfile snacks.bigfile
---@field bufdelete snacks.bufdelete
---@field dashboard snacks.dashboard
---@field debug snacks.debug
---@field dim snacks.dim
---@field explorer snacks.explorer
---@field git snacks.git
---@field gitbrowse snacks.gitbrowse
---@field health snacks.health
---@field image snacks.image
---@field indent snacks.indent
---@field input snacks.input
---@field layout snacks.layout
---@field lazygit snacks.lazygit
---@field meta snacks.meta
---@field notifier snacks.notifier
---@field notify snacks.notify
---@field picker snacks.picker
---@field profiler snacks.profiler
---@field quickfile snacks.quickfile
---@field rename snacks.rename
---@field scope snacks.scope
---@field scratch snacks.scratch
---@field scroll snacks.scroll
---@field statuscolumn snacks.statuscolumn
---@field terminal snacks.terminal
---@field toggle snacks.toggle
---@field util snacks.util
---@field win snacks.win
---@field words snacks.words
---@field zen snacks.zen
Snacks = {}
```
### `Snacks.init.config.example()`
Get an example config from the docs/examples directory.
```lua
---@param snack string
---@param name string
---@param opts? table
Snacks.init.config.example(snack, name, opts)
```
### `Snacks.init.config.get()`
```lua
---@generic T: table
---@param snack string
---@param defaults T
---@param ... T[]
---@return T
Snacks.init.config.get(snack, defaults, ...)
```
### `Snacks.init.config.merge()`
Merges the values similar to vim.tbl_deep_extend with the **force** behavior,
but the values can be any type
```lua
---@generic T
---@param ... T
---@return T
Snacks.init.config.merge(...)
```
### `Snacks.init.config.style()`
Register a new window style config.
```lua
---@param name string
---@param defaults snacks.win.Config|{}
---@return string
Snacks.init.config.style(name, defaults)
```
### `Snacks.init.setup()`
```lua
---@param opts snacks.Config?
Snacks.init.setup(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/init.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/init.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3572
} |
# ๐ฟ input
Better `vim.ui.input`.

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
input = {
-- your input configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.input.Config
---@field enabled? boolean
---@field win? snacks.win.Config|{}
---@field icon? string
---@field icon_pos? snacks.input.Pos
---@field prompt_pos? snacks.input.Pos
{
icon = "๏ ",
icon_hl = "SnacksInputIcon",
icon_pos = "left",
prompt_pos = "title",
win = { style = "input" },
expand = true,
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `input`
```lua
{
backdrop = false,
position = "float",
border = "rounded",
title_pos = "center",
height = 1,
width = 60,
relative = "editor",
noautocmd = true,
row = 2,
-- relative = "cursor",
-- row = -3,
-- col = 0,
wo = {
winhighlight = "NormalFloat:SnacksInputNormal,FloatBorder:SnacksInputBorder,FloatTitle:SnacksInputTitle",
cursorline = false,
},
bo = {
filetype = "snacks_input",
buftype = "prompt",
},
--- buffer local variables
b = {
completion = false, -- disable blink completions in input
},
keys = {
n_esc = { "<esc>", { "cmp_close", "cancel" }, mode = "n", expr = true },
i_esc = { "<esc>", { "cmp_close", "stopinsert" }, mode = "i", expr = true },
i_cr = { "<cr>", { "cmp_accept", "confirm" }, mode = "i", expr = true },
i_tab = { "<tab>", { "cmp_select_next", "cmp" }, mode = "i", expr = true },
i_ctrl_w = { "<c-w>", "<c-s-w>", mode = "i", expr = true },
i_up = { "<up>", { "hist_up" }, mode = { "i", "n" } },
i_down = { "<down>", { "hist_down" }, mode = { "i", "n" } },
q = "cancel",
},
}
```
## ๐ Types
```lua
---@alias snacks.input.Pos "left"|"title"|false
```
```lua
---@class snacks.input.Opts: snacks.input.Config,{}
---@field prompt? string
---@field default? string
---@field completion? string
---@field highlight? fun()
```
## ๐ฆ Module
### `Snacks.input()`
```lua
---@type fun(opts: snacks.input.Opts, on_confirm: fun(value?: string)): snacks.win
Snacks.input()
```
### `Snacks.input.disable()`
```lua
Snacks.input.disable()
```
### `Snacks.input.enable()`
```lua
Snacks.input.enable()
```
### `Snacks.input.input()`
```lua
---@param opts? snacks.input.Opts
---@param on_confirm fun(value?: string)
Snacks.input.input(opts, on_confirm)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/input.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/input.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 2709
} |
# ๐ฟ layout
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
layout = {
-- your layout configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.layout.Config
---@field show? boolean show the layout on creation (default: true)
---@field wins table<string, snacks.win> windows to include in the layout
---@field layout snacks.layout.Box layout definition
---@field fullscreen? boolean open in fullscreen
---@field hidden? string[] list of windows that will be excluded from the layout (but can be toggled)
---@field on_update? fun(layout: snacks.layout)
---@field on_update_pre? fun(layout: snacks.layout)
{
layout = {
width = 0.6,
height = 0.6,
zindex = 50,
},
}
```
## ๐ Types
```lua
---@class snacks.layout.Win: snacks.win.Config,{}
---@field depth? number
---@field win string layout window name
```
```lua
---@class snacks.layout.Box: snacks.layout.Win,{}
---@field box "horizontal" | "vertical"
---@field id? number
---@field [number] snacks.layout.Win | snacks.layout.Box children
```
```lua
---@alias snacks.layout.Widget snacks.layout.Win | snacks.layout.Box
```
## ๐ฆ Module
```lua
---@class snacks.layout
---@field opts snacks.layout.Config
---@field root snacks.win
---@field wins table<string, snacks.win|{enabled?:boolean, layout?:boolean}>
---@field box_wins snacks.win[]
---@field win_opts table<string, snacks.win.Config>
---@field closed? boolean
---@field split? boolean
---@field screenpos number[]?
Snacks.layout = {}
```
### `Snacks.layout.new()`
```lua
---@param opts snacks.layout.Config
Snacks.layout.new(opts)
```
### `layout:close()`
Close the layout
```lua
---@param opts? {wins?: boolean}
layout:close(opts)
```
### `layout:each()`
```lua
---@param cb fun(widget: snacks.layout.Widget, parent?: snacks.layout.Box)
---@param opts? {wins?:boolean, boxes?:boolean, box?:snacks.layout.Box}
layout:each(cb, opts)
```
### `layout:hide()`
```lua
layout:hide()
```
### `layout:is_enabled()`
Check if the window has been used in the layout
```lua
---@param w string
layout:is_enabled(w)
```
### `layout:is_hidden()`
Check if a window is hidden
```lua
---@param win string
layout:is_hidden(win)
```
### `layout:maximize()`
Toggle fullscreen
```lua
layout:maximize()
```
### `layout:needs_layout()`
```lua
---@param win string
layout:needs_layout(win)
```
### `layout:show()`
Show the layout
```lua
layout:show()
```
### `layout:toggle()`
Toggle a window
```lua
---@param win string
---@param enable? boolean
---@param on_update? fun(enabled: boolean) called when the layout will be updated
layout:toggle(win, enable, on_update)
```
### `layout:unhide()`
```lua
layout:unhide()
```
### `layout:valid()`
Check if layout is valid (visible)
```lua
layout:valid()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/layout.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/layout.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 2930
} |
# ๐ฟ lazygit
Automatically configures lazygit with a theme generated based on your Neovim colorscheme
and integrate edit with the current neovim instance.

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
lazygit = {
-- your lazygit configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.lazygit.Config: snacks.terminal.Opts
---@field args? string[]
---@field theme? snacks.lazygit.Theme
{
-- automatically configure lazygit to use the current colorscheme
-- and integrate edit with the current neovim instance
configure = true,
-- extra configuration for lazygit that will be merged with the default
-- snacks does NOT have a full yaml parser, so if you need `"test"` to appear with the quotes
-- you need to double quote it: `"\"test\""`
config = {
os = { editPreset = "nvim-remote" },
gui = {
-- set to an empty string "" to disable icons
nerdFontsVersion = "3",
},
},
theme_path = svim.fs.normalize(vim.fn.stdpath("cache") .. "/lazygit-theme.yml"),
-- Theme for lazygit
theme = {
[241] = { fg = "Special" },
activeBorderColor = { fg = "MatchParen", bold = true },
cherryPickedCommitBgColor = { fg = "Identifier" },
cherryPickedCommitFgColor = { fg = "Function" },
defaultFgColor = { fg = "Normal" },
inactiveBorderColor = { fg = "FloatBorder" },
optionsTextColor = { fg = "Function" },
searchingActiveBorderColor = { fg = "MatchParen", bold = true },
selectedLineBgColor = { bg = "Visual" }, -- set to `default` to have no background colour
unstagedChangesColor = { fg = "DiagnosticError" },
},
win = {
style = "lazygit",
},
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `lazygit`
```lua
{}
```
## ๐ Types
```lua
---@alias snacks.lazygit.Color {fg?:string, bg?:string, bold?:boolean}
```
```lua
---@class snacks.lazygit.Theme: table<number, snacks.lazygit.Color>
---@field activeBorderColor snacks.lazygit.Color
---@field cherryPickedCommitBgColor snacks.lazygit.Color
---@field cherryPickedCommitFgColor snacks.lazygit.Color
---@field defaultFgColor snacks.lazygit.Color
---@field inactiveBorderColor snacks.lazygit.Color
---@field optionsTextColor snacks.lazygit.Color
---@field searchingActiveBorderColor snacks.lazygit.Color
---@field selectedLineBgColor snacks.lazygit.Color
---@field unstagedChangesColor snacks.lazygit.Color
```
## ๐ฆ Module
### `Snacks.lazygit()`
```lua
---@type fun(opts?: snacks.lazygit.Config): snacks.win
Snacks.lazygit()
```
### `Snacks.lazygit.log()`
Opens lazygit with the log view
```lua
---@param opts? snacks.lazygit.Config
Snacks.lazygit.log(opts)
```
### `Snacks.lazygit.log_file()`
Opens lazygit with the log of the current file
```lua
---@param opts? snacks.lazygit.Config
Snacks.lazygit.log_file(opts)
```
### `Snacks.lazygit.open()`
Opens lazygit, properly configured to use the current colorscheme
and integrate with the current neovim instance
```lua
---@param opts? snacks.lazygit.Config
Snacks.lazygit.open(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/lazygit.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/lazygit.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3462
} |
# ๐ฟ meta
Meta functions for Snacks
<!-- docgen -->
## ๐ Types
```lua
---@class snacks.meta.Meta
---@field desc string
---@field needs_setup? boolean
---@field hide? boolean
---@field readme? boolean
---@field docs? boolean
---@field health? boolean
---@field types? boolean
---@field config? boolean
---@field merge? { [string|number]: string }
```
```lua
---@class snacks.meta.Plugin
---@field name string
---@field file string
---@field meta snacks.meta.Meta
---@field health? fun()
```
## ๐ฆ Module
### `Snacks.meta.file()`
```lua
Snacks.meta.file(name)
```
### `Snacks.meta.get()`
Get the metadata for all snacks plugins
```lua
---@return snacks.meta.Plugin[]
Snacks.meta.get()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/meta.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/meta.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 695
} |
# ๐ฟ notifier

## Notification History

## ๐ก Examples
<details><summary>Replace a notification</summary>
```lua
-- to replace an existing notification just use the same id.
-- you can also use the return value of the notify function as id.
for i = 1, 10 do
vim.defer_fn(function()
vim.notify("Hello " .. i, "info", { id = "test" })
end, i * 500)
end
```
</details>
<details><summary>Simple LSP Progress</summary>
```lua
vim.api.nvim_create_autocmd("LspProgress", {
---@param ev {data: {client_id: integer, params: lsp.ProgressParams}}
callback = function(ev)
local spinner = { "โ ", "โ ", "โ น", "โ ธ", "โ ผ", "โ ด", "โ ฆ", "โ ง", "โ ", "โ " }
vim.notify(vim.lsp.status(), "info", {
id = "lsp_progress",
title = "LSP Progress",
opts = function(notif)
notif.icon = ev.data.params.value.kind == "end" and "๏ "
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
end,
})
end,
})
```
</details>
<details><summary>Advanced LSP Progress</summary>

```lua
---@type table<number, {token:lsp.ProgressToken, msg:string, done:boolean}[]>
local progress = vim.defaulttable()
vim.api.nvim_create_autocmd("LspProgress", {
---@param ev {data: {client_id: integer, params: lsp.ProgressParams}}
callback = function(ev)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
local value = ev.data.params.value --[[@as {percentage?: number, title?: string, message?: string, kind: "begin" | "report" | "end"}]]
if not client or type(value) ~= "table" then
return
end
local p = progress[client.id]
for i = 1, #p + 1 do
if i == #p + 1 or p[i].token == ev.data.params.token then
p[i] = {
token = ev.data.params.token,
msg = ("[%3d%%] %s%s"):format(
value.kind == "end" and 100 or value.percentage or 100,
value.title or "",
value.message and (" **%s**"):format(value.message) or ""
),
done = value.kind == "end",
}
break
end
end
local msg = {} ---@type string[]
progress[client.id] = vim.tbl_filter(function(v)
return table.insert(msg, v.msg) or not v.done
end, p)
local spinner = { "โ ", "โ ", "โ น", "โ ธ", "โ ผ", "โ ด", "โ ฆ", "โ ง", "โ ", "โ " }
vim.notify(table.concat(msg, "\n"), "info", {
id = "lsp_progress",
title = client.name,
opts = function(notif)
notif.icon = #progress[client.id] == 0 and "๏ "
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
end,
})
end,
})
```
</details>
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
notifier = {
-- your notifier configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.notifier.Config
---@field enabled? boolean
---@field keep? fun(notif: snacks.notifier.Notif): boolean # global keep function
---@field filter? fun(notif: snacks.notifier.Notif): boolean # filter our unwanted notifications (return false to hide)
{
timeout = 3000, -- default timeout in ms
width = { min = 40, max = 0.4 },
height = { min = 1, max = 0.6 },
-- editor margin to keep free. tabline and statusline are taken into account automatically
margin = { top = 0, right = 1, bottom = 0 },
padding = true, -- add 1 cell of left/right padding to the notification window
sort = { "level", "added" }, -- sort by level and time
-- minimum log level to display. TRACE is the lowest
-- all notifications are stored in history
level = vim.log.levels.TRACE,
icons = {
error = "๏ ",
warn = "๏ฑ ",
info = "๏ ",
debug = "๏ ",
trace = "๎ถฆ ",
},
keep = function(notif)
return vim.fn.getcmdpos() > 0
end,
---@type snacks.notifier.style
style = "compact",
top_down = true, -- place notifications from top to bottom
date_format = "%R", -- time format for notifications
-- format for footer when more lines are available
-- `%d` is replaced with the number of lines.
-- only works for styles with a border
---@type string|boolean
more_format = " โ %d lines ",
refresh = 50, -- refresh at most every 50ms
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `notification`
```lua
{
border = "rounded",
zindex = 100,
ft = "markdown",
wo = {
winblend = 5,
wrap = false,
conceallevel = 2,
colorcolumn = "",
},
bo = { filetype = "snacks_notif" },
}
```
### `notification_history`
```lua
{
border = "rounded",
zindex = 100,
width = 0.6,
height = 0.6,
minimal = false,
title = " Notification History ",
title_pos = "center",
ft = "markdown",
bo = { filetype = "snacks_notif_history", modifiable = false },
wo = { winhighlight = "Normal:SnacksNotifierHistory" },
keys = { q = "close" },
}
```
## ๐ Types
Render styles:
* compact: use border for icon and title
* minimal: no border, only icon and message
* fancy: similar to the default nvim-notify style
```lua
---@alias snacks.notifier.style snacks.notifier.render|"compact"|"fancy"|"minimal"
```
### Notifications
Notification options
```lua
---@class snacks.notifier.Notif.opts
---@field id? number|string
---@field msg? string
---@field level? number|snacks.notifier.level
---@field title? string
---@field icon? string
---@field timeout? number|boolean timeout in ms. Set to 0|false to keep until manually closed
---@field ft? string
---@field keep? fun(notif: snacks.notifier.Notif): boolean
---@field style? snacks.notifier.style
---@field opts? fun(notif: snacks.notifier.Notif) -- dynamic opts
---@field hl? snacks.notifier.hl -- highlight overrides
---@field history? boolean
```
Notification object
```lua
---@class snacks.notifier.Notif: snacks.notifier.Notif.opts
---@field id number|string
---@field msg string
---@field win? snacks.win
---@field icon string
---@field level snacks.notifier.level
---@field timeout number
---@field dirty? boolean
---@field added number timestamp with nano precision
---@field updated number timestamp with nano precision
---@field shown? number timestamp with nano precision
---@field hidden? number timestamp with nano precision
---@field layout? { top?: number, width: number, height: number }
```
### Rendering
```lua
---@alias snacks.notifier.render fun(buf: number, notif: snacks.notifier.Notif, ctx: snacks.notifier.ctx)
```
```lua
---@class snacks.notifier.hl
---@field title string
---@field icon string
---@field border string
---@field footer string
---@field msg string
```
```lua
---@class snacks.notifier.ctx
---@field opts snacks.win.Config
---@field notifier snacks.notifier.Class
---@field hl snacks.notifier.hl
---@field ns number
```
### History
```lua
---@class snacks.notifier.history
---@field filter? snacks.notifier.level|fun(notif: snacks.notifier.Notif): boolean
---@field sort? string[] # sort fields, default: {"added"}
---@field reverse? boolean
```
```lua
---@alias snacks.notifier.level "trace"|"debug"|"info"|"warn"|"error"
```
## ๐ฆ Module
### `Snacks.notifier()`
```lua
---@type fun(msg: string, level?: snacks.notifier.level|number, opts?: snacks.notifier.Notif.opts): number|string
Snacks.notifier()
```
### `Snacks.notifier.get_history()`
```lua
---@param opts? snacks.notifier.history
Snacks.notifier.get_history(opts)
```
### `Snacks.notifier.hide()`
```lua
---@param id? number|string
Snacks.notifier.hide(id)
```
### `Snacks.notifier.notify()`
```lua
---@param msg string
---@param level? snacks.notifier.level|number
---@param opts? snacks.notifier.Notif.opts
Snacks.notifier.notify(msg, level, opts)
```
### `Snacks.notifier.show_history()`
```lua
---@param opts? snacks.notifier.history
Snacks.notifier.show_history(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/notifier.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/notifier.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 8187
} |
# ๐ฟ notify
<!-- docgen -->
## ๐ Types
```lua
---@alias snacks.notify.Opts snacks.notifier.Notif.opts|{once?: boolean}
```
## ๐ฆ Module
### `Snacks.notify()`
```lua
---@type fun(msg: string|string[], opts?: snacks.notify.Opts)
Snacks.notify()
```
### `Snacks.notify.error()`
```lua
---@param msg string|string[]
---@param opts? snacks.notify.Opts
Snacks.notify.error(msg, opts)
```
### `Snacks.notify.info()`
```lua
---@param msg string|string[]
---@param opts? snacks.notify.Opts
Snacks.notify.info(msg, opts)
```
### `Snacks.notify.notify()`
```lua
---@param msg string|string[]
---@param opts? snacks.notify.Opts
Snacks.notify.notify(msg, opts)
```
### `Snacks.notify.warn()`
```lua
---@param msg string|string[]
---@param opts? snacks.notify.Opts
Snacks.notify.warn(msg, opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/notify.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/notify.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 796
} |
# ๐ฟ picker
Snacks now comes with a modern fuzzy-finder to navigate the Neovim universe.






## โจ Features
- ๐ over 40 [built-in sources](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#-sources)
- ๐ Fast and powerful fuzzy matching engine that supports the [fzf](https://junegunn.github.io/fzf/search-syntax/) search syntax
- additionally supports field searches like `file:lua$ 'function`
- `files` and `grep` additionally support adding optiont like `foo -- -e=lua`
- ๐ฒ uses **treesitter** highlighting where it makes sense
- ๐งน Sane default settings so you can start using it right away
- ๐ช Finders and matchers run asynchronously for maximum performance
- ๐ช Different [layouts](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#%EF%B8%8F-layouts) to suit your needs, or create your own.
Uses [Snacks.layout](https://github.com/folke/snacks.nvim/blob/main/docs/layout.md)
under the hood.
- ๐ป Simple API to create your own pickers
- ๐ Better `vim.ui.select`
Some acknowledgements:
- [fzf-lua](https://github.com/ibhagwan/fzf-lua)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
- [mini.pick](https://github.com/echasnovski/mini.pick)
## ๐ Usage
The best way to get started is to copy some of the [example configs](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md#-examples) below.
```lua
-- Show all pickers
Snacks.picker()
-- run files picker (all three are equivalent)
Snacks.picker.files(opts)
Snacks.picker.pick("files", opts)
Snacks.picker.pick({source = "files", ...})
```
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
picker = {
-- your picker configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.picker.Config
---@field multi? (string|snacks.picker.Config)[]
---@field source? string source name and config to use
---@field pattern? string|fun(picker:snacks.Picker):string pattern used to filter items by the matcher
---@field search? string|fun(picker:snacks.Picker):string search string used by finders
---@field cwd? string current working directory
---@field live? boolean when true, typing will trigger live searches
---@field limit? number when set, the finder will stop after finding this number of items. useful for live searches
---@field ui_select? boolean set `vim.ui.select` to a snacks picker
--- Source definition
---@field items? snacks.picker.finder.Item[] items to show instead of using a finder
---@field format? string|snacks.picker.format|string format function or preset
---@field finder? string|snacks.picker.finder|snacks.picker.finder.multi finder function or preset
---@field preview? snacks.picker.preview|string preview function or preset
---@field matcher? snacks.picker.matcher.Config|{} matcher config
---@field sort? snacks.picker.sort|snacks.picker.sort.Config sort function or config
---@field transform? string|snacks.picker.transform transform/filter function
--- UI
---@field win? snacks.picker.win.Config
---@field layout? snacks.picker.layout.Config|string|{}|fun(source:string):(snacks.picker.layout.Config|string)
---@field icons? snacks.picker.icons
---@field prompt? string prompt text / icon
---@field title? string defaults to a capitalized source name
---@field auto_close? boolean automatically close the picker when focusing another window (defaults to true)
---@field show_empty? boolean show the picker even when there are no items
---@field focus? "input"|"list" where to focus when the picker is opened (defaults to "input")
---@field enter? boolean enter the picker when opening it
---@field toggles? table<string, string|false|snacks.picker.toggle>
--- Preset options
---@field previewers? snacks.picker.previewers.Config|{}
---@field formatters? snacks.picker.formatters.Config|{}
---@field sources? snacks.picker.sources.Config|{}|table<string, snacks.picker.Config|{}>
---@field layouts? table<string, snacks.picker.layout.Config>
--- Actions
---@field actions? table<string, snacks.picker.Action.spec> actions used by keymaps
---@field confirm? snacks.picker.Action.spec shortcut for confirm action
---@field auto_confirm? boolean automatically confirm if there is only one item
---@field main? snacks.picker.main.Config main editor window config
---@field on_change? fun(picker:snacks.Picker, item?:snacks.picker.Item) called when the cursor changes
---@field on_show? fun(picker:snacks.Picker) called when the picker is shown
---@field on_close? fun(picker:snacks.Picker) called when the picker is closed
---@field jump? snacks.picker.jump.Config|{}
--- Other
---@field config? fun(opts:snacks.picker.Config):snacks.picker.Config? custom config function
---@field db? snacks.picker.db.Config|{}
---@field debug? snacks.picker.debug|{}
{
prompt = "๏
",
sources = {},
focus = "input",
layout = {
cycle = true,
--- Use the default layout or vertical if the window is too narrow
preset = function()
return vim.o.columns >= 120 and "default" or "vertical"
end,
},
---@class snacks.picker.matcher.Config
matcher = {
fuzzy = true, -- use fuzzy matching
smartcase = true, -- use smartcase
ignorecase = true, -- use ignorecase
sort_empty = false, -- sort results when the search string is empty
filename_bonus = true, -- give bonus for matching file names (last part of the path)
file_pos = true, -- support patterns like `file:line:col` and `file:line`
-- the bonusses below, possibly require string concatenation and path normalization,
-- so this can have a performance impact for large lists and increase memory usage
cwd_bonus = false, -- give bonus for matching files in the cwd
frecency = false, -- frecency bonus
history_bonus = false, -- give more weight to chronological order
},
sort = {
-- default sort is by score, text length and index
fields = { "score:desc", "#text", "idx" },
},
ui_select = true, -- replace `vim.ui.select` with the snacks picker
---@class snacks.picker.formatters.Config
formatters = {
text = {
ft = nil, ---@type string? filetype for highlighting
},
file = {
filename_first = false, -- display filename before the file path
truncate = 40, -- truncate the file path to (roughly) this length
filename_only = false, -- only show the filename
icon_width = 2, -- width of the icon (in characters)
git_status_hl = true, -- use the git status highlight group for the filename
},
selected = {
show_always = false, -- only show the selected column when there are multiple selections
unselected = true, -- use the unselected icon for unselected items
},
severity = {
icons = true, -- show severity icons
level = false, -- show severity level
---@type "left"|"right"
pos = "left", -- position of the diagnostics
},
},
---@class snacks.picker.previewers.Config
previewers = {
diff = {
builtin = true, -- use Neovim for previewing diffs (true) or use an external tool (false)
cmd = { "delta" }, -- example to show a diff with delta
},
git = {
builtin = true, -- use Neovim for previewing git output (true) or use git (false)
args = {}, -- additional arguments passed to the git command. Useful to set pager options usin `-c ...`
},
file = {
max_size = 1024 * 1024, -- 1MB
max_line_length = 500, -- max line length
ft = nil, ---@type string? filetype for highlighting. Use `nil` for auto detect
},
man_pager = nil, ---@type string? MANPAGER env to use for `man` preview
},
---@class snacks.picker.jump.Config
jump = {
jumplist = true, -- save the current position in the jumplist
tagstack = false, -- save the current position in the tagstack
reuse_win = false, -- reuse an existing window if the buffer is already open
close = true, -- close the picker when jumping/editing to a location (defaults to true)
match = false, -- jump to the first match position. (useful for `lines`)
},
toggles = {
follow = "f",
hidden = "h",
ignored = "i",
modified = "m",
regex = { icon = "R", value = false },
},
win = {
-- input window
input = {
keys = {
-- to close the picker on ESC instead of going to normal mode,
-- add the following keymap to your config
-- ["<Esc>"] = { "close", mode = { "n", "i" } },
["/"] = "toggle_focus",
["<C-Down>"] = { "history_forward", mode = { "i", "n" } },
["<C-Up>"] = { "history_back", mode = { "i", "n" } },
["<C-c>"] = { "cancel", mode = "i" },
["<C-w>"] = { "<c-s-w>", mode = { "i" }, expr = true, desc = "delete word" },
["<CR>"] = { "confirm", mode = { "n", "i" } },
["<Down>"] = { "list_down", mode = { "i", "n" } },
["<Esc>"] = "cancel",
["<S-CR>"] = { { "pick_win", "jump" }, mode = { "n", "i" } },
["<S-Tab>"] = { "select_and_prev", mode = { "i", "n" } },
["<Tab>"] = { "select_and_next", mode = { "i", "n" } },
["<Up>"] = { "list_up", mode = { "i", "n" } },
["<a-d>"] = { "inspect", mode = { "n", "i" } },
["<a-f>"] = { "toggle_follow", mode = { "i", "n" } },
["<a-h>"] = { "toggle_hidden", mode = { "i", "n" } },
["<a-i>"] = { "toggle_ignored", mode = { "i", "n" } },
["<a-m>"] = { "toggle_maximize", mode = { "i", "n" } },
["<a-p>"] = { "toggle_preview", mode = { "i", "n" } },
["<a-w>"] = { "cycle_win", mode = { "i", "n" } },
["<c-a>"] = { "select_all", mode = { "n", "i" } },
["<c-b>"] = { "preview_scroll_up", mode = { "i", "n" } },
["<c-d>"] = { "list_scroll_down", mode = { "i", "n" } },
["<c-f>"] = { "preview_scroll_down", mode = { "i", "n" } },
["<c-g>"] = { "toggle_live", mode = { "i", "n" } },
["<c-j>"] = { "list_down", mode = { "i", "n" } },
["<c-k>"] = { "list_up", mode = { "i", "n" } },
["<c-n>"] = { "list_down", mode = { "i", "n" } },
["<c-p>"] = { "list_up", mode = { "i", "n" } },
["<c-q>"] = { "qflist", mode = { "i", "n" } },
["<c-s>"] = { "edit_split", mode = { "i", "n" } },
["<c-t>"] = { "tab", mode = { "n", "i" } },
["<c-u>"] = { "list_scroll_up", mode = { "i", "n" } },
["<c-v>"] = { "edit_vsplit", mode = { "i", "n" } },
["<c-r>#"] = { "insert_alt", mode = "i" },
["<c-r>%"] = { "insert_filename", mode = "i" },
["<c-r><c-a>"] = { "insert_cWORD", mode = "i" },
["<c-r><c-f>"] = { "insert_file", mode = "i" },
["<c-r><c-l>"] = { "insert_line", mode = "i" },
["<c-r><c-p>"] = { "insert_file_full", mode = "i" },
["<c-r><c-w>"] = { "insert_cword", mode = "i" },
["<c-w>H"] = "layout_left",
["<c-w>J"] = "layout_bottom",
["<c-w>K"] = "layout_top",
["<c-w>L"] = "layout_right",
["?"] = "toggle_help_input",
["G"] = "list_bottom",
["gg"] = "list_top",
["j"] = "list_down",
["k"] = "list_up",
["q"] = "close",
},
b = {
minipairs_disable = true,
},
},
-- result list window
list = {
keys = {
["/"] = "toggle_focus",
["<2-LeftMouse>"] = "confirm",
["<CR>"] = "confirm",
["<Down>"] = "list_down",
["<Esc>"] = "cancel",
["<S-CR>"] = { { "pick_win", "jump" } },
["<S-Tab>"] = { "select_and_prev", mode = { "n", "x" } },
["<Tab>"] = { "select_and_next", mode = { "n", "x" } },
["<Up>"] = "list_up",
["<a-d>"] = "inspect",
["<a-f>"] = "toggle_follow",
["<a-h>"] = "toggle_hidden",
["<a-i>"] = "toggle_ignored",
["<a-m>"] = "toggle_maximize",
["<a-p>"] = "toggle_preview",
["<a-w>"] = "cycle_win",
["<c-a>"] = "select_all",
["<c-b>"] = "preview_scroll_up",
["<c-d>"] = "list_scroll_down",
["<c-f>"] = "preview_scroll_down",
["<c-j>"] = "list_down",
["<c-k>"] = "list_up",
["<c-n>"] = "list_down",
["<c-p>"] = "list_up",
["<c-q>"] = "qflist",
["<c-s>"] = "edit_split",
["<c-t>"] = "tab",
["<c-u>"] = "list_scroll_up",
["<c-v>"] = "edit_vsplit",
["<c-w>H"] = "layout_left",
["<c-w>J"] = "layout_bottom",
["<c-w>K"] = "layout_top",
["<c-w>L"] = "layout_right",
["?"] = "toggle_help_list",
["G"] = "list_bottom",
["gg"] = "list_top",
["i"] = "focus_input",
["j"] = "list_down",
["k"] = "list_up",
["q"] = "close",
["zb"] = "list_scroll_bottom",
["zt"] = "list_scroll_top",
["zz"] = "list_scroll_center",
},
wo = {
conceallevel = 2,
concealcursor = "nvc",
},
},
-- preview window
preview = {
keys = {
["<Esc>"] = "cancel",
["q"] = "close",
["i"] = "focus_input",
["<a-w>"] = "cycle_win",
},
},
},
---@class snacks.picker.icons
icons = {
files = {
enabled = true, -- show file icons
dir = "๓ฐ ",
dir_open = "๓ฐฐ ",
file = "๓ฐ "
},
keymaps = {
nowait = "๓ฐ
"
},
tree = {
vertical = "โ ",
middle = "โโด",
last = "โโด",
},
undo = {
saved = "๏ ",
},
ui = {
live = "๓ฐฐ ",
hidden = "h",
ignored = "i",
follow = "f",
selected = "โ ",
unselected = "โ ",
-- selected = "๏ ",
},
git = {
enabled = true, -- show git icons
commit = "๓ฐ ", -- used by git log
staged = "โ", -- staged changes. always overrides the type icons
added = "๏",
deleted = "๏ง",
ignored = "๎จ ",
modified = "โ",
renamed = "๏ก",
unmerged = "๏
ฟ ",
untracked = "?",
},
diagnostics = {
Error = "๏ ",
Warn = "๏ฑ ",
Hint = "๏ซ ",
Info = "๏ ",
},
lsp = {
unavailable = "๏ง",
enabled = "๏
",
disabled = "๏ ",
attached = "๓ฐฉ "
},
kinds = {
Array = "๎ช ",
Boolean = "๓ฐจ ",
Class = "๎ญ ",
Color = "๎ญ ",
Control = "๎ฉจ ",
Collapsed = "๏ ",
Constant = "๓ฐฟ ",
Constructor = "๏ฃ ",
Copilot = "๏ธ ",
Enum = "๏
",
EnumMember = "๏
",
Event = "๎ช ",
Field = "๏ซ ",
File = "๎ฉป ",
Folder = "๎ฟ ",
Function = "๓ฐ ",
Interface = "๏จ ",
Key = "๎ช ",
Keyword = "๎ญข ",
Method = "๓ฐ ",
Module = "๏ ",
Namespace = "๓ฐฆฎ ",
Null = "๎ ",
Number = "๓ฐ ",
Object = "๎ช ",
Operator = "๎ญค ",
Package = "๏ ",
Property = "๏ซ ",
Reference = "๎ฌถ ",
Snippet = "๓ฑฝ ",
String = "๎ชฑ ",
Struct = "๓ฐผ ",
Text = "๎ช ",
TypeParameter = "๎ช ",
Unit = "๎ช ",
Unknown = "๏จ ",
Value = "๎ช ",
Variable = "๓ฐซ ",
},
},
---@class snacks.picker.db.Config
db = {
-- path to the sqlite3 library
-- If not set, it will try to load the library by name.
-- On Windows it will download the library from the internet.
sqlite3_path = nil, ---@type string?
},
---@class snacks.picker.debug
debug = {
scores = false, -- show scores in the list
leaks = false, -- show when pickers don't get garbage collected
explorer = false, -- show explorer debug info
files = false, -- show file debug info
grep = false, -- show file debug info
proc = false, -- show proc debug info
extmarks = false, -- show extmarks errors
},
}
```
## ๐ Examples
### `flash`
```lua
{
"folke/flash.nvim",
optional = true,
specs = {
{
"folke/snacks.nvim",
opts = {
picker = {
win = {
input = {
keys = {
["<a-s>"] = { "flash", mode = { "n", "i" } },
["s"] = { "flash" },
},
},
},
actions = {
flash = function(picker)
require("flash").jump({
pattern = "^",
label = { after = { 0, 0 } },
search = {
mode = "search",
exclude = {
function(win)
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype ~= "snacks_picker_list"
end,
},
},
action = function(match)
local idx = picker.list:row2idx(match.pos[1])
picker.list:_move(idx, true, true)
end,
})
end,
},
},
},
},
},
}
```
### `general`
```lua
{
"folke/snacks.nvim",
opts = {
picker = {},
explorer = {},
},
keys = {
-- Top Pickers & Explorer
{ "<leader><space>", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
{ "<leader>n", function() Snacks.picker.notifications() end, desc = "Notification History" },
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
-- find
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
-- git
{ "<leader>gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" },
{ "<leader>gl", function() Snacks.picker.git_log() end, desc = "Git Log" },
{ "<leader>gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" },
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
{ "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" },
{ "<leader>gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" },
-- Grep
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
-- search
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
{ '<leader>s/', function() Snacks.picker.search_history() end, desc = "Search History" },
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
{ "<leader>si", function() Snacks.picker.icons() end, desc = "Icons" },
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
{ "<leader>sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" },
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
-- LSP
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
{ "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" },
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
},
}
```
### `todo_comments`
```lua
{
"folke/todo-comments.nvim",
optional = true,
keys = {
{ "<leader>st", function() Snacks.picker.todo_comments() end, desc = "Todo" },
{ "<leader>sT", function () Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end, desc = "Todo/Fix/Fixme" },
},
}
```
### `trouble`
```lua
{
"folke/trouble.nvim",
optional = true,
specs = {
"folke/snacks.nvim",
opts = function(_, opts)
return vim.tbl_deep_extend("force", opts or {}, {
picker = {
actions = require("trouble.sources.snacks").actions,
win = {
input = {
keys = {
["<c-t>"] = {
"trouble_open",
mode = { "n", "i" },
},
},
},
},
},
})
end,
},
}
```
## ๐ Types
```lua
---@class snacks.picker.jump.Action: snacks.picker.Action
---@field cmd? snacks.picker.EditCmd
```
```lua
---@class snacks.picker.layout.Action: snacks.picker.Action
---@field layout? snacks.picker.layout.Config|string
```
```lua
---@class snacks.picker.yank.Action: snacks.picker.Action
---@field reg? string
---@field field? string
---@field notify? boolean
```
```lua
---@class snacks.picker.insert.Action: snacks.picker.Action
---@field expr string
```
```lua
---@alias snacks.picker.Extmark vim.api.keyset.set_extmark|{col:number, row?:number, field?:string}
---@alias snacks.picker.Text {[1]:string, [2]:string?, virtual?:boolean, field?:string}
---@alias snacks.picker.Highlight snacks.picker.Text|snacks.picker.Extmark
---@alias snacks.picker.format fun(item:snacks.picker.Item, picker:snacks.Picker):snacks.picker.Highlight[]
---@alias snacks.picker.preview fun(ctx: snacks.picker.preview.ctx):boolean?
---@alias snacks.picker.sort fun(a:snacks.picker.Item, b:snacks.picker.Item):boolean
---@alias snacks.picker.transform fun(item:snacks.picker.finder.Item, ctx:snacks.picker.finder.ctx):(boolean|snacks.picker.finder.Item|nil)
---@alias snacks.picker.Pos {[1]:number, [2]:number}
---@alias snacks.picker.toggle {icon?:string, enabled?:boolean, value?:boolean}
```
Generic filter used by finders to pre-filter items
```lua
---@class snacks.picker.filter.Config
---@field cwd? boolean|string only show files for the given cwd
---@field buf? boolean|number only show items for the current or given buffer
---@field paths? table<string, boolean> only show items that include or exclude the given paths
---@field filter? fun(item:snacks.picker.finder.Item, filter:snacks.picker.Filter):boolean? custom filter function
---@field transform? fun(picker:snacks.Picker, filter:snacks.picker.Filter):boolean? filter transform. Return `true` to force refresh
```
This is only used when using `opts.preview = "preview"`.
It's a previewer that shows a preview based on the item data.
```lua
---@class snacks.picker.Item.preview
---@field text string text to show in the preview buffer
---@field ft? string optional filetype used tohighlight the preview buffer
---@field extmarks? snacks.picker.Extmark[] additional extmarks
---@field loc? boolean set to false to disable showing the item location in the preview
```
```lua
---@class snacks.picker.Item
---@field [string] any
---@field idx number
---@field score number
---@field frecency? number
---@field score_add? number
---@field score_mul? number
---@field source_id? number
---@field file? string
---@field text string
---@field pos? snacks.picker.Pos
---@field loc? snacks.picker.lsp.Loc
---@field end_pos? snacks.picker.Pos
---@field highlights? snacks.picker.Highlight[][]
---@field preview? snacks.picker.Item.preview
---@field resolve? fun(item:snacks.picker.Item)
```
```lua
---@class snacks.picker.finder.Item: snacks.picker.Item
---@field idx? number
---@field score? number
```
```lua
---@class snacks.picker.layout.Config
---@field layout snacks.layout.Box
---@field reverse? boolean when true, the list will be reversed (bottom-up)
---@field fullscreen? boolean open in fullscreen
---@field cycle? boolean cycle through the list
---@field preview? "main" show preview window in the picker or the main window
---@field preset? string|fun(source:string):string
---@field hidden? ("input"|"preview"|"list")[] don't show the given windows when opening the picker. (only "input" and "preview" make sense)
---@field auto_hide? ("input"|"preview"|"list")[] hide the given windows when not focused (only "input" makes real sense)
```
```lua
---@class snacks.picker.win.Config
---@field input? snacks.win.Config|{} input window config
---@field list? snacks.win.Config|{} result list window config
---@field preview? snacks.win.Config|{} preview window config
```
```lua
---@alias snacks.Picker.ref (fun():snacks.Picker?)|{value?: snacks.Picker}
```
```lua
---@class snacks.picker.Last
---@field cursor number
---@field topline number
---@field opts? snacks.picker.Config
---@field selected snacks.picker.Item[]
---@field filter snacks.picker.Filter
```
```lua
---@alias snacks.picker.history.Record {pattern: string, search: string, live?: boolean}
```
## ๐ฆ Module
```lua
---@class snacks.picker
---@field actions snacks.picker.actions
---@field config snacks.picker.config
---@field format snacks.picker.formatters
---@field preview snacks.picker.previewers
---@field sort snacks.picker.sorters
---@field util snacks.picker.util
---@field current? snacks.Picker
---@field highlight snacks.picker.highlight
---@field resume fun(opts?: snacks.picker.Config):snacks.Picker
---@field sources snacks.picker.sources.Config
Snacks.picker = {}
```
### `Snacks.picker()`
```lua
---@type fun(source: string, opts: snacks.picker.Config): snacks.Picker
Snacks.picker()
```
```lua
---@type fun(opts: snacks.picker.Config): snacks.Picker
Snacks.picker()
```
### `Snacks.picker.get()`
Get active pickers, optionally filtered by source,
or the current tab
```lua
---@param opts? {source?: string, tab?: boolean} tab defaults to true
Snacks.picker.get(opts)
```
### `Snacks.picker.pick()`
Create a new picker
```lua
---@param source? string
---@param opts? snacks.picker.Config
---@overload fun(opts: snacks.picker.Config): snacks.Picker
Snacks.picker.pick(source, opts)
```
### `Snacks.picker.select()`
Implementation for `vim.ui.select`
```lua
---@type snacks.picker.ui_select
Snacks.picker.select(...)
```
## ๐ Sources
### `autocmds`
```vim
:lua Snacks.picker.autocmds(opts?)
```
```lua
{
finder = "vim_autocmds",
format = "autocmd",
preview = "preview",
}
```
### `buffers`
```vim
:lua Snacks.picker.buffers(opts?)
```
```lua
---@class snacks.picker.buffers.Config: snacks.picker.Config
---@field hidden? boolean show hidden buffers (unlisted)
---@field unloaded? boolean show loaded buffers
---@field current? boolean show current buffer
---@field nofile? boolean show `buftype=nofile` buffers
---@field modified? boolean show only modified buffers
---@field sort_lastused? boolean sort by last used
---@field filter? snacks.picker.filter.Config
{
finder = "buffers",
format = "buffer",
hidden = false,
unloaded = true,
current = true,
sort_lastused = true,
win = {
input = {
keys = {
["<c-x>"] = { "bufdelete", mode = { "n", "i" } },
},
},
list = { keys = { ["dd"] = "bufdelete" } },
},
}
```
### `cliphist`
```vim
:lua Snacks.picker.cliphist(opts?)
```
```lua
{
finder = "system_cliphist",
format = "text",
preview = "preview",
confirm = { "copy", "close" },
}
```
### `colorschemes`
```vim
:lua Snacks.picker.colorschemes(opts?)
```
Neovim colorschemes with live preview
```lua
{
finder = "vim_colorschemes",
format = "text",
preview = "colorscheme",
preset = "vertical",
confirm = function(picker, item)
picker:close()
if item then
picker.preview.state.colorscheme = nil
vim.schedule(function()
vim.cmd("colorscheme " .. item.text)
end)
end
end,
}
```
### `command_history`
```vim
:lua Snacks.picker.command_history(opts?)
```
Neovim command history
```lua
---@type snacks.picker.history.Config
{
finder = "vim_history",
name = "cmd",
format = "text",
preview = "none",
layout = {
preset = "vscode",
},
confirm = "cmd",
formatters = { text = { ft = "vim" } },
}
```
### `commands`
```vim
:lua Snacks.picker.commands(opts?)
```
Neovim commands
```lua
{
finder = "vim_commands",
format = "command",
preview = "preview",
confirm = "cmd",
}
```
### `diagnostics`
```vim
:lua Snacks.picker.diagnostics(opts?)
```
```lua
---@class snacks.picker.diagnostics.Config: snacks.picker.Config
---@field filter? snacks.picker.filter.Config
---@field severity? vim.diagnostic.SeverityFilter
{
finder = "diagnostics",
format = "diagnostic",
sort = {
fields = {
"is_current",
"is_cwd",
"severity",
"file",
"lnum",
},
},
matcher = { sort_empty = true },
-- only show diagnostics from the cwd by default
filter = { cwd = true },
}
```
### `diagnostics_buffer`
```vim
:lua Snacks.picker.diagnostics_buffer(opts?)
```
```lua
---@type snacks.picker.diagnostics.Config
{
finder = "diagnostics",
format = "diagnostic",
sort = {
fields = { "severity", "file", "lnum" },
},
matcher = { sort_empty = true },
filter = { buf = true },
}
```
### `explorer`
```vim
:lua Snacks.picker.explorer(opts?)
```
```lua
---@class snacks.picker.explorer.Config: snacks.picker.files.Config|{}
---@field follow_file? boolean follow the file from the current buffer
---@field tree? boolean show the file tree (default: true)
---@field git_status? boolean show git status (default: true)
---@field git_status_open? boolean show recursive git status for open directories
---@field git_untracked? boolean needed to show untracked git status
---@field diagnostics? boolean show diagnostics
---@field diagnostics_open? boolean show recursive diagnostics for open directories
---@field watch? boolean watch for file changes
---@field exclude? string[] exclude glob patterns
---@field include? string[] include glob patterns. These take precedence over `exclude`, `ignored` and `hidden`
{
finder = "explorer",
sort = { fields = { "sort" } },
supports_live = true,
tree = true,
watch = true,
diagnostics = true,
diagnostics_open = false,
git_status = true,
git_status_open = false,
git_untracked = true,
follow_file = true,
focus = "list",
auto_close = false,
jump = { close = false },
layout = { preset = "sidebar", preview = false },
-- to show the explorer to the right, add the below to
-- your config under `opts.picker.sources.explorer`
-- layout = { layout = { position = "right" } },
formatters = {
file = { filename_only = true },
severity = { pos = "right" },
},
matcher = { sort_empty = false, fuzzy = false },
config = function(opts)
return require("snacks.picker.source.explorer").setup(opts)
end,
win = {
list = {
keys = {
["<BS>"] = "explorer_up",
["l"] = "confirm",
["h"] = "explorer_close", -- close directory
["a"] = "explorer_add",
["d"] = "explorer_del",
["r"] = "explorer_rename",
["c"] = "explorer_copy",
["m"] = "explorer_move",
["o"] = "explorer_open", -- open with system application
["P"] = "toggle_preview",
["y"] = { "explorer_yank", mode = { "n", "x" } },
["p"] = "explorer_paste",
["u"] = "explorer_update",
["<c-c>"] = "tcd",
["<leader>/"] = "picker_grep",
["<c-t>"] = "terminal",
["."] = "explorer_focus",
["I"] = "toggle_ignored",
["H"] = "toggle_hidden",
["Z"] = "explorer_close_all",
["]g"] = "explorer_git_next",
["[g"] = "explorer_git_prev",
["]d"] = "explorer_diagnostic_next",
["[d"] = "explorer_diagnostic_prev",
["]w"] = "explorer_warn_next",
["[w"] = "explorer_warn_prev",
["]e"] = "explorer_error_next",
["[e"] = "explorer_error_prev",
},
},
},
}
```
### `files`
```vim
:lua Snacks.picker.files(opts?)
```
```lua
---@class snacks.picker.files.Config: snacks.picker.proc.Config
---@field cmd? "fd"| "rg"| "find" command to use. Leave empty to auto-detect
---@field hidden? boolean show hidden files
---@field ignored? boolean show ignored files
---@field dirs? string[] directories to search
---@field follow? boolean follow symlinks
---@field exclude? string[] exclude patterns
---@field args? string[] additional arguments
---@field ft? string|string[] file extension(s)
---@field rtp? boolean search in runtimepath
{
finder = "files",
format = "file",
show_empty = true,
hidden = false,
ignored = false,
follow = false,
supports_live = true,
}
```
### `git_branches`
```vim
:lua Snacks.picker.git_branches(opts?)
```
```lua
---@type snacks.picker.git.Config
{
finder = "git_branches",
format = "git_branch",
preview = "git_log",
confirm = "git_checkout",
win = {
input = {
keys = {
["<c-a>"] = { "git_branch_add", mode = { "n", "i" } },
["<c-x>"] = { "git_branch_del", mode = { "n", "i" } },
},
},
},
---@param picker snacks.Picker
on_show = function(picker)
for i, item in ipairs(picker:items()) do
if item.current then
picker.list:view(i)
Snacks.picker.actions.list_scroll_center(picker)
break
end
end
end,
}
```
### `git_diff`
```vim
:lua Snacks.picker.git_diff(opts?)
```
```lua
---@type snacks.picker.git.Config
{
finder = "git_diff",
format = "file",
preview = "diff",
}
```
### `git_files`
```vim
:lua Snacks.picker.git_files(opts?)
```
Find git files
```lua
---@class snacks.picker.git.files.Config: snacks.picker.git.Config
---@field untracked? boolean show untracked files
---@field submodules? boolean show submodule files
{
finder = "git_files",
show_empty = true,
format = "file",
untracked = false,
submodules = false,
}
```
### `git_grep`
```vim
:lua Snacks.picker.git_grep(opts?)
```
Grep in git files
```lua
---@class snacks.picker.git.grep.Config: snacks.picker.git.Config
---@field untracked? boolean search in untracked files
---@field submodules? boolean search in submodule files
---@field need_search? boolean require a search pattern
{
finder = "git_grep",
format = "file",
untracked = false,
need_search = true,
submodules = false,
show_empty = true,
supports_live = true,
live = true,
}
```
### `git_log`
```vim
:lua Snacks.picker.git_log(opts?)
```
Git log
```lua
---@class snacks.picker.git.log.Config: snacks.picker.git.Config
---@field follow? boolean track file history across renames
---@field current_file? boolean show current file log
---@field current_line? boolean show current line log
---@field author? string filter commits by author
{
finder = "git_log",
format = "git_log",
preview = "git_show",
confirm = "git_checkout",
sort = { fields = { "score:desc", "idx" } },
}
```
### `git_log_file`
```vim
:lua Snacks.picker.git_log_file(opts?)
```
```lua
---@type snacks.picker.git.log.Config
{
finder = "git_log",
format = "git_log",
preview = "git_show",
current_file = true,
follow = true,
confirm = "git_checkout",
sort = { fields = { "score:desc", "idx" } },
}
```
### `git_log_line`
```vim
:lua Snacks.picker.git_log_line(opts?)
```
```lua
---@type snacks.picker.git.log.Config
{
finder = "git_log",
format = "git_log",
preview = "git_show",
current_line = true,
follow = true,
confirm = "git_checkout",
sort = { fields = { "score:desc", "idx" } },
}
```
### `git_stash`
```vim
:lua Snacks.picker.git_stash(opts?)
```
```lua
{
finder = "git_stash",
format = "git_stash",
preview = "git_stash",
confirm = "git_stash_apply",
}
```
### `git_status`
```vim
:lua Snacks.picker.git_status(opts?)
```
```lua
---@class snacks.picker.git.status.Config: snacks.picker.git.Config
---@field ignored? boolean show ignored files
{
finder = "git_status",
format = "git_status",
preview = "git_status",
win = {
input = {
keys = {
["<Tab>"] = { "git_stage", mode = { "n", "i" } },
},
},
},
}
```
### `grep`
```vim
:lua Snacks.picker.grep(opts?)
```
```lua
---@class snacks.picker.grep.Config: snacks.picker.proc.Config
---@field cmd? string
---@field hidden? boolean show hidden files
---@field ignored? boolean show ignored files
---@field dirs? string[] directories to search
---@field follow? boolean follow symlinks
---@field glob? string|string[] glob file pattern(s)
---@field ft? string|string[] ripgrep file type(s). See `rg --type-list`
---@field regex? boolean use regex search pattern (defaults to `true`)
---@field buffers? boolean search in open buffers
---@field need_search? boolean require a search pattern
---@field exclude? string[] exclude patterns
---@field args? string[] additional arguments
---@field rtp? boolean search in runtimepath
{
finder = "grep",
regex = true,
format = "file",
show_empty = true,
live = true, -- live grep by default
supports_live = true,
}
```
### `grep_buffers`
```vim
:lua Snacks.picker.grep_buffers(opts?)
```
```lua
---@type snacks.picker.grep.Config|{}
{
finder = "grep",
format = "file",
live = true,
buffers = true,
need_search = false,
supports_live = true,
}
```
### `grep_word`
```vim
:lua Snacks.picker.grep_word(opts?)
```
```lua
---@type snacks.picker.grep.Config|{}
{
finder = "grep",
regex = false,
format = "file",
search = function(picker)
return picker:word()
end,
live = false,
supports_live = true,
}
```
### `help`
```vim
:lua Snacks.picker.help(opts?)
```
Neovim help tags
```lua
---@class snacks.picker.help.Config: snacks.picker.Config
---@field lang? string[] defaults to `vim.opt.helplang`
{
finder = "help",
format = "text",
previewers = {
file = { ft = "help" },
},
win = { preview = { minimal = true } },
confirm = "help",
}
```
### `highlights`
```vim
:lua Snacks.picker.highlights(opts?)
```
```lua
{
finder = "vim_highlights",
format = "hl",
preview = "preview",
confirm = "close",
}
```
### `icons`
```vim
:lua Snacks.picker.icons(opts?)
```
```lua
---@class snacks.picker.icons.Config: snacks.picker.Config
---@field icon_sources? string[]
{
icon_sources = { "nerd_fonts", "emoji" },
finder = "icons",
format = "icon",
layout = { preset = "vscode" },
confirm = "put",
}
```
### `jumps`
```vim
:lua Snacks.picker.jumps(opts?)
```
```lua
{
finder = "vim_jumps",
format = "file",
}
```
### `keymaps`
```vim
:lua Snacks.picker.keymaps(opts?)
```
```lua
---@class snacks.picker.keymaps.Config: snacks.picker.Config
---@field global? boolean show global keymaps
---@field local? boolean show buffer keymaps
---@field plugs? boolean show plugin keymaps
---@field modes? string[]
{
finder = "vim_keymaps",
format = "keymap",
preview = "preview",
global = true,
plugs = false,
["local"] = true,
modes = { "n", "v", "x", "s", "o", "i", "c", "t" },
---@param picker snacks.Picker
confirm = function(picker, item)
picker:norm(function()
if item then
picker:close()
vim.api.nvim_input(item.item.lhs)
end
end)
end,
actions = {
toggle_global = function(picker)
picker.opts.global = not picker.opts.global
picker:find()
end,
toggle_buffer = function(picker)
picker.opts["local"] = not picker.opts["local"]
picker:find()
end,
},
win = {
input = {
keys = {
["<a-g>"] = { "toggle_global", mode = { "n", "i" }, desc = "Toggle Global Keymaps" },
["<a-b>"] = { "toggle_buffer", mode = { "n", "i" }, desc = "Toggle Buffer Keymaps" },
},
},
},
}
```
### `lazy`
```vim
:lua Snacks.picker.lazy(opts?)
```
Search for a lazy.nvim plugin spec
```lua
{
finder = "lazy_spec",
pattern = "'",
}
```
### `lines`
```vim
:lua Snacks.picker.lines(opts?)
```
Search lines in the current buffer
```lua
---@class snacks.picker.lines.Config: snacks.picker.Config
---@field buf? number
{
finder = "lines",
format = "lines",
layout = {
preview = "main",
preset = "ivy",
},
jump = { match = true },
-- allow any window to be used as the main window
main = { current = true },
---@param picker snacks.Picker
on_show = function(picker)
local cursor = vim.api.nvim_win_get_cursor(picker.main)
local info = vim.api.nvim_win_call(picker.main, vim.fn.winsaveview)
picker.list:view(cursor[1], info.topline)
picker:show_preview()
end,
sort = { fields = { "score:desc", "idx" } },
}
```
### `loclist`
```vim
:lua Snacks.picker.loclist(opts?)
```
Loclist
```lua
---@type snacks.picker.qf.Config
{
finder = "qf",
format = "file",
qf_win = 0,
}
```
### `lsp_config`
```vim
:lua Snacks.picker.lsp_config(opts?)
```
```lua
---@class snacks.picker.lsp.config.Config: snacks.picker.Config
---@field installed? boolean only show installed servers
---@field configured? boolean only show configured servers (setup with lspconfig)
---@field attached? boolean|number only show attached servers. When `number`, show only servers attached to that buffer (can be 0)
{
finder = "lsp.config#find",
format = "lsp.config#format",
preview = "lsp.config#preview",
confirm = "close",
sort = { fields = { "score:desc", "attached_buf", "attached", "enabled", "installed", "name" } },
matcher = { sort_empty = true },
}
```
### `lsp_declarations`
```vim
:lua Snacks.picker.lsp_declarations(opts?)
```
LSP declarations
```lua
---@type snacks.picker.lsp.Config
{
finder = "lsp_declarations",
format = "file",
include_current = false,
auto_confirm = true,
jump = { tagstack = true, reuse_win = true },
}
```
### `lsp_definitions`
```vim
:lua Snacks.picker.lsp_definitions(opts?)
```
LSP definitions
```lua
---@type snacks.picker.lsp.Config
{
finder = "lsp_definitions",
format = "file",
include_current = false,
auto_confirm = true,
jump = { tagstack = true, reuse_win = true },
}
```
### `lsp_implementations`
```vim
:lua Snacks.picker.lsp_implementations(opts?)
```
LSP implementations
```lua
---@type snacks.picker.lsp.Config
{
finder = "lsp_implementations",
format = "file",
include_current = false,
auto_confirm = true,
jump = { tagstack = true, reuse_win = true },
}
```
### `lsp_references`
```vim
:lua Snacks.picker.lsp_references(opts?)
```
LSP references
```lua
---@class snacks.picker.lsp.references.Config: snacks.picker.lsp.Config
---@field include_declaration? boolean default true
{
finder = "lsp_references",
format = "file",
include_declaration = true,
include_current = false,
auto_confirm = true,
jump = { tagstack = true, reuse_win = true },
}
```
### `lsp_symbols`
```vim
:lua Snacks.picker.lsp_symbols(opts?)
```
LSP document symbols
```lua
---@class snacks.picker.lsp.symbols.Config: snacks.picker.Config
---@field tree? boolean show symbol tree
---@field filter table<string, string[]|boolean>? symbol kind filter
---@field workspace? boolean show workspace symbols
{
finder = "lsp_symbols",
format = "lsp_symbol",
tree = true,
filter = {
default = {
"Class",
"Constructor",
"Enum",
"Field",
"Function",
"Interface",
"Method",
"Module",
"Namespace",
"Package",
"Property",
"Struct",
"Trait",
},
-- set to `true` to include all symbols
markdown = true,
help = true,
-- you can specify a different filter for each filetype
lua = {
"Class",
"Constructor",
"Enum",
"Field",
"Function",
"Interface",
"Method",
"Module",
"Namespace",
-- "Package", -- remove package since luals uses it for control flow structures
"Property",
"Struct",
"Trait",
},
},
}
```
### `lsp_type_definitions`
```vim
:lua Snacks.picker.lsp_type_definitions(opts?)
```
LSP type definitions
```lua
---@type snacks.picker.lsp.Config
{
finder = "lsp_type_definitions",
format = "file",
include_current = false,
auto_confirm = true,
jump = { tagstack = true, reuse_win = true },
}
```
### `lsp_workspace_symbols`
```vim
:lua Snacks.picker.lsp_workspace_symbols(opts?)
```
```lua
---@type snacks.picker.lsp.symbols.Config
vim.tbl_extend("force", {}, M.lsp_symbols, {
workspace = true,
tree = false,
supports_live = true,
live = true, -- live by default
})
```
### `man`
```vim
:lua Snacks.picker.man(opts?)
```
```lua
{
finder = "system_man",
format = "man",
preview = "man",
confirm = function(picker, item)
picker:close()
if item then
vim.schedule(function()
vim.cmd("Man " .. item.ref)
end)
end
end,
}
```
### `marks`
```vim
:lua Snacks.picker.marks(opts?)
```
```lua
---@class snacks.picker.marks.Config: snacks.picker.Config
---@field global? boolean show global marks
---@field local? boolean show buffer marks
{
finder = "vim_marks",
format = "file",
global = true,
["local"] = true,
}
```
### `notifications`
```vim
:lua Snacks.picker.notifications(opts?)
```
```lua
---@class snacks.picker.notifications.Config: snacks.picker.Config
---@field filter? snacks.notifier.level|fun(notif: snacks.notifier.Notif): boolean
{
finder = "snacks_notifier",
format = "notification",
preview = "preview",
formatters = { severity = { level = true } },
confirm = "close",
}
```
### `picker_actions`
```vim
:lua Snacks.picker.picker_actions(opts?)
```
```lua
{
finder = "meta_actions",
format = "text",
}
```
### `picker_format`
```vim
:lua Snacks.picker.picker_format(opts?)
```
```lua
{
finder = "meta_format",
format = "text",
}
```
### `picker_layouts`
```vim
:lua Snacks.picker.picker_layouts(opts?)
```
```lua
{
finder = "meta_layouts",
format = "text",
on_change = function(picker, item)
vim.schedule(function()
picker:set_layout(item.text)
end)
end,
}
```
### `picker_preview`
```vim
:lua Snacks.picker.picker_preview(opts?)
```
```lua
{
finder = "meta_preview",
format = "text",
}
```
### `pickers`
```vim
:lua Snacks.picker.pickers(opts?)
```
List all available sources
```lua
{
finder = "meta_pickers",
format = "text",
confirm = function(picker, item)
picker:close()
if item then
vim.schedule(function()
Snacks.picker(item.text)
end)
end
end,
}
```
### `projects`
```vim
:lua Snacks.picker.projects(opts?)
```
Open recent projects
```lua
---@class snacks.picker.projects.Config: snacks.picker.Config
---@field filter? snacks.picker.filter.Config
---@field dev? string|string[] top-level directories containing multiple projects (sub-folders that contains a root pattern)
---@field projects? string[] list of project directories
---@field patterns? string[] patterns to detect project root directories
---@field recent? boolean include project directories of recent files
{
finder = "recent_projects",
format = "file",
dev = { "~/dev", "~/projects" },
confirm = "load_session",
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "package.json", "Makefile" },
recent = true,
matcher = {
frecency = true, -- use frecency boosting
sort_empty = true, -- sort even when the filter is empty
cwd_bonus = false,
},
sort = { fields = { "score:desc", "idx" } },
win = {
preview = { minimal = true },
input = {
keys = {
-- every action will always first change the cwd of the current tabpage to the project
["<c-e>"] = { { "tcd", "picker_explorer" }, mode = { "n", "i" } },
["<c-f>"] = { { "tcd", "picker_files" }, mode = { "n", "i" } },
["<c-g>"] = { { "tcd", "picker_grep" }, mode = { "n", "i" } },
["<c-r>"] = { { "tcd", "picker_recent" }, mode = { "n", "i" } },
["<c-w>"] = { { "tcd" }, mode = { "n", "i" } },
["<c-t>"] = {
function(picker)
vim.cmd("tabnew")
Snacks.notify("New tab opened")
picker:close()
Snacks.picker.projects()
end,
mode = { "n", "i" },
},
},
},
},
}
```
### `qflist`
```vim
:lua Snacks.picker.qflist(opts?)
```
Quickfix list
```lua
---@type snacks.picker.qf.Config
{
finder = "qf",
format = "file",
}
```
### `recent`
```vim
:lua Snacks.picker.recent(opts?)
```
Find recent files
```lua
---@class snacks.picker.recent.Config: snacks.picker.Config
---@field filter? snacks.picker.filter.Config
{
finder = "recent_files",
format = "file",
filter = {
paths = {
[vim.fn.stdpath("data")] = false,
[vim.fn.stdpath("cache")] = false,
[vim.fn.stdpath("state")] = false,
},
},
}
```
### `registers`
```vim
:lua Snacks.picker.registers(opts?)
```
Neovim registers
```lua
{
finder = "vim_registers",
format = "register",
preview = "preview",
confirm = { "copy", "close" },
}
```
### `resume`
```vim
:lua Snacks.picker.resume(opts?)
```
Special picker that resumes the last picker
```lua
{}
```
### `search_history`
```vim
:lua Snacks.picker.search_history(opts?)
```
Neovim search history
```lua
---@type snacks.picker.history.Config
{
finder = "vim_history",
name = "search",
format = "text",
preview = "none",
layout = { preset = "vscode" },
confirm = "search",
formatters = { text = { ft = "regex" } },
}
```
### `select`
```vim
:lua Snacks.picker.select(opts?)
```
Config used by `vim.ui.select`.
Not meant to be used directly.
```lua
{
items = {}, -- these are set dynamically
main = { current = true },
layout = { preset = "select" },
}
```
### `smart`
```vim
:lua Snacks.picker.smart(opts?)
```
```lua
---@class snacks.picker.smart.Config: snacks.picker.Config
---@field finders? string[] list of finders to use
---@field filter? snacks.picker.filter.Config
{
multi = { "buffers", "recent", "files" },
format = "file", -- use `file` format for all sources
matcher = {
cwd_bonus = true, -- boost cwd matches
frecency = true, -- use frecency boosting
sort_empty = true, -- sort even when the filter is empty
},
transform = "unique_file",
}
```
### `spelling`
```vim
:lua Snacks.picker.spelling(opts?)
```
```lua
{
finder = "vim_spelling",
format = "text",
layout = { preset = "vscode" },
confirm = "item_action",
}
```
### `treesitter`
```vim
:lua Snacks.picker.treesitter(opts?)
```
```lua
---@class snacks.picker.treesitter.Config: snacks.picker.Config
---@field filter table<string, string[]|boolean>? symbol kind filter
---@field tree? boolean show symbol tree
{
finder = "treesitter_symbols",
format = "lsp_symbol",
tree = true,
filter = {
default = {
"Class",
"Enum",
"Field",
"Function",
"Method",
"Module",
"Namespace",
"Struct",
"Trait",
},
-- set to `true` to include all symbols
markdown = true,
help = true,
},
}
```
### `undo`
```vim
:lua Snacks.picker.undo(opts?)
```
```lua
---@class snacks.picker.undo.Config: snacks.picker.Config
---@field diff? vim.diff.Opts
{
finder = "vim_undo",
format = "undo",
preview = "diff",
confirm = "item_action",
win = {
preview = { wo = { number = false, relativenumber = false, signcolumn = "no" } },
input = {
keys = {
["<c-y>"] = { "yank_add", mode = { "n", "i" } },
["<c-s-y>"] = { "yank_del", mode = { "n", "i" } },
},
},
},
actions = {
yank_add = { action = "yank", field = "added_lines" },
yank_del = { action = "yank", field = "removed_lines" },
},
icons = { tree = { last = "โโด" } }, -- the tree is upside down
diff = {
ctxlen = 4,
ignore_cr_at_eol = true,
ignore_whitespace_change_at_eol = true,
indent_heuristic = true,
},
}
```
### `zoxide`
```vim
:lua Snacks.picker.zoxide(opts?)
```
Open a project from zoxide
```lua
{
finder = "files_zoxide",
format = "file",
confirm = "load_session",
win = {
preview = {
minimal = true,
},
},
}
```
## ๐ผ๏ธ Layouts
### `bottom`
```lua
{ preset = "ivy", layout = { position = "bottom" } }
```
### `default`
```lua
{
layout = {
box = "horizontal",
width = 0.8,
min_width = 120,
height = 0.8,
{
box = "vertical",
border = "rounded",
title = "{title} {live} {flags}",
{ win = "input", height = 1, border = "bottom" },
{ win = "list", border = "none" },
},
{ win = "preview", title = "{preview}", border = "rounded", width = 0.5 },
},
}
```
### `dropdown`
```lua
{
layout = {
backdrop = false,
row = 1,
width = 0.4,
min_width = 80,
height = 0.8,
border = "none",
box = "vertical",
{ win = "preview", title = "{preview}", height = 0.4, border = "rounded" },
{
box = "vertical",
border = "rounded",
title = "{title} {live} {flags}",
title_pos = "center",
{ win = "input", height = 1, border = "bottom" },
{ win = "list", border = "none" },
},
},
}
```
### `ivy`
```lua
{
layout = {
box = "vertical",
backdrop = false,
row = -1,
width = 0,
height = 0.4,
border = "top",
title = " {title} {live} {flags}",
title_pos = "left",
{ win = "input", height = 1, border = "bottom" },
{
box = "horizontal",
{ win = "list", border = "none" },
{ win = "preview", title = "{preview}", width = 0.6, border = "left" },
},
},
}
```
### `ivy_split`
```lua
{
preview = "main",
layout = {
box = "vertical",
backdrop = false,
width = 0,
height = 0.4,
position = "bottom",
border = "top",
title = " {title} {live} {flags}",
title_pos = "left",
{ win = "input", height = 1, border = "bottom" },
{
box = "horizontal",
{ win = "list", border = "none" },
{ win = "preview", title = "{preview}", width = 0.6, border = "left" },
},
},
}
```
### `left`
```lua
M.sidebar
```
### `right`
```lua
{ preset = "sidebar", layout = { position = "right" } }
```
### `select`
```lua
{
preview = false,
layout = {
backdrop = false,
width = 0.5,
min_width = 80,
height = 0.4,
min_height = 3,
box = "vertical",
border = "rounded",
title = "{title}",
title_pos = "center",
{ win = "input", height = 1, border = "bottom" },
{ win = "list", border = "none" },
{ win = "preview", title = "{preview}", height = 0.4, border = "top" },
},
}
```
### `sidebar`
```lua
{
preview = "main",
layout = {
backdrop = false,
width = 40,
min_width = 40,
height = 0,
position = "left",
border = "none",
box = "vertical",
{
win = "input",
height = 1,
border = "rounded",
title = "{title} {live} {flags}",
title_pos = "center",
},
{ win = "list", border = "none" },
{ win = "preview", title = "{preview}", height = 0.4, border = "top" },
},
}
```
### `telescope`
```lua
{
reverse = true,
layout = {
box = "horizontal",
backdrop = false,
width = 0.8,
height = 0.9,
border = "none",
{
box = "vertical",
{ win = "list", title = " Results ", title_pos = "center", border = "rounded" },
{ win = "input", height = 1, border = "rounded", title = "{title} {live} {flags}", title_pos = "center" },
},
{
win = "preview",
title = "{preview:Preview}",
width = 0.45,
border = "rounded",
title_pos = "center",
},
},
}
```
### `top`
```lua
{ preset = "ivy", layout = { position = "top" } }
```
### `vertical`
```lua
{
layout = {
backdrop = false,
width = 0.5,
min_width = 80,
height = 0.8,
min_height = 30,
box = "vertical",
border = "rounded",
title = "{title} {live} {flags}",
title_pos = "center",
{ win = "input", height = 1, border = "bottom" },
{ win = "list", border = "none" },
{ win = "preview", title = "{preview}", height = 0.4, border = "top" },
},
}
```
### `vscode`
```lua
{
preview = false,
layout = {
backdrop = false,
row = 1,
width = 0.4,
min_width = 80,
height = 0.4,
border = "none",
box = "vertical",
{ win = "input", height = 1, border = "rounded", title = "{title} {live} {flags}", title_pos = "center" },
{ win = "list", border = "hpad" },
{ win = "preview", title = "{preview}", border = "rounded" },
},
}
```
## ๐ฆ `snacks.picker.actions`
```lua
---@class snacks.picker.actions
---@field [string] snacks.picker.Action.spec
local M = {}
```
### `Snacks.picker.actions.bufdelete()`
```lua
Snacks.picker.actions.bufdelete(picker)
```
### `Snacks.picker.actions.cancel()`
```lua
Snacks.picker.actions.cancel(picker)
```
### `Snacks.picker.actions.cd()`
```lua
Snacks.picker.actions.cd(_, item)
```
### `Snacks.picker.actions.close()`
```lua
Snacks.picker.actions.close(picker)
```
### `Snacks.picker.actions.cmd()`
```lua
Snacks.picker.actions.cmd(picker, item)
```
### `Snacks.picker.actions.cycle_win()`
```lua
Snacks.picker.actions.cycle_win(picker)
```
### `Snacks.picker.actions.focus_input()`
```lua
Snacks.picker.actions.focus_input(picker)
```
### `Snacks.picker.actions.focus_list()`
```lua
Snacks.picker.actions.focus_list(picker)
```
### `Snacks.picker.actions.focus_preview()`
```lua
Snacks.picker.actions.focus_preview(picker)
```
### `Snacks.picker.actions.git_branch_add()`
```lua
Snacks.picker.actions.git_branch_add(picker)
```
### `Snacks.picker.actions.git_branch_del()`
```lua
Snacks.picker.actions.git_branch_del(picker, item)
```
### `Snacks.picker.actions.git_checkout()`
```lua
Snacks.picker.actions.git_checkout(picker, item)
```
### `Snacks.picker.actions.git_stage()`
```lua
Snacks.picker.actions.git_stage(picker)
```
### `Snacks.picker.actions.git_stash_apply()`
```lua
Snacks.picker.actions.git_stash_apply(_, item)
```
### `Snacks.picker.actions.help()`
```lua
Snacks.picker.actions.help(picker, item, action)
```
### `Snacks.picker.actions.history_back()`
```lua
Snacks.picker.actions.history_back(picker)
```
### `Snacks.picker.actions.history_forward()`
```lua
Snacks.picker.actions.history_forward(picker)
```
### `Snacks.picker.actions.insert()`
```lua
Snacks.picker.actions.insert(picker, _, action)
```
### `Snacks.picker.actions.inspect()`
```lua
Snacks.picker.actions.inspect(picker, item)
```
### `Snacks.picker.actions.item_action()`
```lua
Snacks.picker.actions.item_action(picker, item, action)
```
### `Snacks.picker.actions.jump()`
```lua
Snacks.picker.actions.jump(picker, _, action)
```
### `Snacks.picker.actions.layout()`
```lua
Snacks.picker.actions.layout(picker, _, action)
```
### `Snacks.picker.actions.lcd()`
```lua
Snacks.picker.actions.lcd(_, item)
```
### `Snacks.picker.actions.list_bottom()`
```lua
Snacks.picker.actions.list_bottom(picker)
```
### `Snacks.picker.actions.list_down()`
```lua
Snacks.picker.actions.list_down(picker)
```
### `Snacks.picker.actions.list_scroll_bottom()`
```lua
Snacks.picker.actions.list_scroll_bottom(picker)
```
### `Snacks.picker.actions.list_scroll_center()`
```lua
Snacks.picker.actions.list_scroll_center(picker)
```
### `Snacks.picker.actions.list_scroll_down()`
```lua
Snacks.picker.actions.list_scroll_down(picker)
```
### `Snacks.picker.actions.list_scroll_top()`
```lua
Snacks.picker.actions.list_scroll_top(picker)
```
### `Snacks.picker.actions.list_scroll_up()`
```lua
Snacks.picker.actions.list_scroll_up(picker)
```
### `Snacks.picker.actions.list_top()`
```lua
Snacks.picker.actions.list_top(picker)
```
### `Snacks.picker.actions.list_up()`
```lua
Snacks.picker.actions.list_up(picker)
```
### `Snacks.picker.actions.load_session()`
Tries to load the session, if it fails, it will open the picker.
```lua
Snacks.picker.actions.load_session(picker, item)
```
### `Snacks.picker.actions.loclist()`
Send selected or all items to the location list.
```lua
Snacks.picker.actions.loclist(picker)
```
### `Snacks.picker.actions.pick_win()`
```lua
Snacks.picker.actions.pick_win(picker, item, action)
```
### `Snacks.picker.actions.picker()`
```lua
Snacks.picker.actions.picker(picker, item, action)
```
### `Snacks.picker.actions.picker_grep()`
```lua
Snacks.picker.actions.picker_grep(_, item)
```
### `Snacks.picker.actions.preview_scroll_down()`
```lua
Snacks.picker.actions.preview_scroll_down(picker)
```
### `Snacks.picker.actions.preview_scroll_left()`
```lua
Snacks.picker.actions.preview_scroll_left(picker)
```
### `Snacks.picker.actions.preview_scroll_right()`
```lua
Snacks.picker.actions.preview_scroll_right(picker)
```
### `Snacks.picker.actions.preview_scroll_up()`
```lua
Snacks.picker.actions.preview_scroll_up(picker)
```
### `Snacks.picker.actions.put()`
```lua
Snacks.picker.actions.put(picker, item, action)
```
### `Snacks.picker.actions.qflist()`
Send selected or all items to the quickfix list.
```lua
Snacks.picker.actions.qflist(picker)
```
### `Snacks.picker.actions.qflist_all()`
Send all items to the quickfix list.
```lua
Snacks.picker.actions.qflist_all(picker)
```
### `Snacks.picker.actions.search()`
```lua
Snacks.picker.actions.search(picker, item)
```
### `Snacks.picker.actions.select_all()`
Selects all items in the list.
Or clears the selection if all items are selected.
```lua
Snacks.picker.actions.select_all(picker)
```
### `Snacks.picker.actions.select_and_next()`
Toggles the selection of the current item,
and moves the cursor to the next item.
```lua
Snacks.picker.actions.select_and_next(picker)
```
### `Snacks.picker.actions.select_and_prev()`
Toggles the selection of the current item,
and moves the cursor to the prev item.
```lua
Snacks.picker.actions.select_and_prev(picker)
```
### `Snacks.picker.actions.tcd()`
```lua
Snacks.picker.actions.tcd(_, item)
```
### `Snacks.picker.actions.terminal()`
```lua
Snacks.picker.actions.terminal(_, item)
```
### `Snacks.picker.actions.toggle_focus()`
```lua
Snacks.picker.actions.toggle_focus(picker)
```
### `Snacks.picker.actions.toggle_help_input()`
```lua
Snacks.picker.actions.toggle_help_input(picker)
```
### `Snacks.picker.actions.toggle_help_list()`
```lua
Snacks.picker.actions.toggle_help_list(picker)
```
### `Snacks.picker.actions.toggle_input()`
```lua
Snacks.picker.actions.toggle_input(picker)
```
### `Snacks.picker.actions.toggle_live()`
```lua
Snacks.picker.actions.toggle_live(picker)
```
### `Snacks.picker.actions.toggle_maximize()`
```lua
Snacks.picker.actions.toggle_maximize(picker)
```
### `Snacks.picker.actions.toggle_preview()`
```lua
Snacks.picker.actions.toggle_preview(picker)
```
### `Snacks.picker.actions.yank()`
```lua
Snacks.picker.actions.yank(picker, item, action)
```
## ๐ฆ `snacks.picker.core.picker`
```lua
---@class snacks.Picker
---@field id number
---@field opts snacks.picker.Config
---@field init_opts? snacks.picker.Config
---@field finder snacks.picker.Finder
---@field format snacks.picker.format
---@field input snacks.picker.input
---@field layout snacks.layout
---@field resolved_layout snacks.picker.layout.Config
---@field list snacks.picker.list
---@field matcher snacks.picker.Matcher
---@field main number
---@field _main snacks.picker.Main
---@field preview snacks.picker.Preview
---@field shown? boolean
---@field sort snacks.picker.sort
---@field updater uv.uv_timer_t
---@field start_time number
---@field title string
---@field closed? boolean
---@field history snacks.picker.History
---@field visual? snacks.picker.Visual
local M = {}
```
### `Snacks.picker.picker.get()`
```lua
---@param opts? {source?: string, tab?: boolean}
Snacks.picker.picker.get(opts)
```
### `picker:action()`
Execute the given action(s)
```lua
---@param actions string|string[]
picker:action(actions)
```
### `picker:close()`
Close the picker
```lua
picker:close()
```
### `picker:count()`
Total number of items in the picker
```lua
picker:count()
```
### `picker:current()`
Get the current item at the cursor
```lua
---@param opts? {resolve?: boolean} default is `true`
picker:current(opts)
```
### `picker:current_win()`
```lua
---@return string? name, snacks.win? win
picker:current_win()
```
### `picker:cwd()`
```lua
picker:cwd()
```
### `picker:dir()`
Returns the directory of the current item or the cwd.
When the item is a directory, return item path,
otherwise return the directory of the item.
```lua
picker:dir()
```
### `picker:empty()`
Check if the picker is empty
```lua
picker:empty()
```
### `picker:filter()`
Get the active filter
```lua
picker:filter()
```
### `picker:find()`
Check if the finder and/or matcher need to run,
based on the current pattern and search string.
```lua
---@param opts? { on_done?: fun(), refresh?: boolean }
picker:find(opts)
```
### `picker:focus()`
Focuses the given or configured window.
Falls back to the first available window if the window is hidden.
```lua
---@param win? "input"|"list"|"preview"
---@param opts? {show?: boolean} when enable is true, the window will be shown if hidden
picker:focus(win, opts)
```
### `picker:hist()`
Move the history cursor
```lua
---@param forward? boolean
picker:hist(forward)
```
### `picker:is_active()`
Check if the finder or matcher is running
```lua
picker:is_active()
```
### `picker:is_focused()`
```lua
picker:is_focused()
```
### `picker:items()`
Get all filtered items in the picker.
```lua
picker:items()
```
### `picker:iter()`
Returns an iterator over the filtered items in the picker.
Items will be in sorted order.
```lua
---@return fun():(snacks.picker.Item?, number?)
picker:iter()
```
### `picker:norm()`
Execute the callback in normal mode.
When still in insert mode, stop insert mode first,
and then`vim.schedule` the callback.
```lua
---@param cb fun()
picker:norm(cb)
```
### `picker:on_current_tab()`
```lua
picker:on_current_tab()
```
### `picker:ref()`
```lua
---@return snacks.Picker.ref
picker:ref()
```
### `picker:resolve()`
```lua
---@param item snacks.picker.Item?
picker:resolve(item)
```
### `picker:selected()`
Get the selected items.
If `fallback=true` and there is no selection, return the current item.
```lua
---@param opts? {fallback?: boolean} default is `false`
---@return snacks.picker.Item[]
picker:selected(opts)
```
### `picker:set_cwd()`
```lua
picker:set_cwd(cwd)
```
### `picker:set_layout()`
Set the picker layout. Can be either the name of a preset layout
or a custom layout configuration.
```lua
---@param layout? string|snacks.picker.layout.Config
picker:set_layout(layout)
```
### `picker:show_preview()`
Show the preview. Show instantly when no item is yet in the preview,
otherwise throttle the preview.
```lua
picker:show_preview()
```
### `picker:toggle()`
Toggle the given window and optionally focus
```lua
---@param win "input"|"list"|"preview"
---@param opts? {enable?: boolean, focus?: boolean|string}
picker:toggle(win, opts)
```
### `picker:word()`
Get the word under the cursor or the current visual selection
```lua
picker:word()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/picker.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/picker.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 69287
} |
# ๐ฟ profiler
A low overhead Lua profiler for Neovim.



## โจ Features
- low overhead **instrumentation**
- captures a function's **def**inition and **ref**erence (_caller_) locations
- profiling of **autocmds**
- profiling of **require**d modules
- buffer **highlighting** of functions and calls
- lots of different ways to **filter** and **group** traces
- show traces with:
- [fzf-lua](https://github.com/ibhagwan/fzf-lua)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
- [trouble.nvim](https://github.com/folke/trouble.nvim)
## โ๏ธ Why?
Before the snacks profiler, I used to use a combination of my own profiler(s),
**lazy.nvim**'s internal profiler, [profile.nvim](https://github.com/stevearc/profile.nvim)
and [perfanno.nvim](https://github.com/t-troebst/perfanno.nvim).
They all have their strengths and weaknesses:
- **lazy.nvim**'s profiler is great for structured traces, but needed a lot of
manual work to get the traces I wanted.
- **profile.nvim** does proper instrumentation, but was lacking in the UI department.
- **perfanno.nvim** has a great UI, but uses `jit.profile` which is not as
detailed as instrumentation.
The snacks profiler tries to combine the best of all worlds.
## ๐ Usage
The easiest way to use the profiler is to toggle it with the suggested keybindings.
When the profiler stops, it will show a picker using the `on_stop` preset.
To quickly change picker options, you can use the `Snacks.profiler.scratch()`
scratch buffer.
### Caveats
- your Neovim session might slow down when profiling
- due to the overhead of instrumentation, fast functions that are called
often, might skew the results. Best to add those to the `opts.filter_fn` config.
- by default, only captures functions defined on lua modules.
If you want to profile others, add them to `opts.globals`
- the profiler is not perfect and might not capture all calls
- the profiler might not work well with some plugins
- it can only profile `autocmds` created when the profiler is running.
- only `autocmds` with a lua function callback can be profiled
- functions that `resume` or `yield` won't be captured correctly
- functions that do blocking calls like `vim.fn.getchar` will work,
but the time will include the time spent waiting for the blocking call
### Recommended Setup
```lua
{
{
"folke/snacks.nvim",
opts = function()
-- Toggle the profiler
Snacks.toggle.profiler():map("<leader>pp")
-- Toggle the profiler highlights
Snacks.toggle.profiler_highlights():map("<leader>ph")
end,
keys = {
{ "<leader>ps", function() Snacks.profiler.scratch() end, desc = "Profiler Scratch Bufer" },
}
},
-- optional lualine component to show captured events
-- when the profiler is running
{
"nvim-lualine/lualine.nvim",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, Snacks.profiler.status())
end,
},
}
```
### Profiling Neovim Startup
In order to profile Neovim's startup, you need to make sure `snacks.nvim` is
installed and loaded **before** doing anything else. So also before loading
your plugin manager.
You can add something like the below to the top of your `init.lua`.
Then you can profile your Neovim session, with `PROF=1 nvim`.
```lua
if vim.env.PROF then
-- example for lazy.nvim
-- change this to the correct path for your plugin manager
local snacks = vim.fn.stdpath("data") .. "/lazy/snacks.nvim"
vim.opt.rtp:append(snacks)
require("snacks.profiler").startup({
startup = {
event = "VimEnter", -- stop profiler on this event. Defaults to `VimEnter`
-- event = "UIEnter",
-- event = "VeryLazy",
},
})
end
```
### Filtering
For the full definition, see the `snacks.profiler.Filter` type.
Each field can be a string or a boolean.
When a field is a string, it will match the exact value,
unless it starts with `^` in which case it will match the pattern.
When any of the `def`/`ref` fields are `true`,
the filter matches the current location of the cursor.
For example, `{ref_file = true}` will match all traces calling something,
in the current file.
All other fields equal to `true` will match if the trace has a value for that field.
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
profiler = {
-- your profiler configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.profiler.Config
{
autocmds = true,
runtime = vim.env.VIMRUNTIME, ---@type string
-- thresholds for buttons to be shown as info, warn or error
-- value is a tuple of [warn, error]
thresholds = {
time = { 2, 10 },
pct = { 10, 20 },
count = { 10, 100 },
},
on_stop = {
highlights = true, -- highlight entries after stopping the profiler
pick = true, -- show a picker after stopping the profiler (uses the `on_stop` preset)
},
---@type snacks.profiler.Highlights
highlights = {
min_time = 0, -- only highlight entries with time > min_time (in ms)
max_shade = 20, -- time in ms for the darkest shade
badges = { "time", "pct", "count", "trace" },
align = 80,
},
pick = {
picker = "snacks", ---@type snacks.profiler.Picker
---@type snacks.profiler.Badge.type[]
badges = { "time", "count", "name" },
---@type snacks.profiler.Highlights
preview = {
badges = { "time", "pct", "count" },
align = "right",
},
},
startup = {
event = "VimEnter", -- stop profiler on this event. Defaults to `VimEnter`
after = true, -- stop the profiler **after** the event. When false it stops **at** the event
pattern = nil, -- pattern to match for the autocmd
pick = true, -- show a picker after starting the profiler (uses the `startup` preset)
},
---@type table<string, snacks.profiler.Pick|fun():snacks.profiler.Pick?>
presets = {
startup = { min_time = 1, sort = false },
on_stop = {},
filter_by_plugin = function()
return { filter = { def_plugin = vim.fn.input("Filter by plugin: ") } }
end,
},
---@type string[]
globals = {
-- "vim",
-- "vim.api",
-- "vim.keymap",
-- "Snacks.dashboard.Dashboard",
},
-- filter modules by pattern.
-- longest patterns are matched first
filter_mod = {
default = true, -- default value for unmatched patterns
["^vim%."] = false,
["mason-core.functional"] = false,
["mason-core.functional.data"] = false,
["mason-core.optional"] = false,
["which-key.state"] = false,
},
filter_fn = {
default = true,
["^.*%._[^%.]*$"] = false,
["trouble.filter.is"] = false,
["trouble.item.__index"] = false,
["which-key.node.__index"] = false,
["smear_cursor.draw.wo"] = false,
["^ibl%.utils%."] = false,
},
icons = {
time = "๏ ",
pct = "๏ ",
count = "๏ก ",
require = "๓ฐบ ",
modname = "๓ฐผ ",
plugin = "๏ ",
autocmd = "โก",
file = "๏ ",
fn = "๓ฐ ",
status = "๓ฐธ ",
},
}
```
## ๐ Types
### Traces
```lua
---@class snacks.profiler.Trace
---@field name string fully qualified name of the function
---@field time number time in nanoseconds
---@field depth number stack depth
---@field [number] snacks.profiler.Trace child traces
---@field fname string function name
---@field fn function function reference
---@field modname? string module name
---@field require? string special case for require
---@field autocmd? string special case for autocmd
---@field count? number number of calls
---@field def? snacks.profiler.Loc location of the definition
---@field ref? snacks.profiler.Loc location of the reference (caller)
---@field loc? snacks.profiler.Loc normalized location
```
```lua
---@class snacks.profiler.Loc
---@field file string path to the file
---@field line number line number
---@field loc? string normalized location
---@field modname? string module name
---@field plugin? string plugin name
```
### Pick: grouping, filtering and sorting
```lua
---@class snacks.profiler.Find
---@field structure? boolean show traces as a tree or flat list
---@field sort? "time"|"count"|false sort by time or count, or keep original order
---@field loc? "def"|"ref" what location to show in the preview
---@field group? boolean|snacks.profiler.Field group traces by field
---@field filter? snacks.profiler.Filter filter traces by field(s)
---@field min_time? number only show grouped traces with `time >= min_time`
```
```lua
---@class snacks.profiler.Pick: snacks.profiler.Find
---@field picker? snacks.profiler.Picker
```
```lua
---@alias snacks.profiler.Picker "snacks"|"trouble"
---@alias snacks.profiler.Pick.spec snacks.profiler.Pick|{preset?:string}|fun():snacks.profiler.Pick
```
```lua
---@alias snacks.profiler.Field
---| "name" fully qualified name of the function
---| "def" definition
---| "ref" reference (caller)
---| "require" require
---| "autocmd" autocmd
---| "modname" module name of the called function
---| "def_file" file of the definition
---| "def_modname" module name of the definition
---| "def_plugin" plugin that defines the function
---| "ref_file" file of the reference
---| "ref_modname" module name of the reference
---| "ref_plugin" plugin that references the function
```
```lua
---@class snacks.profiler.Filter
---@field name? string|boolean fully qualified name of the function
---@field def? string|boolean location of the definition
---@field ref? string|boolean location of the reference (caller)
---@field require? string|boolean special case for require
---@field autocmd? string|boolean special case for autocmd
---@field modname? string|boolean module name
---@field def_file? string|boolean file of the definition
---@field def_modname? string|boolean module name of the definition
---@field def_plugin? string|boolean plugin that defines the function
---@field ref_file? string|boolean file of the reference
---@field ref_modname? string|boolean module name of the reference
---@field ref_plugin? string|boolean plugin that references the function
```
### UI
```lua
---@alias snacks.profiler.Badge {icon:string, text:string, padding?:boolean, level?:string}
---@alias snacks.profiler.Badge.type "time"|"pct"|"count"|"name"|"trace"
```
```lua
---@class snacks.profiler.Highlights
---@field min_time? number only highlight entries with time >= min_time
---@field max_shade? number -- time in ms for the darkest shade
---@field badges? snacks.profiler.Badge.type[] badges to show
---@field align? "right"|"left"|number align the badges right, left or at a specific column
```
### Other
```lua
---@class snacks.profiler.Startup
---@field event? string
---@field pattern? string|string[] pattern to match for the autocmd
```
```lua
---@alias snacks.profiler.GroupFn fun(entry:snacks.profiler.Trace):{key:string, name?:string}?
```
## ๐ฆ Module
```lua
---@class snacks.profiler
---@field core snacks.profiler.core
---@field loc snacks.profiler.loc
---@field tracer snacks.profiler.tracer
---@field ui snacks.profiler.ui
---@field picker snacks.profiler.picker
Snacks.profiler = {}
```
### `Snacks.profiler.find()`
Group and filter traces
```lua
---@param opts snacks.profiler.Find
Snacks.profiler.find(opts)
```
### `Snacks.profiler.highlight()`
Toggle the profiler highlights
```lua
---@param enable? boolean
Snacks.profiler.highlight(enable)
```
### `Snacks.profiler.pick()`
Group and filter traces and open a picker
```lua
---@param opts? snacks.profiler.Pick.spec
Snacks.profiler.pick(opts)
```
### `Snacks.profiler.running()`
Check if the profiler is running
```lua
Snacks.profiler.running()
```
### `Snacks.profiler.scratch()`
Open a scratch buffer with the profiler picker options
```lua
Snacks.profiler.scratch()
```
### `Snacks.profiler.start()`
Start the profiler
```lua
---@param opts? snacks.profiler.Config
Snacks.profiler.start(opts)
```
### `Snacks.profiler.startup()`
Start the profiler on startup, and stop it after the event has been triggered.
```lua
---@param opts snacks.profiler.Config
Snacks.profiler.startup(opts)
```
### `Snacks.profiler.status()`
Statusline component
```lua
Snacks.profiler.status()
```
### `Snacks.profiler.stop()`
Stop the profiler
```lua
---@param opts? {highlights?:boolean, pick?:snacks.profiler.Pick.spec}
Snacks.profiler.stop(opts)
```
### `Snacks.profiler.toggle()`
Toggle the profiler
```lua
Snacks.profiler.toggle()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/profiler.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/profiler.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 12767
} |
# ๐ฟ quickfile
When doing `nvim somefile.txt`, it will render the file as quickly as possible,
before loading your plugins.
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
quickfile = {
-- your quickfile configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.quickfile.Config
{
-- any treesitter langs to exclude
exclude = { "latex" },
}
``` | {
"source": "folke/snacks.nvim",
"title": "docs/quickfile.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/quickfile.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 548
} |
# ๐ฟ rename
LSP-integrated file renaming with support for plugins like
[neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) and [mini.files](https://github.com/echasnovski/mini.files).
## ๐ Usage
## [mini.files](https://github.com/echasnovski/mini.files)
```lua
vim.api.nvim_create_autocmd("User", {
pattern = "MiniFilesActionRename",
callback = function(event)
Snacks.rename.on_rename_file(event.data.from, event.data.to)
end,
})
```
## [oil.nvim](https://github.com/stevearc/oil.nvim)
```lua
vim.api.nvim_create_autocmd("User", {
pattern = "OilActionsPost",
callback = function(event)
if event.data.actions.type == "move" then
Snacks.rename.on_rename_file(event.data.actions.src_url, event.data.actions.dest_url)
end
end,
})
```
## [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim)
```lua
{
"nvim-neo-tree/neo-tree.nvim",
opts = function(_, opts)
local function on_move(data)
Snacks.rename.on_rename_file(data.source, data.destination)
end
local events = require("neo-tree.events")
opts.event_handlers = opts.event_handlers or {}
vim.list_extend(opts.event_handlers, {
{ event = events.FILE_MOVED, handler = on_move },
{ event = events.FILE_RENAMED, handler = on_move },
})
end,
}
```
## [nvim-tree](https://github.com/nvim-tree/nvim-tree.lua)
```lua
local prev = { new_name = "", old_name = "" } -- Prevents duplicate events
vim.api.nvim_create_autocmd("User", {
pattern = "NvimTreeSetup",
callback = function()
local events = require("nvim-tree.api").events
events.subscribe(events.Event.NodeRenamed, function(data)
if prev.new_name ~= data.new_name or prev.old_name ~= data.old_name then
data = data
Snacks.rename.on_rename_file(data.old_name, data.new_name)
end
end)
end,
})
```
<!-- docgen -->
## ๐ฆ Module
### `Snacks.rename.on_rename_file()`
Lets LSP clients know that a file has been renamed
```lua
---@param from string
---@param to string
---@param rename? fun()
Snacks.rename.on_rename_file(from, to, rename)
```
### `Snacks.rename.rename_file()`
Renames the provided file, or the current buffer's file.
Prompt for the new filename if `to` is not provided.
do the rename, and trigger LSP handlers
```lua
---@param opts? {from?: string, to?:string, on_rename?: fun(to:string, from:string, ok:boolean)}
Snacks.rename.rename_file(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/rename.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/rename.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 2422
} |
# ๐ฟ scope
Scope detection based on treesitter or indent.
The indent-based algorithm is similar to what is used
in [mini.indentscope](https://github.com/echasnovski/mini.indentscope).
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
scope = {
-- your scope configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.scope.Config
---@field max_size? number
---@field enabled? boolean
{
-- absolute minimum size of the scope.
-- can be less if the scope is a top-level single line scope
min_size = 2,
-- try to expand the scope to this size
max_size = nil,
cursor = true, -- when true, the column of the cursor is used to determine the scope
edge = true, -- include the edge of the scope (typically the line above and below with smaller indent)
siblings = false, -- expand single line scopes with single line siblings
-- what buffers to attach to
filter = function(buf)
return vim.bo[buf].buftype == ""
end,
-- debounce scope detection in ms
debounce = 30,
treesitter = {
-- detect scope based on treesitter.
-- falls back to indent based detection if not available
enabled = true,
injections = true, -- include language injections when detecting scope (useful for languages like `vue`)
---@type string[]|{enabled?:boolean}
blocks = {
enabled = false, -- enable to use the following blocks
"function_declaration",
"function_definition",
"method_declaration",
"method_definition",
"class_declaration",
"class_definition",
"do_statement",
"while_statement",
"repeat_statement",
"if_statement",
"for_statement",
},
-- these treesitter fields will be considered as blocks
field_blocks = {
"local_declaration",
},
},
-- These keymaps will only be set if the `scope` plugin is enabled.
-- Alternatively, you can set them manually in your config,
-- using the `Snacks.scope.textobject` and `Snacks.scope.jump` functions.
keys = {
---@type table<string, snacks.scope.TextObject|{desc?:string}>
textobject = {
ii = {
min_size = 2, -- minimum size of the scope
edge = false, -- inner scope
cursor = false,
treesitter = { blocks = { enabled = false } },
desc = "inner scope",
},
ai = {
cursor = false,
min_size = 2, -- minimum size of the scope
treesitter = { blocks = { enabled = false } },
desc = "full scope",
},
},
---@type table<string, snacks.scope.Jump|{desc?:string}>
jump = {
["[i"] = {
min_size = 1, -- allow single line scopes
bottom = false,
cursor = false,
edge = true,
treesitter = { blocks = { enabled = false } },
desc = "jump to top edge of scope",
},
["]i"] = {
min_size = 1, -- allow single line scopes
bottom = true,
cursor = false,
edge = true,
treesitter = { blocks = { enabled = false } },
desc = "jump to bottom edge of scope",
},
},
},
}
```
## ๐ Types
```lua
---@class snacks.scope.Opts: snacks.scope.Config,{}
---@field buf? number
---@field pos? {[1]:number, [2]:number} -- (1,0) indexed
---@field end_pos? {[1]:number, [2]:number} -- (1,0) indexed
```
```lua
---@class snacks.scope.TextObject: snacks.scope.Opts
---@field linewise? boolean if nil, use visual mode. Defaults to `false` when not in visual mode
---@field notify? boolean show a notification when no scope is found (defaults to true)
```
```lua
---@class snacks.scope.Jump: snacks.scope.Opts
---@field bottom? boolean if true, jump to the bottom of the scope, otherwise to the top
---@field notify? boolean show a notification when no scope is found (defaults to true)
```
```lua
---@alias snacks.scope.Attach.cb fun(win: number, buf: number, scope:snacks.scope.Scope?, prev:snacks.scope.Scope?)
```
```lua
---@alias snacks.scope.scope {buf: number, from: number, to: number, indent?: number}
```
## ๐ฆ Module
### `Snacks.scope.attach()`
Attach a scope listener
```lua
---@param cb snacks.scope.Attach.cb
---@param opts? snacks.scope.Config
---@return snacks.scope.Listener
Snacks.scope.attach(cb, opts)
```
### `Snacks.scope.get()`
```lua
---@param cb fun(scope?: snacks.scope.Scope)
---@param opts? snacks.scope.Opts|{parse?:boolean}
Snacks.scope.get(cb, opts)
```
### `Snacks.scope.jump()`
Jump to the top or bottom of the scope
If the scope is the same as the current scope, it will jump to the parent scope instead.
```lua
---@param opts? snacks.scope.Jump
Snacks.scope.jump(opts)
```
### `Snacks.scope.textobject()`
Text objects for indent scopes.
Best to use with Treesitter disabled.
When in visual mode, it will select the scope containing the visual selection.
When the scope is the same as the visual selection, it will select the parent scope instead.
```lua
---@param opts? snacks.scope.TextObject
Snacks.scope.textobject(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/scope.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/scope.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 5141
} |
# ๐ฟ scratch
Quickly open scratch buffers for testing code, creating notes or
just messing around. Scratch buffers are organized by using context
like your working directory, Git branch and `vim.v.count1`.
It supports templates, custom keymaps, and auto-saves when you hide the buffer.
In lua buffers, pressing `<cr>` will execute the buffer / selection with
`Snacks.debug.run()` that will show print output inline and show errors as diagnostics.


## ๐ Usage
Suggested config:
```lua
{
"folke/snacks.nvim",
keys = {
{ "<leader>.", function() Snacks.scratch() end, desc = "Toggle Scratch Buffer" },
{ "<leader>S", function() Snacks.scratch.select() end, desc = "Select Scratch Buffer" },
}
}
```
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
scratch = {
-- your scratch configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.scratch.Config
---@field win? snacks.win.Config scratch window
---@field template? string template for new buffers
---@field file? string scratch file path. You probably don't need to set this.
---@field ft? string|fun():string the filetype of the scratch buffer
{
name = "Scratch",
ft = function()
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then
return vim.bo.filetype
end
return "markdown"
end,
---@type string|string[]?
icon = nil, -- `icon|{icon, icon_hl}`. defaults to the filetype icon
root = vim.fn.stdpath("data") .. "/scratch",
autowrite = true, -- automatically write when the buffer is hidden
-- unique key for the scratch file is based on:
-- * name
-- * ft
-- * vim.v.count1 (useful for keymaps)
-- * cwd (optional)
-- * branch (optional)
filekey = {
cwd = true, -- use current working directory
branch = true, -- use current branch name
count = true, -- use vim.v.count1
},
win = { style = "scratch" },
---@type table<string, snacks.win.Config>
win_by_ft = {
lua = {
keys = {
["source"] = {
"<cr>",
function(self)
local name = "scratch." .. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ":e")
Snacks.debug.run({ buf = self.buf, name = name })
end,
desc = "Source buffer",
mode = { "n", "x" },
},
},
},
},
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `scratch`
```lua
{
width = 100,
height = 30,
bo = { buftype = "", buflisted = false, bufhidden = "hide", swapfile = false },
minimal = false,
noautocmd = false,
-- position = "right",
zindex = 20,
wo = { winhighlight = "NormalFloat:Normal" },
border = "rounded",
title_pos = "center",
footer_pos = "center",
}
```
## ๐ Types
```lua
---@class snacks.scratch.File
---@field file string full path to the scratch buffer
---@field stat uv.fs_stat.result File stat result
---@field name string name of the scratch buffer
---@field ft string file type
---@field icon? string icon for the file type
---@field cwd? string current working directory
---@field branch? string Git branch
---@field count? number vim.v.count1 used to open the buffer
```
## ๐ฆ Module
### `Snacks.scratch()`
```lua
---@type fun(opts?: snacks.scratch.Config): snacks.win
Snacks.scratch()
```
### `Snacks.scratch.list()`
Return a list of scratch buffers sorted by mtime.
```lua
---@return snacks.scratch.File[]
Snacks.scratch.list()
```
### `Snacks.scratch.open()`
Open a scratch buffer with the given options.
If a window is already open with the same buffer,
it will be closed instead.
```lua
---@param opts? snacks.scratch.Config
Snacks.scratch.open(opts)
```
### `Snacks.scratch.select()`
Select a scratch buffer from a list of scratch buffers.
```lua
Snacks.scratch.select()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/scratch.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/scratch.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 4196
} |
# ๐ฟ scroll
Smooth scrolling for Neovim.
Properly handles `scrolloff` and mouse scrolling.
Similar plugins:
- [mini.animate](https://github.com/echasnovski/mini.animate)
- [neoscroll.nvim](https://github.com/karb94/neoscroll.nvim)
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
scroll = {
-- your scroll configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.scroll.Config
---@field animate snacks.animate.Config|{}
---@field animate_repeat snacks.animate.Config|{}|{delay:number}
{
animate = {
duration = { step = 15, total = 250 },
easing = "linear",
},
-- faster animation when repeating scroll after delay
animate_repeat = {
delay = 100, -- delay in ms before using the repeat animation
duration = { step = 5, total = 50 },
easing = "linear",
},
-- what buffers to animate
filter = function(buf)
return vim.g.snacks_scroll ~= false and vim.b[buf].snacks_scroll ~= false and vim.bo[buf].buftype ~= "terminal"
end,
}
```
## ๐ Types
```lua
---@alias snacks.scroll.View {topline:number, lnum:number}
```
```lua
---@class snacks.scroll.State
---@field anim? snacks.animate.Animation
---@field win number
---@field buf number
---@field view vim.fn.winsaveview.ret
---@field current vim.fn.winsaveview.ret
---@field target vim.fn.winsaveview.ret
---@field scrolloff number
---@field changedtick number
---@field last number vim.uv.hrtime of last scroll
```
## ๐ฆ Module
### `Snacks.scroll.disable()`
```lua
Snacks.scroll.disable()
```
### `Snacks.scroll.enable()`
```lua
Snacks.scroll.enable()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/scroll.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/scroll.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 1747
} |
# ๐ฟ statuscolumn
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
statuscolumn = {
-- your statuscolumn configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.statuscolumn.Config
---@field left snacks.statuscolumn.Components
---@field right snacks.statuscolumn.Components
---@field enabled? boolean
{
left = { "mark", "sign" }, -- priority of signs on the left (high to low)
right = { "fold", "git" }, -- priority of signs on the right (high to low)
folds = {
open = false, -- show open fold icons
git_hl = false, -- use Git Signs hl for fold icons
},
git = {
-- patterns to match Git signs
patterns = { "GitSign", "MiniDiffSign" },
},
refresh = 50, -- refresh at most every 50ms
}
```
## ๐ Types
```lua
---@alias snacks.statuscolumn.Component "mark"|"sign"|"fold"|"git"
---@alias snacks.statuscolumn.Components snacks.statuscolumn.Component[]|fun(win:number,buf:number,lnum:number):snacks.statuscolumn.Component[]
```
## ๐ฆ Module
### `Snacks.statuscolumn()`
```lua
---@type fun(): string
Snacks.statuscolumn()
```
### `Snacks.statuscolumn.click_fold()`
```lua
Snacks.statuscolumn.click_fold()
```
### `Snacks.statuscolumn.get()`
```lua
Snacks.statuscolumn.get()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/statuscolumn.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/statuscolumn.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 1407
} |
# ๐ฟ styles
Plugins provide window styles that can be customized
with the `opts.styles` option of `snacks.nvim`.
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
---@type table<string, snacks.win.Config>
styles = {
-- your styles configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## ๐จ Styles
These are the default styles that Snacks provides.
You can customize them by adding your own styles to `opts.styles`.
### `blame_line`
```lua
{
width = 0.6,
height = 0.6,
border = "rounded",
title = " Git Blame ",
title_pos = "center",
ft = "git",
}
```
### `dashboard`
The default style for the dashboard.
When opening the dashboard during startup, only the `bo` and `wo` options are used.
The other options are used with `:lua Snacks.dashboard()`
```lua
{
zindex = 10,
height = 0,
width = 0,
bo = {
bufhidden = "wipe",
buftype = "nofile",
buflisted = false,
filetype = "snacks_dashboard",
swapfile = false,
undofile = false,
},
wo = {
colorcolumn = "",
cursorcolumn = false,
cursorline = false,
foldmethod = "manual",
list = false,
number = false,
relativenumber = false,
sidescrolloff = 0,
signcolumn = "no",
spell = false,
statuscolumn = "",
statusline = "",
winbar = "",
winhighlight = "Normal:SnacksDashboardNormal,NormalFloat:SnacksDashboardNormal",
wrap = false,
},
}
```
### `float`
```lua
{
position = "float",
backdrop = 60,
height = 0.9,
width = 0.9,
zindex = 50,
}
```
### `help`
```lua
{
position = "float",
backdrop = false,
border = "top",
row = -1,
width = 0,
height = 0.3,
}
```
### `input`
```lua
{
backdrop = false,
position = "float",
border = "rounded",
title_pos = "center",
height = 1,
width = 60,
relative = "editor",
noautocmd = true,
row = 2,
-- relative = "cursor",
-- row = -3,
-- col = 0,
wo = {
winhighlight = "NormalFloat:SnacksInputNormal,FloatBorder:SnacksInputBorder,FloatTitle:SnacksInputTitle",
cursorline = false,
},
bo = {
filetype = "snacks_input",
buftype = "prompt",
},
--- buffer local variables
b = {
completion = false, -- disable blink completions in input
},
keys = {
n_esc = { "<esc>", { "cmp_close", "cancel" }, mode = "n", expr = true },
i_esc = { "<esc>", { "cmp_close", "stopinsert" }, mode = "i", expr = true },
i_cr = { "<cr>", { "cmp_accept", "confirm" }, mode = "i", expr = true },
i_tab = { "<tab>", { "cmp_select_next", "cmp" }, mode = "i", expr = true },
i_ctrl_w = { "<c-w>", "<c-s-w>", mode = "i", expr = true },
i_up = { "<up>", { "hist_up" }, mode = { "i", "n" } },
i_down = { "<down>", { "hist_down" }, mode = { "i", "n" } },
q = "cancel",
},
}
```
### `lazygit`
```lua
{}
```
### `minimal`
```lua
{
wo = {
cursorcolumn = false,
cursorline = false,
cursorlineopt = "both",
colorcolumn = "",
fillchars = "eob: ,lastline:โฆ",
list = false,
listchars = "extends:โฆ,tab: ",
number = false,
relativenumber = false,
signcolumn = "no",
spell = false,
winbar = "",
statuscolumn = "",
wrap = false,
sidescrolloff = 0,
},
}
```
### `notification`
```lua
{
border = "rounded",
zindex = 100,
ft = "markdown",
wo = {
winblend = 5,
wrap = false,
conceallevel = 2,
colorcolumn = "",
},
bo = { filetype = "snacks_notif" },
}
```
### `notification_history`
```lua
{
border = "rounded",
zindex = 100,
width = 0.6,
height = 0.6,
minimal = false,
title = " Notification History ",
title_pos = "center",
ft = "markdown",
bo = { filetype = "snacks_notif_history", modifiable = false },
wo = { winhighlight = "Normal:SnacksNotifierHistory" },
keys = { q = "close" },
}
```
### `scratch`
```lua
{
width = 100,
height = 30,
bo = { buftype = "", buflisted = false, bufhidden = "hide", swapfile = false },
minimal = false,
noautocmd = false,
-- position = "right",
zindex = 20,
wo = { winhighlight = "NormalFloat:Normal" },
border = "rounded",
title_pos = "center",
footer_pos = "center",
}
```
### `snacks_image`
```lua
{
relative = "cursor",
border = "rounded",
focusable = false,
backdrop = false,
row = 1,
col = 1,
-- width/height are automatically set by the image size unless specified below
}
```
### `split`
```lua
{
position = "bottom",
height = 0.4,
width = 0.4,
}
```
### `terminal`
```lua
{
bo = {
filetype = "snacks_terminal",
},
wo = {},
keys = {
q = "hide",
gf = function(self)
local f = vim.fn.findfile(vim.fn.expand("<cfile>"), "**")
if f == "" then
Snacks.notify.warn("No file under cursor")
else
self:hide()
vim.schedule(function()
vim.cmd("e " .. f)
end)
end
end,
term_normal = {
"<esc>",
function(self)
self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer()
if self.esc_timer:is_active() then
self.esc_timer:stop()
vim.cmd("stopinsert")
else
self.esc_timer:start(200, 0, function() end)
return "<esc>"
end
end,
mode = "t",
expr = true,
desc = "Double escape to normal mode",
},
},
}
```
### `zen`
```lua
{
enter = true,
fixbuf = false,
minimal = false,
width = 120,
height = 0,
backdrop = { transparent = true, blend = 40 },
keys = { q = false },
zindex = 40,
wo = {
winhighlight = "NormalFloat:Normal",
},
w = {
snacks_main = true,
},
}
```
### `zoom_indicator`
fullscreen indicator
only shown when the window is maximized
```lua
{
text = "โ zoom ๓ฐ ",
minimal = true,
enter = false,
focusable = false,
height = 1,
row = 0,
col = -1,
backdrop = false,
}
``` | {
"source": "folke/snacks.nvim",
"title": "docs/styles.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/styles.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 5966
} |
# ๐ฟ terminal
Create and toggle terminal windows.
Based on the provided options, some defaults will be set:
- if no `cmd` is provided, the window will be opened in a bottom split
- if `cmd` is provided, the window will be opened in a floating window
- for splits, a `winbar` will be added with the terminal title

## ๐ Usage
### Edgy Integration
```lua
{
"folke/edgy.nvim",
---@module 'edgy'
---@param opts Edgy.Config
opts = function(_, opts)
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
opts[pos] = opts[pos] or {}
table.insert(opts[pos], {
ft = "snacks_terminal",
size = { height = 0.4 },
title = "%{b:snacks_terminal.id}: %{b:term_title}",
filter = function(_buf, win)
return vim.w[win].snacks_win
and vim.w[win].snacks_win.position == pos
and vim.w[win].snacks_win.relative == "editor"
and not vim.w[win].trouble_preview
end,
})
end
end,
}
```
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
terminal = {
-- your terminal configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.terminal.Config
---@field win? snacks.win.Config|{}
---@field shell? string|string[] The shell to use. Defaults to `vim.o.shell`
---@field override? fun(cmd?: string|string[], opts?: snacks.terminal.Opts) Use this to use a different terminal implementation
{
win = { style = "terminal" },
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `terminal`
```lua
{
bo = {
filetype = "snacks_terminal",
},
wo = {},
keys = {
q = "hide",
gf = function(self)
local f = vim.fn.findfile(vim.fn.expand("<cfile>"), "**")
if f == "" then
Snacks.notify.warn("No file under cursor")
else
self:hide()
vim.schedule(function()
vim.cmd("e " .. f)
end)
end
end,
term_normal = {
"<esc>",
function(self)
self.esc_timer = self.esc_timer or (vim.uv or vim.loop).new_timer()
if self.esc_timer:is_active() then
self.esc_timer:stop()
vim.cmd("stopinsert")
else
self.esc_timer:start(200, 0, function() end)
return "<esc>"
end
end,
mode = "t",
expr = true,
desc = "Double escape to normal mode",
},
},
}
```
## ๐ Types
```lua
---@class snacks.terminal.Opts: snacks.terminal.Config
---@field cwd? string
---@field env? table<string, string>
---@field start_insert? boolean start insert mode when starting the terminal
---@field auto_insert? boolean start insert mode when entering the terminal buffer
---@field auto_close? boolean close the terminal buffer when the process exits
---@field interactive? boolean shortcut for `start_insert`, `auto_close` and `auto_insert` (default: true)
```
## ๐ฆ Module
```lua
---@class snacks.terminal: snacks.win
---@field cmd? string | string[]
---@field opts snacks.terminal.Opts
Snacks.terminal = {}
```
### `Snacks.terminal()`
```lua
---@type fun(cmd?: string|string[], opts?: snacks.terminal.Opts): snacks.terminal
Snacks.terminal()
```
### `Snacks.terminal.colorize()`
Colorize the current buffer.
Replaces ansii color codes with the actual colors.
Example:
```sh
ls -la --color=always | nvim - -c "lua Snacks.terminal.colorize()"
```
```lua
Snacks.terminal.colorize()
```
### `Snacks.terminal.get()`
Get or create a terminal window.
The terminal id is based on the `cmd`, `cwd`, `env` and `vim.v.count1` options.
`opts.create` defaults to `true`.
```lua
---@param cmd? string | string[]
---@param opts? snacks.terminal.Opts| {create?: boolean}
---@return snacks.win? terminal, boolean? created
Snacks.terminal.get(cmd, opts)
```
### `Snacks.terminal.list()`
```lua
---@return snacks.win[]
Snacks.terminal.list()
```
### `Snacks.terminal.open()`
Open a new terminal window.
```lua
---@param cmd? string | string[]
---@param opts? snacks.terminal.Opts
Snacks.terminal.open(cmd, opts)
```
### `Snacks.terminal.toggle()`
Toggle a terminal window.
The terminal id is based on the `cmd`, `cwd`, `env` and `vim.v.count1` options.
```lua
---@param cmd? string | string[]
---@param opts? snacks.terminal.Opts
Snacks.terminal.toggle(cmd, opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/terminal.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/terminal.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 4615
} |
# ๐ฟ toggle
Toggle keymaps integrated with which-key icons / colors

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
toggle = {
-- your toggle configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.toggle.Config
---@field icon? string|{ enabled: string, disabled: string }
---@field color? string|{ enabled: string, disabled: string }
---@field wk_desc? string|{ enabled: string, disabled: string }
---@field map? fun(mode: string|string[], lhs: string, rhs: string|fun(), opts?: vim.keymap.set.Opts)
---@field which_key? boolean
---@field notify? boolean
{
map = vim.keymap.set, -- keymap.set function to use
which_key = true, -- integrate with which-key to show enabled/disabled icons and colors
notify = true, -- show a notification when toggling
-- icons for enabled/disabled states
icon = {
enabled = "๏
",
disabled = "๏ ",
},
-- colors for enabled/disabled states
color = {
enabled = "green",
disabled = "yellow",
},
wk_desc = {
enabled = "Disable ",
disabled = "Enable ",
},
}
```
## ๐ Types
```lua
---@class snacks.toggle.Opts: snacks.toggle.Config
---@field id? string
---@field name string
---@field get fun():boolean
---@field set fun(state:boolean)
```
## ๐ฆ Module
### `Snacks.toggle()`
```lua
---@type fun(... :snacks.toggle.Opts): snacks.toggle.Class
Snacks.toggle()
```
### `Snacks.toggle.animate()`
```lua
Snacks.toggle.animate()
```
### `Snacks.toggle.diagnostics()`
```lua
---@param opts? snacks.toggle.Config
Snacks.toggle.diagnostics(opts)
```
### `Snacks.toggle.dim()`
```lua
Snacks.toggle.dim()
```
### `Snacks.toggle.get()`
```lua
---@param id string
---@return snacks.toggle.Class?
Snacks.toggle.get(id)
```
### `Snacks.toggle.indent()`
```lua
Snacks.toggle.indent()
```
### `Snacks.toggle.inlay_hints()`
```lua
---@param opts? snacks.toggle.Config
Snacks.toggle.inlay_hints(opts)
```
### `Snacks.toggle.line_number()`
```lua
---@param opts? snacks.toggle.Config
Snacks.toggle.line_number(opts)
```
### `Snacks.toggle.new()`
```lua
---@param ... snacks.toggle.Opts
Snacks.toggle.new(...)
```
### `Snacks.toggle.option()`
```lua
---@param option string
---@param opts? snacks.toggle.Config | {on?: unknown, off?: unknown, global?: boolean}
Snacks.toggle.option(option, opts)
```
### `Snacks.toggle.profiler()`
```lua
Snacks.toggle.profiler()
```
### `Snacks.toggle.profiler_highlights()`
```lua
Snacks.toggle.profiler_highlights()
```
### `Snacks.toggle.scroll()`
```lua
Snacks.toggle.scroll()
```
### `Snacks.toggle.treesitter()`
```lua
---@param opts? snacks.toggle.Config
Snacks.toggle.treesitter(opts)
```
### `Snacks.toggle.words()`
```lua
Snacks.toggle.words()
```
### `Snacks.toggle.zen()`
```lua
Snacks.toggle.zen()
```
### `Snacks.toggle.zoom()`
```lua
Snacks.toggle.zoom()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/toggle.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/toggle.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3085
} |
# ๐ฟ util
<!-- docgen -->
## ๐ Types
```lua
---@alias snacks.util.hl table<string, string|vim.api.keyset.highlight>
```
## ๐ฆ Module
### `Snacks.util.blend()`
```lua
---@param fg string foreground color
---@param bg string background color
---@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg
Snacks.util.blend(fg, bg, alpha)
```
### `Snacks.util.bo()`
Set buffer-local options.
```lua
---@param buf number
---@param bo vim.bo|{}
Snacks.util.bo(buf, bo)
```
### `Snacks.util.color()`
```lua
---@param group string|string[] hl group to get color from
---@param prop? string property to get. Defaults to "fg"
Snacks.util.color(group, prop)
```
### `Snacks.util.debounce()`
```lua
---@generic T
---@param fn T
---@param opts? {ms?:number}
---@return T
Snacks.util.debounce(fn, opts)
```
### `Snacks.util.file_decode()`
Decodes a file name to a string.
```lua
---@param str string
Snacks.util.file_decode(str)
```
### `Snacks.util.file_encode()`
Encodes a string to be used as a file name.
```lua
---@param str string
Snacks.util.file_encode(str)
```
### `Snacks.util.get_lang()`
```lua
---@param lang string|number|nil
---@overload fun(buf:number):string?
---@overload fun(ft:string):string?
---@return string?
Snacks.util.get_lang(lang)
```
### `Snacks.util.icon()`
Get an icon from `mini.icons` or `nvim-web-devicons`.
```lua
---@param name string
---@param cat? string defaults to "file"
---@param opts? { fallback?: {dir?:string, file?:string} }
---@return string, string?
Snacks.util.icon(name, cat, opts)
```
### `Snacks.util.is_float()`
```lua
---@param win? number
Snacks.util.is_float(win)
```
### `Snacks.util.is_transparent()`
Check if the colorscheme is transparent.
```lua
Snacks.util.is_transparent()
```
### `Snacks.util.keycode()`
```lua
---@param str string
Snacks.util.keycode(str)
```
### `Snacks.util.normkey()`
```lua
---@param key string
Snacks.util.normkey(key)
```
### `Snacks.util.on_key()`
```lua
---@param key string
---@param cb fun(key:string)
Snacks.util.on_key(key, cb)
```
### `Snacks.util.on_module()`
Call a function when a module is loaded.
The callback is called immediately if the module is already loaded.
Otherwise, it is called when the module is loaded.
```lua
---@param modname string
---@param cb fun(modname:string)
Snacks.util.on_module(modname, cb)
```
### `Snacks.util.redraw()`
Redraw the window.
Optimized for Neovim >= 0.10
```lua
---@param win number
Snacks.util.redraw(win)
```
### `Snacks.util.redraw_range()`
Redraw the range of lines in the window.
Optimized for Neovim >= 0.10
```lua
---@param win number
---@param from number -- 1-indexed, inclusive
---@param to number -- 1-indexed, inclusive
Snacks.util.redraw_range(win, from, to)
```
### `Snacks.util.ref()`
```lua
---@generic T
---@param t T
---@return { value?:T }|fun():T?
Snacks.util.ref(t)
```
### `Snacks.util.set_hl()`
Ensures the hl groups are always set, even after a colorscheme change.
```lua
---@param groups snacks.util.hl
---@param opts? { prefix?:string, default?:boolean, managed?:boolean }
Snacks.util.set_hl(groups, opts)
```
### `Snacks.util.spinner()`
```lua
Snacks.util.spinner()
```
### `Snacks.util.throttle()`
```lua
---@generic T
---@param fn T
---@param opts? {ms?:number}
---@return T
Snacks.util.throttle(fn, opts)
```
### `Snacks.util.var()`
Get a buffer or global variable.
```lua
---@generic T
---@param buf? number
---@param name string
---@param default? T
---@return T
Snacks.util.var(buf, name, default)
```
### `Snacks.util.winhl()`
Merges vim.wo.winhighlight options.
Option values can be a string or a dictionary.
```lua
---@param ... string|table<string, string>
Snacks.util.winhl(...)
```
### `Snacks.util.wo()`
Set window-local options.
```lua
---@param win number
---@param wo vim.wo|{}|{winhighlight: string|table<string, string>}
Snacks.util.wo(win, wo)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/util.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/util.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 3896
} |
# ๐ฟ win
Easily create and manage floating windows or splits
## ๐ Usage
```lua
Snacks.win({
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
width = 0.6,
height = 0.6,
wo = {
spell = false,
wrap = false,
signcolumn = "yes",
statuscolumn = " ",
conceallevel = 3,
},
})
```

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
win = {
-- your win configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.win.Config: vim.api.keyset.win_config
---@field style? string merges with config from `Snacks.config.styles[style]`
---@field show? boolean Show the window immediately (default: true)
---@field height? number|fun(self:snacks.win):number Height of the window. Use <1 for relative height. 0 means full height. (default: 0.9)
---@field width? number|fun(self:snacks.win):number Width of the window. Use <1 for relative width. 0 means full width. (default: 0.9)
---@field min_height? number Minimum height of the window
---@field max_height? number Maximum height of the window
---@field min_width? number Minimum width of the window
---@field max_width? number Maximum width of the window
---@field col? number|fun(self:snacks.win):number Column of the window. Use <1 for relative column. (default: center)
---@field row? number|fun(self:snacks.win):number Row of the window. Use <1 for relative row. (default: center)
---@field minimal? boolean Disable a bunch of options to make the window minimal (default: true)
---@field position? "float"|"bottom"|"top"|"left"|"right"
---@field border? "none"|"top"|"right"|"bottom"|"left"|"hpad"|"vpad"|"rounded"|"single"|"double"|"solid"|"shadow"|string[]|false
---@field buf? number If set, use this buffer instead of creating a new one
---@field file? string If set, use this file instead of creating a new buffer
---@field enter? boolean Enter the window after opening (default: false)
---@field backdrop? number|false|snacks.win.Backdrop Opacity of the backdrop (default: 60)
---@field wo? vim.wo|{} window options
---@field bo? vim.bo|{} buffer options
---@field b? table<string, any> buffer local variables
---@field w? table<string, any> window local variables
---@field ft? string filetype to use for treesitter/syntax highlighting. Won't override existing filetype
---@field scratch_ft? string filetype to use for scratch buffers
---@field keys? table<string, false|string|fun(self: snacks.win)|snacks.win.Keys> Key mappings
---@field on_buf? fun(self: snacks.win) Callback after opening the buffer
---@field on_win? fun(self: snacks.win) Callback after opening the window
---@field on_close? fun(self: snacks.win) Callback after closing the window
---@field fixbuf? boolean don't allow other buffers to be opened in this window
---@field text? string|string[]|fun():(string[]|string) Initial lines to set in the buffer
---@field actions? table<string, snacks.win.Action.spec> Actions that can be used in key mappings
---@field resize? boolean Automatically resize the window when the editor is resized
{
show = true,
fixbuf = true,
relative = "editor",
position = "float",
minimal = true,
wo = {
winhighlight = "Normal:SnacksNormal,NormalNC:SnacksNormalNC,WinBar:SnacksWinBar,WinBarNC:SnacksWinBarNC",
},
bo = {},
keys = {
q = "close",
},
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `float`
```lua
{
position = "float",
backdrop = 60,
height = 0.9,
width = 0.9,
zindex = 50,
}
```
### `help`
```lua
{
position = "float",
backdrop = false,
border = "top",
row = -1,
width = 0,
height = 0.3,
}
```
### `minimal`
```lua
{
wo = {
cursorcolumn = false,
cursorline = false,
cursorlineopt = "both",
colorcolumn = "",
fillchars = "eob: ,lastline:โฆ",
list = false,
listchars = "extends:โฆ,tab: ",
number = false,
relativenumber = false,
signcolumn = "no",
spell = false,
winbar = "",
statuscolumn = "",
wrap = false,
sidescrolloff = 0,
},
}
```
### `split`
```lua
{
position = "bottom",
height = 0.4,
width = 0.4,
}
```
## ๐ Types
```lua
---@class snacks.win.Keys: vim.api.keyset.keymap
---@field [1]? string
---@field [2]? string|string[]|fun(self: snacks.win): string?
---@field mode? string|string[]
```
```lua
---@class snacks.win.Event: vim.api.keyset.create_autocmd
---@field buf? true
---@field win? true
---@field callback? fun(self: snacks.win, ev:vim.api.keyset.create_autocmd.callback_args):boolean?
```
```lua
---@class snacks.win.Backdrop
---@field bg? string
---@field blend? number
---@field transparent? boolean defaults to true
---@field win? snacks.win.Config overrides the backdrop window config
```
```lua
---@class snacks.win.Dim
---@field width number width of the window, without borders
---@field height number height of the window, without borders
---@field row number row of the window (0-indexed)
---@field col number column of the window (0-indexed)
---@field border? boolean whether the window has a border
```
```lua
---@alias snacks.win.Action.fn fun(self: snacks.win):(boolean|string?)
---@alias snacks.win.Action.spec snacks.win.Action|snacks.win.Action.fn
---@class snacks.win.Action
---@field action snacks.win.Action.fn
---@field desc? string
```
## ๐ฆ Module
```lua
---@class snacks.win
---@field id number
---@field buf? number
---@field scratch_buf? number
---@field win? number
---@field opts snacks.win.Config
---@field augroup? number
---@field backdrop? snacks.win
---@field keys snacks.win.Keys[]
---@field events (snacks.win.Event|{event:string|string[]})[]
---@field meta table<string, any>
---@field closed? boolean
Snacks.win = {}
```
### `Snacks.win()`
```lua
---@type fun(opts? :snacks.win.Config|{}): snacks.win
Snacks.win()
```
### `Snacks.win.new()`
```lua
---@param opts? snacks.win.Config|{}
---@return snacks.win
Snacks.win.new(opts)
```
### `win:action()`
```lua
---@param actions string|string[]
---@return (fun(): boolean|string?) action, string? desc
win:action(actions)
```
### `win:add_padding()`
```lua
win:add_padding()
```
### `win:border_size()`
Calculate the size of the border
```lua
win:border_size()
```
### `win:border_text_width()`
```lua
win:border_text_width()
```
### `win:buf_valid()`
```lua
win:buf_valid()
```
### `win:close()`
```lua
---@param opts? { buf: boolean }
win:close(opts)
```
### `win:destroy()`
```lua
win:destroy()
```
### `win:dim()`
```lua
---@param parent? snacks.win.Dim
win:dim(parent)
```
### `win:execute()`
```lua
---@param actions string|string[]
win:execute(actions)
```
### `win:fixbuf()`
```lua
win:fixbuf()
```
### `win:focus()`
```lua
win:focus()
```
### `win:has_border()`
```lua
win:has_border()
```
### `win:hide()`
```lua
win:hide()
```
### `win:hscroll()`
```lua
---@param left? boolean
win:hscroll(left)
```
### `win:is_floating()`
```lua
win:is_floating()
```
### `win:line()`
```lua
win:line(line)
```
### `win:lines()`
```lua
---@param from? number 1-indexed, inclusive
---@param to? number 1-indexed, inclusive
win:lines(from, to)
```
### `win:map()`
```lua
win:map()
```
### `win:on()`
```lua
---@param event string|string[]
---@param cb fun(self: snacks.win, ev:vim.api.keyset.create_autocmd.callback_args):boolean?
---@param opts? snacks.win.Event
win:on(event, cb, opts)
```
### `win:on_current_tab()`
```lua
win:on_current_tab()
```
### `win:on_resize()`
```lua
win:on_resize()
```
### `win:parent_size()`
```lua
---@return { height: number, width: number }
win:parent_size()
```
### `win:redraw()`
```lua
win:redraw()
```
### `win:scratch()`
```lua
win:scratch()
```
### `win:scroll()`
```lua
---@param up? boolean
win:scroll(up)
```
### `win:set_buf()`
```lua
---@param buf number
win:set_buf(buf)
```
### `win:set_title()`
```lua
---@param title string|{[1]:string, [2]:string}[]
---@param pos? "center"|"left"|"right"
win:set_title(title, pos)
```
### `win:show()`
```lua
win:show()
```
### `win:size()`
```lua
---@return { height: number, width: number }
win:size()
```
### `win:text()`
```lua
---@param from? number 1-indexed, inclusive
---@param to? number 1-indexed, inclusive
win:text(from, to)
```
### `win:toggle()`
```lua
win:toggle()
```
### `win:toggle_help()`
```lua
---@param opts? {col_width?: number, key_width?: number, win?: snacks.win.Config}
win:toggle_help(opts)
```
### `win:update()`
```lua
win:update()
```
### `win:valid()`
```lua
win:valid()
```
### `win:win_valid()`
```lua
win:win_valid()
``` | {
"source": "folke/snacks.nvim",
"title": "docs/win.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/win.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 8848
} |
# ๐ฟ words
Auto-show LSP references and quickly navigate between them
<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
words = {
-- your words configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.words.Config
---@field enabled? boolean
{
debounce = 200, -- time in ms to wait before updating
notify_jump = false, -- show a notification when jumping
notify_end = true, -- show a notification when reaching the end
foldopen = true, -- open folds after jumping
jumplist = true, -- set jump point before jumping
modes = { "n", "i", "c" }, -- modes to show references
filter = function(buf) -- what buffers to enable `snacks.words`
return vim.g.snacks_words ~= false and vim.b[buf].snacks_words ~= false
end,
}
```
## ๐ฆ Module
### `Snacks.words.clear()`
```lua
Snacks.words.clear()
```
### `Snacks.words.disable()`
```lua
Snacks.words.disable()
```
### `Snacks.words.enable()`
```lua
Snacks.words.enable()
```
### `Snacks.words.is_enabled()`
```lua
---@param opts? number|{buf?:number, modes:boolean} if modes is true, also check if the current mode is enabled
Snacks.words.is_enabled(opts)
```
### `Snacks.words.jump()`
```lua
---@param count? number
---@param cycle? boolean
Snacks.words.jump(count, cycle)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/words.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/words.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 1442
} |
# ๐ฟ zen
Zen mode โข distraction-free coding.
Integrates with `Snacks.toggle` to toggle various UI elements
and with `Snacks.dim` to dim code out of scope.
Similar plugins:
- [zen-mode.nvim](https://github.com/folke/zen-mode.nvim)
- [true-zen.nvim](https://github.com/pocco81/true-zen.nvim)

<!-- docgen -->
## ๐ฆ Setup
```lua
-- lazy.nvim
{
"folke/snacks.nvim",
---@type snacks.Config
opts = {
zen = {
-- your zen configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
}
}
```
## โ๏ธ Config
```lua
---@class snacks.zen.Config
{
-- You can add any `Snacks.toggle` id here.
-- Toggle state is restored when the window is closed.
-- Toggle config options are NOT merged.
---@type table<string, boolean>
toggles = {
dim = true,
git_signs = false,
mini_diff_signs = false,
-- diagnostics = false,
-- inlay_hints = false,
},
show = {
statusline = false, -- can only be shown when using the global statusline
tabline = false,
},
---@type snacks.win.Config
win = { style = "zen" },
--- Callback when the window is opened.
---@param win snacks.win
on_open = function(win) end,
--- Callback when the window is closed.
---@param win snacks.win
on_close = function(win) end,
--- Options for the `Snacks.zen.zoom()`
---@type snacks.zen.Config
zoom = {
toggles = {},
show = { statusline = true, tabline = true },
win = {
backdrop = false,
width = 0, -- full width
},
},
}
```
## ๐จ Styles
Check the [styles](https://github.com/folke/snacks.nvim/blob/main/docs/styles.md)
docs for more information on how to customize these styles
### `zen`
```lua
{
enter = true,
fixbuf = false,
minimal = false,
width = 120,
height = 0,
backdrop = { transparent = true, blend = 40 },
keys = { q = false },
zindex = 40,
wo = {
winhighlight = "NormalFloat:Normal",
},
w = {
snacks_main = true,
},
}
```
### `zoom_indicator`
fullscreen indicator
only shown when the window is maximized
```lua
{
text = "โ zoom ๓ฐ ",
minimal = true,
enter = false,
focusable = false,
height = 1,
row = 0,
col = -1,
backdrop = false,
}
```
## ๐ฆ Module
### `Snacks.zen()`
```lua
---@type fun(opts: snacks.zen.Config): snacks.win
Snacks.zen()
```
### `Snacks.zen.zen()`
```lua
---@param opts? snacks.zen.Config
Snacks.zen.zen(opts)
```
### `Snacks.zen.zoom()`
```lua
---@param opts? snacks.zen.Config
Snacks.zen.zoom(opts)
``` | {
"source": "folke/snacks.nvim",
"title": "docs/zen.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/docs/zen.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 2624
} |
This sentence uses `$` delimiters to show math inline: $\sqrt{3x-1}+(1+x)^2$
This sentence $E = mc^2$ uses delimiters to show math inline: $`\sqrt{3x-1}+(1+x)^2`$
**The Cauchy-Schwarz Inequality**
$$\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$
**The Cauchy-Schwarz Inequality**
```math
\left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
```

$\int_0^1 x^2 dx$
<!-- snacks: header start
\def\x{5}
snacks: header end -->
$ \x \leq 17 $
```math
``` | {
"source": "folke/snacks.nvim",
"title": "tests/image/math.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/tests/image/math.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 606
} |
```mermaid
sequenceDiagram
participant dotcom
participant iframe
participant viewscreen
dotcom->>iframe: loads html w/ iframe url
iframe->>viewscreen: request template
viewscreen->>iframe: html & javascript
iframe->>dotcom: iframe ready
dotcom->>iframe: set mermaid data on iframe
iframe->>iframe: render mermaid
``` | {
"source": "folke/snacks.nvim",
"title": "tests/image/test-mermaid.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/tests/image/test-mermaid.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 352
} |
# test
## Wikilinks
!![[test.png]]
!![[test.png|options]]
## Injected HTML
<img src="test.png" alt="png" width="200" height="30" />
<a href="https://github.com/folke/lazy.nvim/releases/latest">
<img alt="Latest release" src="https://img.shields.io/github/v/release/folke/lazy.nvim?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41&include_prerelease&sort=semver" />
</a>
## Markdown Links



 | {
"source": "folke/snacks.nvim",
"title": "tests/image/test.md",
"url": "https://github.com/folke/snacks.nvim/blob/main/tests/image/test.md",
"date": "2024-11-02T22:24:00",
"stars": 3907,
"description": "๐ฟ A collection of QoL plugins for Neovim",
"file_size": 534
} |
## NextFaster
A highly performant e-commerce template using Next.js and AI generated content by [@ethanniser](https://x.com/ethanniser), [@RhysSullivan](https://x.com/RhysSullivan) and [@armans-code](https://x.com/ksw_arman)
### Design notes
**Check out the detailed [twitter thread](https://x.com/ethanniser/status/1848442738204643330)**
- Uses [Next.js 15](https://nextjs.org/)
- All mutations are done via [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations)
- [Partial Prerendering](https://vercel.com/blog/partial-prerendering-with-next-js-creating-a-new-default-rendering-model) is used to precompute the shells of pages
- When deployed, these are served statically from the edge
- Dynamic data (such as cart information) is then streamed in
- Uses [Drizzle ORM](https://orm.drizzle.team/docs/overview) on top of [Neon Postgres](https://neon.tech)
- Images stored on [Vercel Blob](https://vercel.com/docs/storage/vercel-blob)
- Used [v0](https://v0.dev) to generate all initial UIs, check out some of the threads we were particularly impressed by:
- [v0 makes pretty impressive search dropdown without a library](https://v0.dev/chat/lFfc68X3fir?b=b_1o4tkiC9EEm&p=0)
- [recreating 'order' page](https://v0.dev/chat/RTBa8dXhx03?b=b_4RguNNUEhLh)
- [recreating 'login' page](https://v0.dev/chat/tijwMFByNX9?b=b_XnRtduKn2oe)
#### AI
- Used [OpenAI](https://openai.com)'s `gpt-4o-mini` with their batch API and the Vercel AI SDK to generate product categories, names and descriptions
- [GetImg.ai](https://getimg.ai) was used to generate product images via the `stable-diffusion-v1-5` model
### Deployment
- Make sure the Vercel project is connected to a Vercel Postgres (Neon) database and Vercel Blob Storage
- Run `pnpm db:push` to apply schema to your db
### Local dev
- Run `vc env pull` to get a `.env.local` file with your db credentials.
- Run `pnpm install` && `pnpm dev` to start developing.
- The data/data.zip includes a ~300 MB data.sql file with the full schema and 1,000,000+ products (_Note, the data exceeds the size limit allowed by the free tier for Neon on Vercel_ [see more](https://vercel.com/docs/storage/vercel-postgres/usage-and-pricing#pricing)). To seed Vercel Postgres with this data:
- Unzip data.zip to data.sql.
- Run `psql "YOUR_CONNECTION_STRING" -f data.sql`.
- For DB migrations with `drizzle-kit`:
- Make sure `?sslmode=required` is added to the `POSTGRES_URL` env for dev
- Run `pnpm db:push` to apply schema to your db
### Performance
[PageSpeed Report](https://pagespeed.web.dev/analysis/https-next-faster-vercel-app/7iywdkce2k?form_factor=desktop)
<img width="822" alt="SCR-20241027-dmsb" src="https://github.com/user-attachments/assets/810bc4c7-2e01-422d-9c3d-45daf5fb13ce">
### Costs
This project is hosted on Vercel, and uses many of the features of the Vercel platform.
Here is the full breakdown of the cost of running this project from Oct 20th 2024 through Nov 11th 2024.
During that time, the project recieved **over 1 million page views** across 45k unique users. The site has **over 1 million unique pages and images\***.
\*_images are unique by url (and caching) although not unqiue in their content_
#### Summary:
- ~1 million page views
- ~1 million unqiue product pages
- 45k unique users
- $513.12
Is $500 a lot for hosting this site? It depends, in this instance if it was a real ecommerce site that hosting cost would've been made back in the first 10k visitors.
It is likely possible to optimize these costs further if that is your goal, however that wasn't a priority for this project. We wanted to try and build the fastest possible site, quickly. We definitely achieved that goal without ever having to think about infra once.
These numbers are also on top of the Vercel pro plan, which is $20/contributor/month.
We would like to thank Vercel for covering the costs of hosting this project.
#### Compute and Caching
These costs represent the core functionality of serving the site.
| Resource | Included | On-demand | Charge | Notes |
| -------------------- | --------------------------- | ------------- | ------- | ------------------------------------------------------------------------------------- |
| Function Invocations | 1M / 1M | +31M | $18.00 |
| Function Duration | 1,000 GB-Hrs / 1,000 GB-Hrs | +333.7 GB-Hrs | $33.48 | Using In-function Concurrency reduces our compute usage by over 50% (see image below) |
| Edge Requests | 10M / 10M | +93M | $220.92 | |
| Fast Origin Transfer | 100 GB / 100 GB | +461.33 GB | $26.33 | |
| ISR Writes | 2M / 2M | +12M | $46.48 | |
| ISR Reads | 10M / 10M | +20M | $7.91 | |
Total: $353.12
#### Images
These costs represent the image optimization done by Vercel.
| Resource | Included | On-demand | Charge | Notes |
| ------------------ | ----------- | --------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Image Optimization | 5000 / 5000 | +101,784 | $160.00 | This represents the number of distinct source images used on the site and optimized by Vercel. Each of the 1 million products has a unique image. The reason this number is less than 1 million is because the optimization is done on demand and not all pages have been visited. |
Total: $160.00
#### Even More Info


 | {
"source": "ethanniser/NextFaster",
"title": "README.md",
"url": "https://github.com/ethanniser/NextFaster/blob/main/README.md",
"date": "2024-10-18T01:21:27",
"stars": 3891,
"description": "A highly performant e-commerce template using Next.js ",
"file_size": 6725
} |
Subsets and Splits