Update 2025-03-30

Update 2025-03-03

Update 2025-03-07

Update 2025-03-13

Update 2025-03-14

Update 2025-03-22

Update 2025-03-24

Update 2025-03-29
This commit is contained in:
Kristofers Solo 2025-03-01 15:14:16 +02:00
parent 5f54bb78ad
commit f298468e99
20 changed files with 561 additions and 200 deletions

View File

@ -66,6 +66,7 @@ depends = [ "torrent", "zathura" ]
"config/fastfetch/" = "~/.config/fastfetch/"
"config/flameshot.ini" = "~/.config/flameshot/flameshot.ini"
"config/gitui/" = "~/.config/gitui/"
"config/lazygit/" = "~/.config/lazygit/"
"config/git/" = "~/.config/git/"
"config/mpv/" = "~/.config/mpv/"
"config/lf/" = "~/.config/lf/"

View File

@ -442,7 +442,7 @@ local globalkeys = gears.table.join(
-- awful.key({ modkey, "Control" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
awful.key({ modkey }, "b", function()
awful.spawn("zen-browser")
awful.spawn("floorp")
end, { description = "open browser", group = "launcher" }),
awful.key({ modkey }, "n", function()
awful.spawn("alacritty -e yazi")

View File

@ -435,7 +435,7 @@ local globalkeys = gears.table.join(
-- awful.key({ modkey, "Control" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
awful.key({ modkey }, "b", function()
awful.spawn("zen-browser")
awful.spawn("floorp")
end, { description = "open browser", group = "launcher" }),
awful.key({ modkey }, "n", function()
awful.spawn("alacritty -e yazi")

View File

@ -2,8 +2,8 @@
(defpoll clock_hour :interval "1m" "date +%H")
(defpoll clock_minute :interval "2s" "date +%M")
(defpoll clock_second :interval "1s" "date +%S")
(defpoll clock_date :interval "10h" "date +%d.%m.%Y")
(defpoll clock_day :interval "10h" "date +%A")
(defpoll clock_date :interval "1h" "date +%d.%m.%Y")
(defpoll clock_day :interval "1h" "date +%A")
(defpoll volume_percent :interval "3s" "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
(defpoll mic_percent :interval "3s" "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
(defpoll brightness_percent :interval "5s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")

View File

@ -17,6 +17,8 @@
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=eDP-1,prefered,0x0,1
monitor=DP-1,prefered,180x-1440,1
# monitor=HDMI-A-1,prefered,480x-1080,1
monitor=HDMI-A-1,prefered,auto,1
# monitor=DP-1,disabled
###################
@ -29,7 +31,7 @@ monitor=DP-1,prefered,180x-1440,1
$terminal = alacritty
$fileManager = $terminal -e yazi
$menu = wofi --show drun -ib
$browser = zen-browser
$browser = floorp
#################
### AUTOSTART ###
@ -39,10 +41,11 @@ $browser = zen-browser
# Or execute your favorite apps at launch like this:
exec-once=pipewire & pipewire-pulse & wireplumber & eww daemon & eww open bar #& dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DISPLAY XAUTHORITY
exec-once=nextcloud & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & xrdb "$XDG_CONFIG_HOME/x11/xresources" & transmission-daemon & dunst & hyprland-per-window-layout
# exec-once=eww daemon & eww open bar & dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DISPLAY XAUTHORITY
exec-once=nextcloud & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & xrdb "$XDG_CONFIG_HOME/x11/xresources" & transmission-daemon & dunst
exec-once=[workspace 1 silent] $browser
exec-once=[workspace 8 silent] vesktop & kotatogram-desktop
exec-once=[workspace 9 silent] spotify-launcher
# exec-once=[workspace 9 silent] spotify-launcher
# Source a file (multi-file configs)
source=~/.config/hypr/rose-pine.conf
@ -55,7 +58,6 @@ source=~/.config/hypr/rose-pine.conf
env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
# env = DBUS_SESSION_BUS_ADDRESS,unix:path=/run/user/1000/bus
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland

View File

@ -0,0 +1,2 @@
services:
git.modulation.lv: gitlab:git.modulation.lv/api/v4/projects

View File

@ -0,0 +1,33 @@
-- Importing mpv module
local mpv = require("mp")
local mpv_options = require("mp.options")
local options = { -- setting default options
op_start = 0,
op_end = 0,
ed_start = 0,
ed_end = 0,
}
mpv_options.read_options(options, "skip") --reading script-opts data
-- Main function to check and skip if within the defined section
local function skip()
local current_time = mp.get_property_number("time-pos")
if not current_time then
return
end
-- Check for opening sequence
if current_time >= options.op_start and current_time < options.op_end then
mp.set_property_number("time-pos", options.op_end)
end
-- Check for ending sequence
if current_time >= options.ed_start and current_time < options.ed_end then
mp.set_property_number("time-pos", options.ed_end)
end
end
-- Bind the function to be called whenever the time position is changed
mp.observe_property("time-pos", "number", skip)

View File

@ -22,7 +22,7 @@ unsetopt PROMPT_SP
# Default Apps
export BROWSER="zen-browser"
export BROWSER="floorp"
export EDITOR="nvim"
export IMAGE="nsxiv"
export READER="zathura"

View File

@ -1,6 +1,6 @@
#!/bin/sh
autostart="picom nextcloud transmission-daemon zen-browser discord syncthing mullvad-vpn spotify-launcher kotatogram-desktop easyeffects"
autostart="picom nextcloud transmission-daemon discord syncthing mullvad-vpn spotify-launcher kotatogram-desktop easyeffects"
for program in $autostart; do
pidof -sx "$program" || "$program" &

View File

@ -159,13 +159,13 @@ prepend_keymap = [
# chmod
{on = [ "c", "m" ], run = "plugin chmod", desc = "Chmod on selected files"},
# Archive
{on = [ "c", "a" ], run = "plugin ouch --args=zip", desc = "Compress with ouch"},
{on = [ "c", "a" ], run = "plugin ouch -- zip", desc = "Compress with ouch"},
# Augment Command
{on = [ "l" ], run = "plugin augment-command --args='enter'", desc = "Enter a directory and skip directories with only a single subdirectory"},
{on = [ "k" ], run = "plugin augment-command --args='arrow -1'", desc = "Move cursor up"},
{on = [ "r" ], run = "plugin augment-command --args='rename --cursor=before_ext'", desc = "Rename a file or directory"},
{on = [ "R" ], run = "plugin augment-command --args='rename'", desc = "Rename a file or directory"},
{on = [ "D" ], run = "plugin augment-command --args='remove --permanently'", desc = "Permanently delete the files"},
{on = [ "l" ], run = "plugin augment-command -- enter", desc = "Enter a directory and skip directories with only a single subdirectory"},
{on = [ "k" ], run = "plugin augment-command -- arrow -1", desc = "Move cursor up"},
{on = [ "r" ], run = "plugin augment-command -- rename --cursor=before_ext", desc = "Rename a file or directory"},
{on = [ "R" ], run = "plugin augment-command -- rename", desc = "Rename a file or directory"},
{on = [ "D" ], run = "plugin augment-command -- remove --permanently", desc = "Permanently delete the files"},
# Dragon
{on = [ "m", "a" ], run = ''' shell 'ripdrag -atk "$@"' --confirm ''', desc = "Drag and drop all"},
{on = [ "m", "i" ], run = ''' shell 'ripdrag -tk "$@"' --confirm ''', desc = "Drag and drop individual"},
@ -176,15 +176,15 @@ prepend_keymap = [
# Hide Preview
{on = "<C-t>", run = "plugin --sync hide-preview", desc = "Hide or show preview"},
# Relative motions
{on = [ "1" ], run = "plugin relative-motions --args=1", desc = "Move in relative steps"},
{on = [ "2" ], run = "plugin relative-motions --args=2", desc = "Move in relative steps"},
{on = [ "3" ], run = "plugin relative-motions --args=3", desc = "Move in relative steps"},
{on = [ "4" ], run = "plugin relative-motions --args=4", desc = "Move in relative steps"},
{on = [ "5" ], run = "plugin relative-motions --args=5", desc = "Move in relative steps"},
{on = [ "6" ], run = "plugin relative-motions --args=6", desc = "Move in relative steps"},
{on = [ "7" ], run = "plugin relative-motions --args=7", desc = "Move in relative steps"},
{on = [ "8" ], run = "plugin relative-motions --args=8", desc = "Move in relative steps"},
{on = [ "9" ], run = "plugin relative-motions --args=9", desc = "Move in relative steps"},
{on = [ "1" ], run = "plugin relative-motions -- 1", desc = "Move in relative steps"},
{on = [ "2" ], run = "plugin relative-motions -- 2", desc = "Move in relative steps"},
{on = [ "3" ], run = "plugin relative-motions -- 3", desc = "Move in relative steps"},
{on = [ "4" ], run = "plugin relative-motions -- 4", desc = "Move in relative steps"},
{on = [ "5" ], run = "plugin relative-motions -- 5", desc = "Move in relative steps"},
{on = [ "6" ], run = "plugin relative-motions -- 6", desc = "Move in relative steps"},
{on = [ "7" ], run = "plugin relative-motions -- 7", desc = "Move in relative steps"},
{on = [ "8" ], run = "plugin relative-motions -- 8", desc = "Move in relative steps"},
{on = [ "9" ], run = "plugin relative-motions -- 9", desc = "Move in relative steps"},
{on = [ "c", "s" ], run = "plugin what-size", desc = "Calc size of selection or cwd"},
]

View File

@ -20,18 +20,18 @@ hash = "2d6d77583162aaf0a599e7a3091b5878"
[[plugin.deps]]
use = "Sonico98/exifaudio"
rev = "d794614"
rev = "4379fcf"
hash = "a8e15d3c21c02a5af41d46ed04778a02"
[[plugin.deps]]
use = "dedukun/relative-motions"
rev = "a1466a9"
hash = "26d7fd10e163e0624d733c067eba4b61"
rev = "8103065"
hash = "9f13f0740fa3a0c18e47ec6fb62ddfaa"
[[plugin.deps]]
use = "hankertrix/augment-command"
rev = "af31941"
hash = "71c1ef899b40a54fcdf5a41f87daa967"
rev = "f4a904c"
hash = "60dff62dcb958c83b7c84dfb3d5ef68b"
[[plugin.deps]]
use = "imsi32/yatline"
@ -53,30 +53,30 @@ use = "pirafrank/what-size"
rev = "b23e3a4"
hash = "98e5f5af3efd3ba8bc2db0720187cc83"
[[plugin.deps]]
use = "yazi-rs/plugins:chmod"
rev = "5186af7"
hash = "f28138c2e11e87962b66d583fef724c3"
[[plugin.deps]]
use = "yazi-rs/plugins:full-border"
rev = "5186af7"
hash = "ae9e1d0c6bfd68cdebc98cc684c22b45"
[[plugin.deps]]
use = "yazi-rs/plugins:git"
rev = "5186af7"
rev = "3d0c7c6"
hash = "771f18427fb75fb19990ce602bb322f4"
[[plugin.deps]]
use = "yazi-rs/plugins:hide-preview"
rev = "5186af7"
hash = "1e31898370b752e4faf335b762b3eeaf"
[[plugin.deps]]
use = "yazi-rs/plugins:max-preview"
rev = "5186af7"
rev = "3d0c7c6"
hash = "a8025f2bb311e869069364fba01abffc"
[[plugin.deps]]
use = "yazi-rs/plugins:chmod"
rev = "3d0c7c6"
hash = "2f1053f89d1a301a648ab181d0948e38"
[[plugin.deps]]
use = "yazi-rs/plugins:full-border"
rev = "3d0c7c6"
hash = "9dce00232a0e0e2502565c7aa2b0ed4e"
[[plugin.deps]]
use = "yazi-rs/plugins:hide-preview"
rev = "3d0c7c6"
hash = "53f826884e2c7e521cecc492a7f31d7e"
[flavor]
deps = []
deps = [ ]

View File

@ -10,17 +10,37 @@ plugin.
## Table of Contents
- [Requirements](#requirements)
- [Optional dependencies](#optional-dependencies)
- [Installation](#installation)
- [Configuration](#configuration)
- [What about the commands are augmented?][augment-section]
- [Augmented commands](#augmented-commands)
- [Open (`open`)](#open-open)
- [Extract (`extract`)](#extract-extract)
- [Enter (`enter`)](#enter-enter)
- [Leave (`leave`)](#leave-leave)
- [Rename (`rename`)](#rename-rename)
- [Remove (`remove`)](#remove-remove)
- [Create (`create`)](#create-create)
- [Shell (`shell`)](#shell-shell)
- [Passing arguments to the `shell` command](#passing-arguments-to-the-shell-command)
- [Paste (`paste`)](#paste-paste)
- [Tab create (`tab_create`)](#tab-create-tab_create)
- [Tab switch (`tab_switch`)](#tab-switch-tab_switch)
- [Quit (`quit`)](#quit-quit)
- [Arrow (`arrow`)](#arrow-arrow)
- [New commands](#new-commands)
- [Parent arrow (`parent_arrow`)](#parent-arrow-parent_arrow)
- [Editor (`editor`)](#editor-editor)
- [Pager (`pager`)](#pager-pager)
- [Usage](#usage)
- [Using the `extract` command as an opener](#using-the-extract-command-as-an-opener)
- [Full configuration example](#full-configuration-example)
- [Licence](#licence)
## Requirements
- [Yazi][yazi-link] v25.2.7+
- [Yazi][yazi-link] v25.2.26+
- [`7z` or `7zz` command][7z-link]
- [`file` command][file-command-link]
@ -43,26 +63,28 @@ ya pack -u
## Configuration
| Configuration | Values | Default | Description |
| ----------------------------------- | ------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `prompt` | `true` or `false` | `false` | Create a prompt to choose between hovered and selected items when both exist. If this option is disabled, selected items will only be operated on when the hovered item is selected, otherwise the hovered item will be the default item that is operated on. |
| `default_item_group_for_prompt` | `hovered`, `selected` or `none` | `hovered` | The default item group to operate on when the prompt is submitted without any value. This only takes effect if `prompt` is set to `true`, otherwise this option doesn't do anything. `hovered` means the hovered item is operated on, `selected` means the selected items are operated on, and `none` just cancels the operation. |
| `smart_enter` | `true` or `false` | `true` | Use one command to open files or enter a directory. With this option set, the `enter` and `open` commands will both call the `enter` command when a directory is hovered and call the `open` command when a regular file is hovered. You can also enable this behaviour by passing the `--smart` flag to the `enter` or `open` commands. |
| `smart_paste` | `true` or `false` | `false` | Paste items into a directory without entering it. The behaviour is exactly the same as the [smart paste tip on Yazi's documentation][smart-paste-tip]. Setting this option to `false` will use the default `paste` behaviour. You can also enable this behaviour by passing the `--smart` flag to the `paste` command. |
| `smart_tab_create` | `true` or `false` | `false` | Create tabs in the directory that is being hovered instead of the current directory. The behaviour is exactly the same as the [smart tab tip on Yazi's documentation][smart-tab-tip]. Setting this option to `false` will use the default `tab_create` behaviour, which means you need to pass the `--current` flag to the command. You can also enable this behaviour by passing the `--smart` flag to the `tab_create` command. |
| `smart_tab_switch` | `true` or `false` | `false` | If the tab that is being switched to does not exist yet, setting this option to `true` will create all the tabs in between the current number of open tabs, and the tab that is being switched to. The behaviour is exactly the same as the [smart switch tip on Yazi's documentation][smart-switch-tip]. Setting this option to `false` will use the default `tab_switch` behaviour. You can also enable this behaviour by passing the `--smart` flag to the `tab_switch` command. |
| `confirm_on_quit` | `true` or `false` | `true` | Setting this option to `true` will cause Yazi to prompt you for a confirmation before quitting when there is more than 1 tab open. Setting this option to `false` will use the default `quit` behaviour, which is to immediately quit Yazi. You can also enable this behaviour by passing the `--confirm` flag to the `quit` command. |
| `open_file_after_creation` | `true` or `false` | `false` | This option determines whether the plugin will open a file after it has been created. Setting this option to `true` will cause the plugin to open the created file. You can also enable this behaviour by passing the `--open` flag to the `create` command. |
| `enter_directory_after_creation` | `true` or `false` | `false` | This option determines whether the plugin will enter a directory after it has been created. Setting this option to `true` will cause the plugin to enter the created directory. You can also enable this behaviour by passing the `--enter` flag to the `create` command. |
| `use_default_create_behaviour` | `true` or `false` | `false` | This option determines whether the plugin will use the behaviour of Yazi's `create` command. Setting this option to `true` will use the behaviour of Yazi's `create` command. You can also enable this behaviour by passing the `--default-behaviour` flag to the `create` command. |
| `enter_archives` | `true` or `false` | `true` | Automatically extract and enter archive files. This option requires the [`7z` or `7zz` command][7z-link] to be present. |
| `extract_retries` | An integer, like `1`, `3`, `10`, etc. | `3` | This option determines how many times the plugin will retry opening an encrypted or password-protected archive when a wrong password is given. This value plus 1 is the total number of times the plugin will try opening an encrypted or password-protected archive. |
| `recursively_extract_archives` | `true` or `false` | `true` | This option determines whether the plugin will extract all archives inside an archive file recursively. If this option is set to `false`, archive files inside an archive will not be extracted, and you will have to manually extract them yourself. |
| `preserve_file_permissions` | `true` or `false` | `false` | This option determines whether to preserve the file permissions of the items in the extracted archive. Setting this option to `true` will preserve the file permissions of the extracted items. It requires the [`tar` command][gnu-tar-link] and will only work on `tar` archives, or tarballs, as [`7z`][7z-link] does not support preserving file permissions. You will receive a warning if you have this option set but [`tar`][gnu-tar-link] is not installed. Do note that there are significant security implications of setting this option to `true`, as any executable file or binary in an archive can be immediately executed after it is extracted, which can compromise your system if you extract a malicious archive. As such, the default value is `false`, and it is strongly recommended to leave it as such. |
| `must_have_hovered_item` | `true` or `false` | `true` | This option stops the plugin from executing any commands when there is no hovered item. |
| `skip_single_subdirectory_on_enter` | `true` or `false` | `true` | Skip directories when there is only one subdirectory and no other files when entering directories. This behaviour can be turned off by passing the `--no-skip` flag to the `enter` or `open` commands. |
| `skip_single_subdirectory_on_leave` | `true` or `false` | `true` | Skip directories when there is only one subdirectory and no other files when leaving directories. This behaviour can be turned off by passing the `--no-skip` flag to the `leave` command. |
| `wraparound_file_navigation` | `true` or `false` | `false` | Wrap around from the bottom to the top or from the top to the bottom when using the `arrow` or `parent_arrow` command to navigate. |
| Configuration | Values | Default | Description |
| ----------------------------------- | --------------------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `prompt` | `true` or `false` | `false` | Create a prompt to choose between hovered and selected items when both exist. If this option is disabled, selected items will only be operated on when the hovered item is selected, otherwise the hovered item will be the default item that is operated on. |
| `default_item_group_for_prompt` | `hovered`, `selected` or `none` | `hovered` | The default item group to operate on when the prompt is submitted without any value. This only takes effect if `prompt` is set to `true`, otherwise this option doesn't do anything. `hovered` means the hovered item is operated on, `selected` means the selected items are operated on, and `none` just cancels the operation. |
| `smart_enter` | `true` or `false` | `true` | Use one command to open files or enter a directory. With this option set, the `enter` and `open` commands will both call the `enter` command when a directory is hovered and call the `open` command when a regular file is hovered. You can also enable this behaviour by passing the `--smart` flag to the `enter` or `open` commands. |
| `smart_paste` | `true` or `false` | `false` | Paste items into a directory without entering it. The behaviour is exactly the same as the [smart paste tip on Yazi's documentation][smart-paste-tip]. Setting this option to `false` will use the default `paste` behaviour. You can also enable this behaviour by passing the `--smart` flag to the `paste` command. |
| `smart_tab_create` | `true` or `false` | `false` | Create tabs in the directory that is being hovered instead of the current directory. The behaviour is exactly the same as the [smart tab tip on Yazi's documentation][smart-tab-tip]. Setting this option to `false` will use the default `tab_create` behaviour, which means you need to pass the `--current` flag to the command. You can also enable this behaviour by passing the `--smart` flag to the `tab_create` command. |
| `smart_tab_switch` | `true` or `false` | `false` | If the tab that is being switched to does not exist yet, setting this option to `true` will create all the tabs in between the current number of open tabs, and the tab that is being switched to. The behaviour is exactly the same as the [smart switch tip on Yazi's documentation][smart-switch-tip]. Setting this option to `false` will use the default `tab_switch` behaviour. You can also enable this behaviour by passing the `--smart` flag to the `tab_switch` command. |
| `confirm_on_quit` | `true` or `false` | `true` | Setting this option to `true` will cause Yazi to prompt you for a confirmation before quitting when there is more than 1 tab open. Setting this option to `false` will use the default `quit` behaviour, which is to immediately quit Yazi. You can also enable this behaviour by passing the `--confirm` flag to the `quit` command. |
| `open_file_after_creation` | `true` or `false` | `false` | This option determines whether the plugin will open a file after it has been created. Setting this option to `true` will cause the plugin to open the created file. You can also enable this behaviour by passing the `--open` flag to the `create` command. |
| `enter_directory_after_creation` | `true` or `false` | `false` | This option determines whether the plugin will enter a directory after it has been created. Setting this option to `true` will cause the plugin to enter the created directory. You can also enable this behaviour by passing the `--enter` flag to the `create` command. |
| `use_default_create_behaviour` | `true` or `false` | `false` | This option determines whether the plugin will use the behaviour of Yazi's `create` command. Setting this option to `true` will use the behaviour of Yazi's `create` command. You can also enable this behaviour by passing the `--default-behaviour` flag to the `create` command. |
| `enter_archives` | `true` or `false` | `true` | Automatically extract and enter archive files. This option requires the [`7z` or `7zz` command][7z-link] to be present. |
| `extract_retries` | An integer, like `1`, `3`, `10`, etc. | `3` | This option determines how many times the plugin will retry opening an encrypted or password-protected archive when a wrong password is given. This value plus 1 is the total number of times the plugin will try opening an encrypted or password-protected archive. |
| `recursively_extract_archives` | `true` or `false` | `true` | This option determines whether the plugin will extract all archives inside an archive file recursively. If this option is set to `false`, archive files inside an archive will not be extracted, and you will have to manually extract them yourself. |
| `preserve_file_permissions` | `true` or `false` | `false` | This option determines whether to preserve the file permissions of the items in the extracted archive. Setting this option to `true` will preserve the file permissions of the extracted items. It requires the [`tar` command][gnu-tar-link] and will only work on `tar` archives, or tarballs, as [`7z`][7z-link] does not support preserving file permissions. You will receive a warning if you have this option set but [`tar`][gnu-tar-link] is not installed. Do note that there are significant security implications of setting this option to `true`, as any executable file or binary in an archive can be immediately executed after it is extracted, which can compromise your system if you extract a malicious archive. As such, the default value is `false`, and it is strongly recommended to leave it as such. |
| `must_have_hovered_item` | `true` or `false` | `true` | This option stops the plugin from executing any commands when there is no hovered item. |
| `skip_single_subdirectory_on_enter` | `true` or `false` | `true` | Skip directories when there is only one subdirectory and no other files when entering directories. This behaviour can be turned off by passing the `--no-skip` flag to the `enter` or `open` commands. |
| `skip_single_subdirectory_on_leave` | `true` or `false` | `true` | Skip directories when there is only one subdirectory and no other files when leaving directories. This behaviour can be turned off by passing the `--no-skip` flag to the `leave` command. |
| `smooth_scrolling` | `true` or `false` | `false` | Self-explanatory, this option enables smooth scrolling. |
| `scroll_delay` | A floating point number, like `0.02`, `0.05`, `0.1`, etc. | `0.02` | The delay, in seconds, between each call of the `arrow` command to scroll through the file list. The smaller the `scroll_delay`, the faster the file list is scrolled. Avoid setting a `scroll_delay` that is more than `1` second. This is due to the plugin being asynchronous, which will result in the plugin continuing to call the `arrow` command even when the directory has changed, or when you are in a different application that doesn't block Yazi, resulting in unexpected behaviour. |
| `wraparound_file_navigation` | `true` or `false` | `false` | Wrap around from the bottom to the top or from the top to the bottom when using the `arrow` or `parent_arrow` command to navigate. |
If you would like to use the default configuration, which is shown below,
you don't need to add anything to your `~/.config/yazi/init.lua`
@ -92,6 +114,8 @@ require("augment-command"):setup({
must_have_hovered_item = true,
skip_single_subdirectory_on_enter = true,
skip_single_subdirectory_on_leave = true,
smooth_scrolling = false,
scroll_delay = 0.02,
wraparound_file_navigation = false,
})
```
@ -115,6 +139,7 @@ require("augment-command"):setup({
open_file_after_creation = true,
enter_directory_after_creation = true,
extract_retries = 5,
smooth_scrolling = true,
wraparound_file_navigation = true,
})
```
@ -451,10 +476,6 @@ then it will operate on the selected items.
create directories to ensure that the path given exists.
It also supports all the options supported by Yazi's `create` command,
so you can pass them to the command and expect the same behaviour.
Do note that the separator in the `confirm` component will be the text colour
instead of your configured border colour for the `confirm` component as
the `list` part of the `confirm` component has not been exposed to plugin
developers, so the separator is made using text.
- The rationale for this behaviour is that creating a path without
a file extension usually means you intend to create a directory instead
of a file, as files usually have file extensions.
@ -792,6 +813,13 @@ in your `keymap.toml` file.
### Arrow (`arrow`)
- When `smooth_scrolling` is set to `true`, the arrow command will
smoothly scroll through the file list.
Video:
[smooth-arrow-video]
- When `wraparound_file_navigation` is set to `true`,
the arrow command will wrap around from the bottom to the top or
from the top to the bottom when navigating.
@ -800,7 +828,14 @@ in your `keymap.toml` file.
[wraparound-arrow-video]
Otherwise, it'll behave like the default `arrow` command.
- When both `smooth_scrolling` and `wraparound_file_navigation` are set to
`true`, the command will smoothly scroll the wraparound transition as well.
Video:
[smooth-wraparound-arrow-video]
- Otherwise, it'll behave like the default `arrow` command.
## New commands
@ -815,6 +850,13 @@ in your `keymap.toml` file.
[parent-arrow-video]
- When `smooth_scrolling` is set to `true`, this command will
smoothly scroll through the parent directories.
Video:
[smooth-parent-arrow-video]
- When `wraparound_file_navigation` is set to `true`,
this command will also wrap around from the bottom to the top or
from top to the bottom when navigating in the parent directory.
@ -823,9 +865,16 @@ in your `keymap.toml` file.
[wraparound-parent-arrow-video]
- When both `smooth_scrolling` and `wraparound_file_navigation` are set to
`true`, the command will smoothly scroll the wraparound transition as well.
Video:
[smooth-wraparound-parent-arrow-video]
- You can also replicate this using this series of commands below,
but it doesn't work as well,
and doesn't support wraparound navigation:
and doesn't support wraparound navigation or smooth scrolling:
```toml
# ~/.config/yazi/keymap.toml on Linux and macOS
@ -1010,94 +1059,98 @@ You can view the full licence in the [`LICENSE`][Licence] file.
<!-- Open command -->
[open-prompt-video]: https://github.com/user-attachments/assets/82ddc67d-0b79-4487-8d29-6fd1eb754a8e
[open-behaviour-video]: https://github.com/user-attachments/assets/3f8eec80-ae39-4071-b7ed-e9e9367f10fe
[open-auto-extract-archives-video]: https://github.com/user-attachments/assets/35b356ed-9c3f-4093-ab59-f85ae64de757
[open-recursively-extract-archives-video]: https://github.com/user-attachments/assets/dd1a5bd4-c7af-4d0a-9bf5-b087ee5a06f0
[open-prompt-video]: https://github.com/user-attachments/assets/ad51d25b-dc68-48f6-bd14-20dc0b68fb0c
[open-behaviour-video]: https://github.com/user-attachments/assets/0b84e0e8-e483-4c3c-8408-4f672a34e249
[open-auto-extract-archives-video]: https://github.com/user-attachments/assets/ae7e8b33-1f41-4ee7-8f5b-18fb4d455709
[open-recursively-extract-archives-video]: https://github.com/user-attachments/assets/99119e03-e770-4442-b529-c5586cc04bd0
<!-- Extract command -->
[extract-must-have-hovered-item-video]: https://github.com/user-attachments/assets/7c0516ff-01fd-48c2-ba27-4449ffede933
[extract-hovered-item-optional-video]: https://github.com/user-attachments/assets/07ef7d25-3284-4d93-9485-c8635519c57e
[extract-prompt-video]: https://github.com/user-attachments/assets/be2cabc3-b47d-4aac-ac45-0f26957c606b
[extract-behaviour-video]: https://github.com/user-attachments/assets/6ea90612-da8f-45ad-8310-9b38c9e5a6f9
[extract-recursively-extract-archives-video]: https://github.com/user-attachments/assets/bbf7f670-f86d-4aa4-85c7-35b41170924e
[extract-encrypted-archive]: https://github.com/user-attachments/assets/58645691-3559-44ad-918e-8c2cd127252f
[extract-must-have-hovered-item-video]: https://github.com/user-attachments/assets/c7d4ef2f-5455-4c06-a84e-bfc71c31bfea
[extract-hovered-item-optional-video]: https://github.com/user-attachments/assets/64536ddb-2309-4442-b5a3-73b334d68161
[extract-prompt-video]: https://github.com/user-attachments/assets/40ad3b74-0036-4835-bfd8-cec6259504c4
[extract-behaviour-video]: https://github.com/user-attachments/assets/6c7e7b3e-1be5-42ab-b7d9-987dcc10cc88
[extract-recursively-extract-archives-video]: https://github.com/user-attachments/assets/6b5aef9d-9673-458b-8555-0c84570656dd
[extract-encrypted-archive]: https://github.com/user-attachments/assets/9c1c1377-6693-409d-840e-1eb128cf3ccd
<!-- Enter command -->
[smart-enter-video]: https://github.com/user-attachments/assets/a00da3f5-305a-4615-b55c-483a06dd56d7
[enter-skip-single-subdirectory-video]: https://github.com/user-attachments/assets/25ca5fb5-68f9-45fe-bf32-369e9335505d
[smart-enter-video]: https://github.com/user-attachments/assets/85b043bc-f152-44a9-9627-d0282a6481ef
[enter-skip-single-subdirectory-video]: https://github.com/user-attachments/assets/70b3f595-31f8-474d-a623-fc4d927566ec
<!-- Leave command -->
[leave-skip-single-subdirectory-video]: https://github.com/user-attachments/assets/4740fdae-2cd9-463d-b67b-7cdfd8d8b9a1
[leave-skip-single-subdirectory-video]: https://github.com/user-attachments/assets/3f0f98d1-519e-48c7-90d8-15e57986cc89
<!-- Rename command -->
[rename-must-have-hovered-item-video]: https://github.com/user-attachments/assets/fd88a198-3de3-4d2b-8bcf-8d68142c965f
[rename-hovered-item-optional-video]: https://github.com/user-attachments/assets/324dcd94-6f83-49a2-9390-5f41da520689
[rename-prompt-video]: https://github.com/user-attachments/assets/5aba29ae-8b16-4b92-a99c-ff7f0ec925fa
[rename-behaviour-video]: https://github.com/user-attachments/assets/280db6dd-10e4-4255-8c12-e13d23105e90
[rename-must-have-hovered-item-video]: https://github.com/user-attachments/assets/0ec0ad97-d0f0-441d-86a7-73a93a11a683
[rename-hovered-item-optional-video]: https://github.com/user-attachments/assets/9bc918fa-c8b6-4f09-954c-7631a61032a0
[rename-prompt-video]: https://github.com/user-attachments/assets/69da784c-0408-468b-bc34-f2271d0a8cdc
[rename-behaviour-video]: https://github.com/user-attachments/assets/44ea4d01-3d66-4ecd-82ac-4b4f874d2124
<!-- Remove command -->
[remove-must-have-hovered-item-video]: https://github.com/user-attachments/assets/18649ff1-ef0d-409a-8f01-29431dcc8f2e
[remove-hovered-item-optional-video]: https://github.com/user-attachments/assets/6e9f5ca0-9b9f-47f8-8499-2b2c1db9f47c
[remove-prompt-video]: https://github.com/user-attachments/assets/3f94c6f8-2ffd-4970-a5a4-5ac6b3a621c0
[remove-behaviour-video]: https://github.com/user-attachments/assets/37d3c059-84ff-4475-908b-2c167b23c488
[remove-must-have-hovered-item-video]: https://github.com/user-attachments/assets/76c511c8-d3b6-494c-9fcf-f4035325bca3
[remove-hovered-item-optional-video]: https://github.com/user-attachments/assets/4502d34d-1432-43ee-99b1-234085f795b5
[remove-prompt-video]: https://github.com/user-attachments/assets/9b7f774c-f982-4e57-a895-6368f3043311
[remove-behaviour-video]: https://github.com/user-attachments/assets/de57f05d-582d-44d3-9908-5c3f370e7119
<!-- Create command -->
[create-and-enter-directories-video]: https://github.com/user-attachments/assets/a102f918-8d99-491f-a6e3-fd8151f16f96
[create-and-open-files-video]: https://github.com/user-attachments/assets/14341b9b-a048-4ea2-9322-e963293b6813
[create-and-open-files-and-directories-video]: https://github.com/user-attachments/assets/dd05d84a-716b-4c4b-8e77-429bbfb4ea43
[create-behaviour-video]: https://github.com/user-attachments/assets/a13745a5-a2cc-4c25-a3ff-0f10ac98b6f9
[create-default-behaviour-video]: https://github.com/user-attachments/assets/5e9305c0-e56c-4fc3-b36b-e86c43571b06
[create-and-enter-directories-video]: https://github.com/user-attachments/assets/70ffbdc9-d05f-4cb7-bf18-b219139221ab
[create-and-open-files-video]: https://github.com/user-attachments/assets/b3c4ae5a-41be-4d6a-8cb9-59450a4b77c4
[create-and-open-files-and-directories-video]: https://github.com/user-attachments/assets/f645fa80-eb78-4bee-b234-a0fa8b1d5610
[create-behaviour-video]: https://github.com/user-attachments/assets/0d73e2a1-ed13-4601-b9b5-3e696d69621c
[create-default-behaviour-video]: https://github.com/user-attachments/assets/452300b3-71d1-46ce-aa65-bed39ff2b92d
<!-- Shell command -->
[shell-must-have-hovered-item-video]: https://github.com/user-attachments/assets/43404049-1a4c-458c-b33f-c221dddf15c6
[shell-hovered-item-optional-video]: https://github.com/user-attachments/assets/b399450a-eec4-43d5-a75d-91c4f04a9d59
[shell-prompt-video]: https://github.com/user-attachments/assets/e83eb468-96fd-463f-a96a-54ac9ee2295f
[shell-behaviour-video]: https://github.com/user-attachments/assets/caa32923-9c3e-4ea4-a1b6-e0a2c7968e9d
[shell-exit-if-directory-video]: https://github.com/user-attachments/assets/a0feab97-b7fc-4d58-8611-60ccf5e794d5
[shell-must-have-hovered-item-video]: https://github.com/user-attachments/assets/dec6a8f1-1a7a-4955-aab1-46bf185aa0c5
[shell-hovered-item-optional-video]: https://github.com/user-attachments/assets/989a57d6-10ae-4e5d-93a4-d7461fef436f
[shell-prompt-video]: https://github.com/user-attachments/assets/5c6f92be-a21e-49fd-aec2-7bdde85fd21b
[shell-behaviour-video]: https://github.com/user-attachments/assets/dba3b896-377d-4cee-8168-792cbf4c0491
[shell-exit-if-directory-video]: https://github.com/user-attachments/assets/0c01094d-5518-411c-965a-63a77ecaa910
<!-- Paste command -->
[smart-paste-video]: https://github.com/user-attachments/assets/d48c12a7-f652-4df7-90a5-271cbfa97683
[smart-paste-video]: https://github.com/user-attachments/assets/067ad79a-d224-475e-8333-c1bf34aea746
<!-- Tab create command -->
[smart-tab-create-video]: https://github.com/user-attachments/assets/2921df3d-b51d-4dbb-a42f-80e021feaaf6
[smart-tab-create-video]: https://github.com/user-attachments/assets/f1805f59-cfd2-4d97-b1b7-a4de1a25b668
<!-- Tab switch command -->
[smart-tab-switch-video]: https://github.com/user-attachments/assets/1afb540d-47a9-4625-ae59-95d5cd91aa35
[smart-tab-switch-video]: https://github.com/user-attachments/assets/de59fd6b-7dbe-4055-8a9f-174fd24d5a8c
<!-- Quit command -->
[quit-with-confirmation-video]: https://github.com/user-attachments/assets/b6206ee4-766b-44ce-b90b-15b015ae71f9
[quit-with-confirmation-video]: https://github.com/user-attachments/assets/a87cdc00-e22b-4b96-a069-229fbfd7d451
<!-- Arrow command -->
[wraparound-arrow-video]: https://github.com/user-attachments/assets/41ea1fb0-a526-4549-95a2-547c3c4b0498
[smooth-arrow-video]: https://github.com/user-attachments/assets/d6c9bc96-5fdc-4ecd-8c30-91d3e97e67db
[wraparound-arrow-video]: https://github.com/user-attachments/assets/b52153df-1e7a-4063-8bcb-a7c4dc923652
[smooth-wraparound-arrow-video]: https://github.com/user-attachments/assets/f9bdd784-1cae-4292-8809-af6e26d5860f
<!-- Parent arrow command -->
[parent-arrow-video]: https://github.com/user-attachments/assets/f4dc492a-566b-4645-82e1-301713cff11f
[wraparound-parent-arrow-video]: https://github.com/user-attachments/assets/d19872f8-2851-47e6-8485-4e8e5be66871
[parent-arrow-video]: https://github.com/user-attachments/assets/ea2d2b37-0355-466d-bbd5-0a5860507589
[smooth-parent-arrow-video]: https://github.com/user-attachments/assets/b62548eb-2f10-4f15-8c95-9127b90a364c
[wraparound-parent-arrow-video]: https://github.com/user-attachments/assets/2fcc30b8-9a6a-44d2-84c4-d224e9c467d8
[smooth-wraparound-parent-arrow-video]: https://github.com/user-attachments/assets/44b87884-58b7-41af-81e6-e4cf771665aa
<!-- Editor command -->
[editor-must-have-hovered-item-video]: https://github.com/user-attachments/assets/c2811b90-e164-4a6d-9f3d-aefe8aec1d95
[editor-hovered-item-optional-video]: https://github.com/user-attachments/assets/adad538a-fbe8-4ad3-8f6d-5600618a0673
[editor-prompt-video]: https://github.com/user-attachments/assets/cccb8a3c-6afa-49a6-8808-04b0f235b391
[editor-behaviour-video]: https://github.com/user-attachments/assets/b6821220-8530-4fd1-a40f-53d191a3fe1b
[editor-must-have-hovered-item-video]: https://github.com/user-attachments/assets/ba982592-3351-4f13-bdf3-8971e0fdaf2c
[editor-hovered-item-optional-video]: https://github.com/user-attachments/assets/0d9ba0fa-6ad3-492d-b3d4-3ea427ac1b9d
[editor-prompt-video]: https://github.com/user-attachments/assets/792ebdec-45c8-430c-a426-35c94adeb6ce
[editor-behaviour-video]: https://github.com/user-attachments/assets/3f1740af-334f-46a2-aa61-2d783bf82a6c
<!-- Pager command -->
[pager-must-have-hovered-item-video]: https://github.com/user-attachments/assets/22a5211a-89cc-4c36-aadb-eb9e6ab1d578
[pager-hovered-item-optional-video]: https://github.com/user-attachments/assets/6eaed3c9-91f4-4414-8d26-5eaf955a2861
[pager-prompt-video]: https://github.com/user-attachments/assets/1ee621f4-704e-4cc3-a2ff-ba06e4eaf5a3
[pager-behaviour-video]: https://github.com/user-attachments/assets/9ed0d520-4e73-44c3-82f7-18378994e0f4
[pager-must-have-hovered-item-video]: https://github.com/user-attachments/assets/b992a0a1-eb07-4ee5-af2a-179b94bff764
[pager-hovered-item-optional-video]: https://github.com/user-attachments/assets/7a35f938-687a-40b7-82bd-fde72c185edd
[pager-prompt-video]: https://github.com/user-attachments/assets/3ec2a4e4-bf44-4058-938f-d9af66e15191
[pager-behaviour-video]: https://github.com/user-attachments/assets/7185799e-48bc-40c0-a11d-a94d0989d8d7

View File

@ -1,4 +1,4 @@
--- @since 25.2.7
--- @since 25.2.26
-- Plugin to make some Yazi commands smarter
-- Written in Lua 5.4
@ -61,6 +61,8 @@
---@field must_have_hovered_item boolean Whether to stop when no item is hovered
---@field skip_single_subdirectory_on_enter boolean Skip single subdir on enter
---@field skip_single_subdirectory_on_leave boolean Skip single subdir on leave
---@field smooth_scrolling boolean Whether to smoothly scroll or not
---@field scroll_delay number The scroll delay in seconds for smooth scrolling
---@field wraparound_file_navigation boolean Have wraparound navigation or not
-- The full configuration for the plugin
@ -135,6 +137,8 @@ local DEFAULT_CONFIG = {
must_have_hovered_item = true,
skip_single_subdirectory_on_enter = true,
skip_single_subdirectory_on_leave = true,
smooth_scrolling = false,
scroll_delay = 0.02,
wraparound_file_navigation = false,
}
@ -569,23 +573,23 @@ local function convert_arguments_to_string(args)
end
-- Function to show a warning
---@param warning_message string The warning message
---@param warning_message any The warning message
---@param options YaziNotificationOptions|nil Options for the notification
---@return nil
local function show_warning(warning_message, options)
return ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, options or {}, {
content = warning_message,
content = tostring(warning_message),
level = "warn",
}))
end
-- Function to show an error
---@param error_message string The error message
---@param error_message any The error message
---@param options YaziNotificationOptions|nil Options for the notification
---@return nil
local function show_error(error_message, options)
return ya.notify(merge_tables(DEFAULT_NOTIFICATION_OPTIONS, options or {}, {
content = error_message,
content = tostring(error_message),
level = "error",
}))
end
@ -716,7 +720,7 @@ end
---@param args Arguments The arguments to pass to the plugin command
---@return nil
local function emit_plugin_command(command, args)
return ya.manager_emit("plugin", {
return ya.mgr_emit("plugin", {
PLUGIN_NAME,
string.format("%s %s", command, convert_arguments_to_string(args)),
})
@ -1267,7 +1271,7 @@ local function skip_single_child_directories(initial_directory_path)
end
-- Emit the change directory command to change to the directory variable
ya.manager_emit("cd", { directory })
ya.mgr_emit("cd", { directory })
end
-- Class implementations
@ -2309,7 +2313,7 @@ local function handle_open(args, config)
--
-- Emit the command and exit the function
return ya.manager_emit("open", args)
return ya.mgr_emit("open", args)
end
-- If the hovered item is a directory
@ -2341,7 +2345,7 @@ local function handle_open(args, config)
-- opening only the hovered item
-- as the item group is the hovered item,
-- and exit the function
return ya.manager_emit("open", merge_tables(args, { hovered = true }))
return ya.mgr_emit("open", merge_tables(args, { hovered = true }))
end
-- Otherwise, the hovered item is an archive
@ -2521,12 +2525,12 @@ local function handle_extract(args, config)
--
-- Reveal the item and exit the function
return ya.manager_emit("reveal", { extracted_items_url })
return ya.mgr_emit("reveal", { extracted_items_url })
end
-- Otherwise, change the directory to the extracted item.
-- Note that extracted_items_url is destroyed here.
ya.manager_emit("cd", { extracted_items_url })
ya.mgr_emit("cd", { extracted_items_url })
-- If the user wants to skip single subdirectories on enter,
-- and the no skip flag is not passed
@ -2563,7 +2567,7 @@ local function handle_enter(args, config)
end
-- Otherwise, always emit the enter command,
ya.manager_emit("enter", args)
ya.mgr_emit("enter", args)
-- If the user doesn't want to skip single subdirectories on enter,
-- or one of the arguments passed is no skip,
@ -2586,7 +2590,7 @@ local function handle_leave(args, config)
--
-- Always emit the leave command
ya.manager_emit("leave", args)
ya.mgr_emit("leave", args)
-- If the user doesn't want to skip single subdirectories on leave,
-- or one of the arguments passed is no skip,
@ -2629,7 +2633,7 @@ local function handle_leave(args, config)
end
-- Emit the change directory command to change to the directory variable
ya.manager_emit("cd", { directory })
ya.mgr_emit("cd", { directory })
end
-- Function to handle a Yazi command
@ -2650,14 +2654,14 @@ local function handle_yazi_command(command, args)
--
-- Emit the command to operate on the selected items
ya.manager_emit(command, args)
ya.mgr_emit(command, args)
-- If the item group is the hovered item
elseif item_group == ItemGroup.Hovered then
--
-- Emit the command with the hovered option
ya.manager_emit(command, merge_tables(args, { hovered = true }))
ya.mgr_emit(command, merge_tables(args, { hovered = true }))
end
end
@ -2686,7 +2690,7 @@ local function enter_or_open_created_item(item_url, is_directory, args, config)
end
-- Otherwise, call the function change to the created directory
return ya.manager_emit("cd", { item_url })
return ya.mgr_emit("cd", { item_url })
end
-- Otherwise, the item is a file
@ -2700,13 +2704,13 @@ local function enter_or_open_created_item(item_url, is_directory, args, config)
end
-- Otherwise, call the function to reveal the created file
ya.manager_emit("reveal", { item_url })
ya.mgr_emit("reveal", { item_url })
-- Wait for Yazi to finish loading
wait_until_yazi_is_loaded()
-- Call the function to open the file
return ya.manager_emit("open", { hovered = true })
return ya.mgr_emit("open", { hovered = true })
end
-- Function to execute the create command
@ -2737,7 +2741,7 @@ local function execute_create(item_url, is_directory, args, config)
-- If the function is not successful,
-- show the error message and exit the function
if not successful then return show_error(tostring(error_message)) end
if not successful then return show_error(error_message) end
-- Otherwise, the item to create is a file
else
@ -2753,9 +2757,7 @@ local function execute_create(item_url, is_directory, args, config)
-- If the function is not successful,
-- show the error message and exit the function
if not successful then
return show_error(tostring(error_message))
end
if not successful then return show_error(error_message) end
end
-- Otherwise, create the file
@ -2763,13 +2765,26 @@ local function execute_create(item_url, is_directory, args, config)
-- If the function is not successful,
-- show the error message and exit the function
if not successful then return show_error(tostring(error_message)) end
if not successful then return show_error(error_message) end
end
-- Call the function to enter or open the created item
enter_or_open_created_item(item_url, is_directory, args, config)
end
-- Function to get the confirm component border foreground colour
---@type fun(): Color
local get_confirm_border_fg = ya.sync(
--
-- I have no idea how to type it such that the theme
-- is accessible only within a synchronous function,
-- so disabling the diagnostic seems to be the
-- best course of action
---@diagnostic disable-next-line: undefined-global
function() return THEME.confirm.border.fg end
)
-- Function to handle the create command
---@type CommandFunction
local function handle_create(args, config)
@ -2835,6 +2850,7 @@ local function handle_create(args, config)
ui.Line("Will overwrite the following file:")
:align(ui.Line.CENTER),
ui.Line(string.rep("", DEFAULT_CONFIRM_OPTIONS.pos.w - 2))
:style(ui.Style():fg(get_confirm_border_fg()))
:align(ui.Line.LEFT),
ui.Line(tostring(full_url)):align(ui.Line.LEFT),
}):wrap(ui.Text.WRAP_TRIM)
@ -2955,9 +2971,7 @@ local function fix_shell_command_containing_bat(command)
--
-- If the pager argument is quoted, return the command immediately
if pager_argument:find("['\"].+['\"]") then
return command
end
if pager_argument:find("['\"].+['\"]") then return command end
-- Otherwise, quote the pager argument with single quotes
--
@ -3134,7 +3148,7 @@ local function handle_shell(args, _)
args = merge_tables({ command }, args)
-- Emit the command to operate on the hovered item
ya.manager_emit("shell", args)
ya.mgr_emit("shell", args)
end
-- Function to handle the paste command
@ -3151,17 +3165,17 @@ local function handle_paste(args, config)
-- Just paste the items inside the current directory
-- and exit the function
return ya.manager_emit("paste", args)
return ya.mgr_emit("paste", args)
end
-- Otherwise, enter the directory
ya.manager_emit("enter", {})
ya.mgr_emit("enter", {})
-- Paste the items inside the directory
ya.manager_emit("paste", args)
ya.mgr_emit("paste", args)
-- Leave the directory
ya.manager_emit("leave", {})
ya.mgr_emit("leave", {})
end
-- Function to execute the tab create command
@ -3189,12 +3203,12 @@ local execute_tab_create = ya.sync(function(state, args)
-- Emit the command to create a new tab with the arguments
-- and exit the function
return ya.manager_emit("tab_create", args)
return ya.mgr_emit("tab_create", args)
end
-- Otherwise, emit the command to create a new tab
-- with the hovered item's url
ya.manager_emit("tab_create", { hovered_item.url })
ya.mgr_emit("tab_create", { hovered_item.url })
end)
-- Function to handle the tab create command
@ -3227,7 +3241,7 @@ local execute_tab_switch = ya.sync(function(state, args)
if
not (state.config.smart_tab_switch or table_pop(args, "smart", false))
then
return ya.manager_emit("tab_switch", args)
return ya.mgr_emit("tab_switch", args)
end
-- Get the current tab
@ -3242,19 +3256,19 @@ local execute_tab_switch = ya.sync(function(state, args)
--
-- Call the tab create command
ya.manager_emit("tab_create", { current_tab.cwd })
ya.mgr_emit("tab_create", { current_tab.cwd })
-- If there is a hovered item
if current_tab.hovered then
--
-- Reveal the hovered item
ya.manager_emit("reveal", { current_tab.hovered.url })
ya.mgr_emit("reveal", { current_tab.hovered.url })
end
end
-- Switch to the given tab index
ya.manager_emit("tab_switch", args)
ya.mgr_emit("tab_switch", args)
end)
-- Function to handle the tab switch command
@ -3278,7 +3292,7 @@ local function handle_quit(args, config)
-- or if the number of tabs is 1 or less,
-- then emit the quit command
if not (config.confirm_on_quit or args.confirm) or number_of_tabs <= 1 then
return ya.manager_emit("quit", args)
return ya.mgr_emit("quit", args)
end
-- Otherwise, get the user's confirmation for quitting
@ -3294,7 +3308,40 @@ local function handle_quit(args, config)
if not user_confirmation then return end
-- Otherwise, emit the quit command
ya.manager_emit("quit", args)
ya.mgr_emit("quit", args)
end
-- Function to handle smooth scrolling
---@param steps number The number of steps to scroll
---@param scroll_delay number The scroll delay in seconds
---@param scroll_func fun(step: integer): nil The function to call to scroll
local function smoothly_scroll(steps, scroll_delay, scroll_func)
--
-- Initialise the direction to positive 1
local direction = 1
-- If the number of steps is negative
if steps < 0 then
--
-- Set the direction to negative 1
direction = -1
-- Convert the number of steps to positive
steps = -steps
end
-- Iterate over the number of steps
for _ = 1, steps do
--
-- Call the function to scroll
scroll_func(direction)
-- Pause for the scroll delay
ya.sleep(scroll_delay)
end
end
-- Function to do the wraparound for the arrow command
@ -3307,8 +3354,15 @@ local wraparound_arrow = ya.sync(function(_, args)
-- Get the current tab
local current_tab = cx.active.current
-- Get the step from the arguments given
local step = table.remove(args, 1)
-- Get the number of steps from the arguments given
local steps = table.remove(args, 1) or 1
-- If the step isn't a number,
-- immediately emit the arrow command
-- and exit the function
if type(steps) ~= "number" then
return ya.mgr_emit("arrow", merge_tables(args, { steps }))
end
-- Get the number of files in the current tab
local number_of_files = #current_tab.files
@ -3320,14 +3374,17 @@ local wraparound_arrow = ya.sync(function(_, args)
-- which is the current cursor position plus the step given
-- to the arrow function, modulus the number of files in
-- the current tab
local new_cursor_index = (current_tab.cursor + step) % number_of_files
local new_cursor_index = (current_tab.cursor + steps) % number_of_files
-- Emit the arrow function with the new cursor index minus
-- the current cursor index to determine how to move the cursor
ya.manager_emit(
"arrow",
merge_tables(args, { new_cursor_index - current_tab.cursor })
)
-- Get the url of the item at the new cursor index.
--
-- The plus one is needed to convert the cursor index,
-- which is 0-based, to a 1-based index,
-- which is what is used to index into the list of files.
local item_url = current_tab.files[new_cursor_index + 1].url
-- Emit the reveal command
ya.mgr_emit("reveal", merge_tables(args, { item_url }))
end)
-- Function to handle the arrow command
@ -3335,15 +3392,47 @@ end)
local function handle_arrow(args, config)
--
-- If wraparound file navigation isn't wanted,
-- then execute the arrow command
if not config.wraparound_file_navigation then
ya.manager_emit("arrow", args)
-- If smooth scrolling is wanted,
if config.smooth_scrolling then
--
-- Otherwise, call the wraparound arrow function
else
wraparound_arrow(args)
-- Get the number of steps from the arguments given
local steps = table.remove(args, 1) or 1
-- If the number of steps isn't a number,
-- immediately emit the arrow command
-- and exit the function
if type(steps) ~= "number" then
return ya.mgr_emit("arrow", merge_tables(args, { steps }))
end
-- Initialise the function to the regular arrow command
local function scroll_func(step)
ya.mgr_emit("arrow", merge_tables(args, { step }))
end
-- If wraparound file navigation is wanted
if config.wraparound_file_navigation then
--
-- Set the scroll function to the wraparound arrow command
function scroll_func(step)
wraparound_arrow(merge_tables(args, { step }))
end
end
-- Call the smoothly scroll function and exit the function
return smoothly_scroll(steps, config.scroll_delay, scroll_func)
end
-- Otherwise, if smooth scrolling is not wanted,
-- and wraparound file navigation is wanted,
-- call the wraparound arrow function
-- and exit the function
if config.wraparound_file_navigation then return wraparound_arrow(args) end
-- Otherwise, emit the regular arrow command
ya.mgr_emit("arrow", args)
end
-- Function to get the directory items in the parent directory
@ -3398,7 +3487,7 @@ local execute_parent_arrow = ya.sync(function(state, args)
if not parent_directory then return end
-- Get the offset from the arguments given
local offset = table.remove(args, 1)
local offset = table.remove(args, 1) or 1
-- Get the type of the offset
local offset_type = type(offset)
@ -3506,19 +3595,30 @@ local execute_parent_arrow = ya.sync(function(state, args)
-- Emit the command to change directory to
-- the directory item and exit the function
return ya.manager_emit("cd", { directory_item.url })
return ya.mgr_emit("cd", { directory_item.url })
end
end
end)
-- Function to handle the parent arrow command
---@type CommandFunction
local function handle_parent_arrow(args)
local function handle_parent_arrow(args, config)
--
-- Call the function to execute the parent arrow command
-- with the arguments given
execute_parent_arrow(args)
-- If smooth scrolling is not wanted,
-- call the function to execute the parent arrow command
if not config.smooth_scrolling then execute_parent_arrow(args) end
-- Otherwise, smooth scrolling is wanted,
-- so get the number of steps from the arguments given
local steps = table.remove(args, 1) or 1
-- Call the function to smoothly scroll the parent arrow command
smoothly_scroll(
steps,
config.scroll_delay,
function(step) execute_parent_arrow(merge_tables(args, { step })) end
)
end
-- Function to handle the editor command

View File

@ -1,4 +1,4 @@
--- @since 25.2.7
--- @since 25.2.26
local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
@ -13,7 +13,7 @@ end)
return {
entry = function()
ya.manager_emit("escape", { visual = true })
ya.mgr_emit("escape", { visual = true })
local urls = selected_or_hovered()
if #urls == 0 then

View File

@ -1,4 +1,4 @@
--- @since 25.2.7
--- @since 25.2.26
local function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED
@ -24,7 +24,7 @@ local function setup(_, opts)
c[3]:pad(ui.Pad.y(1)),
}
local style = THEME.manager.border_style
local style = th.mgr.border_style
self._base = ya.list_merge(self._base or {}, {
ui.Border(ui.Border.ALL):area(self._area):type(type):style(style),
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),

View File

@ -1,4 +1,4 @@
--- @since 25.2.7
--- @since 25.2.26
--- @sync entry
local function entry(st)
@ -14,12 +14,12 @@ local function entry(st)
else
st.old = Tab.layout
Tab.layout = function(self)
local all = MANAGER.ratio.parent + MANAGER.ratio.current
local r = rt.mgr.ratio
self._chunks = ui.Layout()
:direction(ui.Layout.HORIZONTAL)
:constraints({
ui.Constraint.Ratio(MANAGER.ratio.parent, all),
ui.Constraint.Ratio(MANAGER.ratio.current, all),
ui.Constraint.Ratio(r.parent, r.parent + r.current),
ui.Constraint.Ratio(r.current, r.parent + r.current),
ui.Constraint.Length(1),
})
:split(self._area)

View File

@ -76,10 +76,14 @@ local render_motion = ya.sync(function(_, motion_num, motion_cmd)
motion_span = ui.Span(string.format(" %3d%s ", motion_num, motion_cmd))
end
local status_config = THEME.status
local separator_open = status_config.separator_open or status_config.sep_right.open
local separator_close = status_config.separator_close or status_config.sep_right.close
return ui.Line {
ui.Span(THEME.status.separator_open):fg(style.main.bg),
ui.Span(separator_open):fg(style.main.bg),
motion_span:style(style.main),
ui.Span(THEME.status.separator_close):fg(style.main.bg),
ui.Span(separator_close):fg(style.main.bg),
ui.Span(" "),
}
end

View File

@ -3,7 +3,7 @@
[ -f "$XDG_CONFIG_HOME/zsh/startup" ] && source "$XDG_CONFIG_HOME/zsh/startup"
fpath=("$XDG_CONFIG_HOME/zsh/zfunc/" $fpath)
# Add deno completions to search path
# Add completions to search path
if [[ ":$FPATH:" != *":$XDG_CONFIG_HOME/zsh/completions:"* ]]; then export FPATH="$XDG_CONFIG_HOME/zsh/completions:$FPATH"; fi
# Options
@ -146,6 +146,7 @@ eval "$(fzf --zsh)"
eval "$(uv generate-shell-completion zsh)"
eval "$(uvx --generate-shell-completion zsh)"
eval "$(zoxide init zsh)"
eval "$(fastanime completions)"
[[ -r ~/.local/share/zsh/plugins/znap/znap.zsh ]] ||
git clone --depth 1 -- \

165
local/bin/ani-skip.bak Executable file
View File

@ -0,0 +1,165 @@
#!/bin/sh
version_number="1.0.1"
agent="Mozilla/5.0 (Windows NT 6.1; Win64; rv:109.0) Gecko/20100101 Firefox/109.0"
chapter_format="\n[CHAPTER]\nTIMEBASE=1/1000\nSTART=%s\nEND=%s\nTITLE=%s\n"
option_format="skip-%s_start=%s,skip-%s_end=%s"
die() {
printf "\33[2K\r\033[1;31m%s\033[0m\n" "$*" >&2
exit 1
}
help_info() {
printf "
Usage:
%s [OPTIONS]
Options:
-q, --query
Anime Title or MyAnimeList ID
-e, --episode
Specify the episode number
-V, --version
Show the version of the script
-h, --help
Show this help message and exit
-U, --update
Update the script
Some example usages:
%s -q \"Solo Leveling\" # Returns MyAnimeList ID
%s -q \"Solo Leveling\" -e 3 # Returns MPV skip flag
%s -q 52299 -e 5 # Returns MPV skip flag
\n" "${0##*/}" "${0##*/}" "${0##*/}" "${0##*/}"
exit 0
}
update_script() {
update="$(curl -s -A "$agent" "https://raw.githubusercontent.com/synacktraa/ani-skip/master/ani-skip")" || die "Connection error"
update="$(printf '%s\n' "$update" | diff -u "$0" -)"
if [ -z "$update" ]; then
printf "Script is up to date :)\n"
else
if printf '%s\n' "$update" | patch "$0" -; then
printf "Script has been updated\n"
else
die "Can't update for some reason!"
fi
fi
exit 0
}
fetch_mal_id() {
#shellcheck disable=SC2016
: '
`fetch_mal_id` fetches MyAnimeList Identifier of particular anime
:param $1: title of the anime
'
name=$(printf "%s" "$*" | sed 's| (\([0-9]*\) episodes)||')
keyword=$(printf "%s" "$name" | tr -c '[:alnum:]' ' ' | sed -E 's| |%20|g')
mal_metadata=$(curl -sL -A "$agent" "https://myanimelist.net/search/prefix.json?type=anime&keyword=$keyword" | tr -d "\\" 2>/dev/null)
name=$(printf "%s\n" "$name" | tr -cs '[:print:]' ' ' | tr -c '[:alnum:]' ' ')
fzf_nth=$(printf "%s," $(seq 1 "$(printf "%s" "$name" | wc -w)") | sed 's|,$||')
results=$(printf "%s" "$mal_metadata" | sed 's|},{|\n|g' | sed 's|.*,"name":"||g ; s|","url":".*||g')
relevant_name=$(printf "%s" "$results" | fzf -i --filter="$name" --nth="$fzf_nth" | head -n1)
[ -z "$relevant_name" ] && relevant_name=$(printf "%s" "$results" | fzf -i --filter="$name" | head -n1)
[ -z "$relevant_name" ] && relevant_name=$(printf "%s" "$results" | head -n1)
printf "%s" "$mal_metadata" | sed 's|},{|\n|g' | grep 'name":"'"$relevant_name"'","url":' | sed -nE 's|.*"id":([0-9]{1,9}),.*|\1|p'
}
ftoi() {
printf "%.3f" "$1" | tr -d '.'
}
build_options() {
#shellcheck disable=SC2016
: '
`build_options` builds options for `--script-opts` flag
:param $1: AniSkip metadata
'
st_time_re='"start_time":([0-9.]+)'
ed_time_re='"end_time":([0-9.]+)'
op_end=""
ed_start=""
options=""
for skip_type in "op" "ed"
do
sk_type_re='"skip_type":"('$skip_type')"'
unformatted=$(printf "%s" "$1" | grep -Eo "$st_time_re,$ed_time_re},$sk_type_re")
if [ -n "$unformatted" ]; then
st_time=$(printf "%s" "$unformatted" | grep -Eo "$st_time_re" | sed -E 's@'"$st_time_re"'@\1@')
ed_time=$(printf "%s" "$unformatted" | grep -Eo "$ed_time_re" | sed -E 's@'"$ed_time_re"'@\1@')
[ "$skip_type" = "op" ] && op_end=$ed_time && ch_name="Opening"
[ "$skip_type" = "ed" ] && ed_start=$st_time && ch_name="Ending"
[ -n "$options" ] && options="$options,"
printf "$chapter_format" "$(ftoi $st_time)" "$(ftoi $ed_time)" "$ch_name" >> $chapters_file
options=$(printf "%s%s" "$options" $(printf "$option_format" "$skip_type" "$st_time" "$skip_type" "$ed_time"))
fi
done
if [ -n "$op_end" ]; then
[ -n "$ed_start" ] && ep_ed=$ed_start || ep_ed=$op_end
printf "$chapter_format" "$(ftoi $op_end)" "$(ftoi $ep_ed)" "Episode" >> $chapters_file
fi
printf "%s" "$options"
}
build_flags() {
#shellcheck disable=SC2016
: '
`build_flags` builds `--script-opts` and `--chapters-file` flags for MPV player
:param $1: MyAnimeList Identifier
:param $2: Episode number
'
aniskip_api="https://api.aniskip.com/v1/skip-times/$1/$2?types=op&types=ed"
metadata=$(curl -s --connect-timeout 5 -A "$agent" "$aniskip_api")
found_status=$(printf "%s" "$metadata" | sed -n 's/.*"found":\([^,]*\).*/\1/p')
[ "$found_status" != "true" ] && die "Skip times not found!"
printf "%s" ";FFMETADATA1" > "$chapters_file"
options=$(build_options "$metadata")
[ -n "$options" ] && printf -- "--chapters-file=%s --script-opts=%s" "$chapters_file" "$options"
}
[ $# -eq 0 ] && help_info
while [ $# -gt 0 ]; do
[ "$OSTYPE" = msys* ] && flag=${1//[![:print:]]/} || flag="$1"
case "$flag" in
-U | --update) update_script ;;
-V | --version) printf "%s\n" "$version_number" && exit 0 ;;
-h | --help) help_info ;;
-q | --query)
[ $# -lt 2 ] && die "missing anime title/MyAnimeList ID!"
case $2 in
''|*[!0-9]*) mal_id=$(fetch_mal_id $2) ;;
*) mal_id=$2 ;;
esac
shift
;;
-e | --episode)
[ $# -lt 2 ] && die "missing episode number!"
case $2 in
''|*[!0-9]*) die "value must be a number!" ;;
*) episode=$2 ;;
esac
esac
shift
done
[ -z "$mal_id" ] && die "-q/--query is required!"
if [ -z "$episode" ]; then
printf "%s" "$mal_id"
else
chapters_file=$(mktemp)
build_flags $mal_id $episode
fi

View File

@ -1,25 +1,25 @@
#!/bin/bash
if [[ $# -eq 1 ]]; then
selected=$1
selected=$1
else
selected=$(fd --min-depth 1 --max-depth 1 --type d . ~/repos/Rust/ ~/repos/examples/ ~/repos/ ~/neorg/Work/ ~/Nextcloud/repos/ ~/Nextcloud/Documents/LaTeX/ ~/Nextcloud/Documents/Typst/ ~/Nextcloud/repos/university/** ~/Nextcloud/repos/university/**/**/ ~/repos/yoda-bot/ ~/repos/Codnity/ ~/repos/Codnity/emisela/ ~/repos/Codnity/dio/ ~/repos/Codnity/zaao/ ~/repos/Codnity/talentflow/ ~/Obsidian | sk --height 16)
selected=$(project-finder ~/repos/ ~/Nextcloud/ ~/Obsidian/ | sk --height 16)
fi
if [[ -z $selected ]]; then
exit 0
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s "$selected_name" -c "$selected"
exit 0
tmux new-session -s "$selected_name" -c "$selected"
exit 0
fi
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
tmux new-session -ds "$selected_name" -c "$selected"
fi
tmux switch-client -t "$selected_name"