Fresh start to remove subtree artifacts

This commit is contained in:
2025-01-22 12:56:39 +00:00
parent a42f4061af
commit dad55ecd26
44 changed files with 7651 additions and 1920 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "dot_config/nushell/nu_scripts"]
path = dot_config/nushell/nu_scripts
url = https://github.com/nushell/nu_scripts

View File

@@ -0,0 +1,485 @@
[%General]
author=Tsu Jan (Modified by ObsidianChickenz)
comment=A minimalistic dark theme inspired by the Arc GTK theme
x11drag=menubar_and_primary_toolbar
alt_mnemonic=true
left_tabs=true
attach_active_tab=true
mirror_doc_tabs=true
group_toolbar_buttons=false
toolbar_item_spacing=1
toolbar_interior_spacing=3
spread_progressbar=true
composite=true
menu_shadow_depth=5
menu_separator_height=6
tooltip_shadow_depth=6
splitter_width=4
scroll_width=9
scroll_arrows=false
scroll_min_extent=60
slider_width=6
slider_handle_width=18
slider_handle_length=18
center_toolbar_handle=true
check_size=14
textless_progressbar=false
progressbar_thickness=3font
menubar_mouse_tracking=true
toolbutton_style=1
click_behavior=0
translucent_windows=false
blurring=false
popup_blurring=false
vertical_spin_indicators=false
spin_button_width=32
fill_rubberband=false
merge_menubar_with_toolbar=true
small_icon_size=16
large_icon_size=32
button_icon_size=16
toolbar_icon_size=22
combo_as_lineedit=true
animate_states=false
button_contents_shift=false
combo_menu=true
hide_combo_checkboxes=true
combo_focus_rect=true
groupbox_top_label=true
inline_spin_indicators=false
joined_inactive_tabs=false
layout_spacing=6
layout_margin=9
scrollbar_in_view=true
transient_scrollbar=true
transient_groove=true
submenu_overlap=3
tooltip_delay=-1
tree_branch_line=true
dark_titlebar=true
contrast=1.00
dialog_button_layout=0
drag_from_buttons=false
intensity=1.00
menu_blur_radius=0
no_inactiveness=false
no_window_pattern=false
opaque=kaffeine,kmplayer,subtitlecomposer,kdenlive,vlc,smplayer,smplayer2,avidemux,avidemux2_qt4,avidemux3_qt4,avidemux3_qt5,kamoso,QtCreator,VirtualBox,VirtualBoxVM,trojita,dragon,digikam,lyx
reduce_menu_opacity=0
reduce_window_opacity=0
respect_DE=true
saturation=1.00
scrollable_menu=true
shadowless_popup=false
submenu_delay=250
tooltip_blur_radius=0
[GeneralColors]
window.color=#16161e
base.color=#1a1b26
alt.base.color=#1a1b26
button.color=#1d1f2b
light.color=#3e415c
mid.light.color=#313131
dark.color=black
mid.color=#191919
highlight.color=#7aa2f7
inactive.highlight.color=#7aa2f7
text.color=#c0caf5
window.text.color=#c0caf5
button.text.color=#c0caf5
disabled.text.color=#c0caf5
tooltip.text.color=#c0caf5
highlight.text.color=#1a1b26
link.color=#d8e4fd
link.visited.color=#a8c2fa
progress.indicator.text.color=#c0caf5
[Hacks]
transparent_ktitle_label=true
transparent_dolphin_view=false
transparent_pcmanfm_sidepane=true
blur_translucent=false
transparent_menutitle=true
respect_darkness=true
force_size_grip=true
iconless_pushbutton=true
iconless_menu=false
disabled_icon_opacity=100
lxqtmainmenu_iconsize=22
normal_default_pushbutton=true
single_top_toolbar=true
tint_on_mouseover=0
transparent_pcmanfm_view=false
blur_only_active_window=false
centered_forms=false
kinetic_scrolling=false
middle_click_scroll=false
no_selection_tint=false
noninteger_translucency=false
style_vertical_toolbars=false
[PanelButtonCommand]
frame=true
frame.element=button
frame.top=3
frame.bottom=3
frame.left=3
frame.right=3
interior=true
interior.element=button
indicator.size=9
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.press.color=#c0caf5
text.toggle.color=#c0caf5
text.shadow=0
text.margin=1
text.iconspacing=4
indicator.element=arrow
text.margin.top=2
text.margin.bottom=2
text.margin.left=2
text.margin.right=2
min_width=+0.3font
min_height=+0.3font
frame.expansion=6
[PanelButtonTool]
inherits=PanelButtonCommand
[Dock]
inherits=PanelButtonCommand
interior.element=dock
frame.element=dock
frame.top=1
frame.bottom=1
frame.left=1
frame.right=1
text.normal.color=#c0caf5
[DockTitle]
inherits=PanelButtonCommand
frame=false
interior=false
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.bold=true
[IndicatorSpinBox]
inherits=PanelButtonCommand
frame=true
interior=true
frame.left=1
indicator.element=spin
indicator.size=10
text.normal.color=#c0caf5
[RadioButton]
inherits=PanelButtonCommand
frame=false
interior.element=radio
text.normal.color=#c0caf5
text.focus.color=#c0caf5
[CheckBox]
inherits=PanelButtonCommand
frame=false
interior.element=checkbox
text.normal.color=#c0caf5
text.focus.color=#c0caf5
[Focus]
inherits=PanelButtonCommand
frame=true
frame.element=focus
frame.top=1
frame.bottom=1
frame.left=1
frame.right=1
frame.patternsize=20
[GenericFrame]
inherits=PanelButtonCommand
frame=true
interior=false
frame.element=common
interior.element=common
frame.top=3
frame.bottom=3
frame.left=3
frame.right=3
[LineEdit]
inherits=PanelButtonCommand
frame.element=lineedit
interior.element=lineedit
text.margin.left=1
text.margin.right=1
[DropDownButton]
inherits=PanelButtonCommand
indicator.element=arrow-down
[IndicatorArrow]
indicator.element=arrow
indicator.size=9
[ToolboxTab]
inherits=PanelButtonCommand
text.normal.color=#c0caf5
text.press.color=#c0caf5
text.focus.color=#c0caf5
[Tab]
inherits=PanelButtonCommand
interior.element=tab
text.margin.left=8
text.margin.right=8
text.margin.top=2
text.margin.bottom=2
frame.element=tab
indicator.element=tab
frame.top=4
frame.bottom=4
frame.left=4
frame.right=4
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.toggle.color=#c0caf5
frame.expansion=0
[TabFrame]
inherits=PanelButtonCommand
frame.element=tabframe
interior.element=tabframe
frame.top=4
frame.bottom=4
frame.left=4
frame.right=4
[TreeExpander]
inherits=PanelButtonCommand
indicator.size=12
indicator.element=tree
[HeaderSection]
inherits=PanelButtonCommand
interior.element=header
frame.element=header
frame.top=3
frame.bottom=3
frame.left=1
frame.right=1
text.bold=true
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.toggle.color=#c0caf5
frame.expansion=0
[SizeGrip]
indicator.element=resize-grip
[Toolbar]
inherits=PanelButtonCommand
indicator.element=toolbar
indicator.size=5
text.margin=0
frame=false
interior.element=menubar
frame.element=menubar
text.normal.color=#c0caf5
text.focus.color=#c0caf5
frame.bottom=0
frame.expansion=0
[Slider]
inherits=PanelButtonCommand
frame.element=slider
interior.element=slider
frame.top=3
frame.bottom=3
frame.left=3
frame.right=3
[SliderCursor]
inherits=PanelButtonCommand
frame=false
interior.element=slidercursor
[Progressbar]
inherits=PanelButtonCommand
frame.element=progress
interior.element=progress
text.margin=0
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.press.color=#c0caf5
text.toggle.color=#c0caf5
text.bold=false
frame.expansion=8
[ProgressbarContents]
inherits=PanelButtonCommand
frame=true
frame.element=progress-pattern
interior.element=progress-pattern
[ItemView]
inherits=PanelButtonCommand
text.margin=0
frame.element=itemview
interior.element=itemview
frame.top=2
frame.bottom=2
frame.left=2
frame.right=2
text.margin.top=2
text.margin.bottom=2
text.margin.left=4
text.margin.right=4
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.press.color=#c0caf5
text.toggle.color=#c0caf5
frame.expansion=0
[Splitter]
indicator.size=48
[Scrollbar]
inherits=PanelButtonCommand
indicator.element=arrow
indicator.size=10
[ScrollbarSlider]
inherits=PanelButtonCommand
frame.element=scrollbarslider
interior=false
frame.left=6
frame.right=6
frame.top=6
frame.bottom=6
indicator.element=grip
indicator.size=13
frame.expansion=48
[ScrollbarGroove]
inherits=PanelButtonCommand
interior=false
frame=false
[MenuItem]
inherits=PanelButtonCommand
frame=true
frame.element=menuitem
interior.element=menuitem
indicator.element=menuitem
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.margin.top=1
text.margin.bottom=1
text.margin.left=15
text.margin.right=5
frame.top=3
frame.bottom=3
frame.left=3
frame.right=3
frame.expansion=0
[MenuBar]
inherits=PanelButtonCommand
frame.element=menubar
interior.element=menubar
frame.bottom=0
frame.expansion=0
[MenuBarItem]
inherits=PanelButtonCommand
interior=true
interior.element=menubaritem
frame.element=menubaritem
frame.top=2
frame.bottom=2
frame.left=2
frame.right=2
text.margin.left=4
text.margin.right=4
text.margin.top=0
text.margin.bottom=0
text.normal.color=#c0caf5
text.focus.color=#c0caf5
frame.expansion=0
[TitleBar]
inherits=PanelButtonCommand
frame=false
interior.element=titlebar
indicator.size=12
indicator.element=mdi
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.bold=true
text.italic=true
frame.expansion=0
[ComboBox]
inherits=PanelButtonCommand
interior.element=combo
frame.element=combo
text.press.color=#c0caf5
indicator.element=carrow
[Menu]
inherits=PanelButtonCommand
frame.top=1
frame.bottom=1
frame.left=1
frame.right=1
frame.element=menu
interior.element=menu
text.normal.color=#c0caf5
text.shadow=false
frame.expansion=0
[GroupBox]
inherits=GenericFrame
frame=false
text.shadow=0
text.margin=0
text.normal.color=#c0caf5
text.focus.color=#c0caf5
text.bold=true
frame.expansion=0
[TabBarFrame]
inherits=GenericFrame
frame=true
frame.element=tabBarFrame
interior=false
frame.top=4
frame.bottom=4
frame.left=4
frame.right=4
[ToolTip]
inherits=GenericFrame
frame.top=3
frame.bottom=3
frame.left=3
frame.right=3
interior=true
text.shadow=0
text.margin=0
interior.element=tooltip
frame.element=tooltip
frame.expansion=0
[StatusBar]
inherits=GenericFrame
frame=false
interior=false
[Window]
interior=true
interior.element=window

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 149 KiB

View File

@@ -0,0 +1,2 @@
[General]
theme=KvArcTokyoNight

13
dot_config/ghostty/config Normal file
View File

@@ -0,0 +1,13 @@
theme = dark:tokyonight,light:tokyonight-day
font-family = MonaspiceNe Nerd Font Mono
font-size = 16.0
desktop-notifications = false
keybind = ctrl+n=new_window
keybind = ctrl+t=new_tab
keybind = ctrl+h=previous_tab
keybind = ctrl+left=previous_tab
keybind = ctrl+l=next_tab
keybind = ctrl+right=next_tab
keybind = ctrl+space=toggle_quick_terminal
keybind = global:ctrl+space=toggle_quick_terminal

View File

@@ -2,3 +2,10 @@ mod? nix "~/.config/nix"
default:
@just -g --list
update-homeserver:
ssh homeserver just -g nix prebuild
ssh root@homeserver chown -R root:nixcfg /home/cianh/.config/nix/
ssh root@homeserver just -g update-root
ssh root@homeserver chown -R cianh:nixcfg /home/cianh/.config/nix/
ssh homeserver just -g nix _update-home

View File

@@ -8,29 +8,20 @@ map ctrl+shift+[ discard_event
map ctrl+shift+] discard_event
map ctrl+shift+n discard_event
map ctrl+shift+q discard_event
# I like the zellij bindings so lets make something similar here
map alt+n new_window
map alt+shift+n launch --cwd=current
map ctrl+alt+n new_os_window
map ctrl+alt+shift+n new_os_window_with_cwd
map alt+q close_window
map alt+l next_window
map alt+right next_window
map alt+h previous_window
map alt+left previous_window
map alt+shift+l move_window_forward
map alt+shift+right move_window_forward
map alt+shift+h move_window_backward
map alt+shift+left move_window_backward
map alt+r start_resizing_window
# Lets fill in the gaps with tab controls that make sense
map alt+t new_tab
map alt+shift+t set_tab_title
map alt+k next_tab
map alt+up next_tab
map alt+j previous_tab
map alt+down previous_tab
map alt+shift+k move_tab_forward
map alt+shift+up move_tab_forward
map alt+shift+j move_tab_backward
map alt+shift+down move_tab_backward
# Next, lets bind my usual keys, with ctrl as the modifier key
map ctrl+h new_window
map ctrl+shift+h launch --cwd=current
map ctrl+n new_os_window
map ctrl+shift+n new_os_window_with_cwd
map ctrl+q close_window
map ctrl+right next_window
map ctrl+left previous_window
map ctrl+shift+right move_window_forward
map ctrl+shift+left move_window_backward
map ctrl+space start_resizing_window
map ctrl+t new_tab
map ctrl+shift+t set_tab_title
map ctrl+l next_tab
map ctrl+h previous_tab
map alt+shift+l move_tab_forward
map alt+shift+h move_tab_backward

View File

@@ -33,9 +33,6 @@ export alias bashpoem = poetry run bash
export alias nupoem = poetry run nu
export alias jupyterpoem = poetry run jupyter
# Aliases for custom git commands
export alias git-ammend = git commit -a --amend -C HEAD
# Who even uses vim or *especially* vi in this day and age?
export alias vim = nvim
export alias vi = nvim

View File

@@ -12,7 +12,6 @@ source ~/.config/nushell/nu_scripts/custom-completions/man/man-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/mix/mix-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/nano/nano-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/nix/nix-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/pass/pass-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/poetry/poetry-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/pre-commit/pre-commit-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/pytest/pytest-completions.nu

View File

@@ -11,7 +11,5 @@ source ~/.config/nushell/nu_scripts.nu
source ~/.config/nushell/completions/atuin.nu
source ~/.config/nushell/completions/zoxide.nu
source ~/.config/nushell/completions/nu_scripts.nu
# import nushell libs
use task.nu
# Finally, we run a system info fetch
sysfetch

View File

@@ -71,10 +71,6 @@ $env.LESS_TERMCAP_so = (ansi --escape "01;44;36m") # begin standout-mode (botto
$env.LESS_TERMCAP_se = (ansi --escape "0m") # end standout-mode
$env.LESS_TERMCAP_us = (ansi --escape "00;36m") # begin underline
$env.LESS_TERMCAP_ue = (ansi --escape "0m") # end underline
# Set a custom copy of TERM so that shells under multiplexors behave correctly
if not ("MAIN_TERM" in $env) {
$env.MAIN_TERM = $env.TERM
}
# Finally, add session path variables
$env.PATH = (

View File

@@ -29,7 +29,7 @@ export def main [] {
PWD: [
{|before, after| # This hook runs onefetch when the current directory is a git repository
if ".git\n" in ($after | ls -a | str join) {
print (^onefetch)
print (^onefetch --nerd-fonts)
}
},
{||

View File

@@ -1,33 +1,23 @@
export def create_left_prompt [] -> string {
canonicalize_linefeeds (
^starship prompt
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
def get_env [s: string]: string -> string {
try { $env | get --ignore-errors $s } catch { "" }
}
export def create_right_prompt [] -> string {
canonicalize_linefeeds (
^starship prompt
--right
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
export def create_left_prompt []: nothing -> string {
^starship prompt --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
}
export def create_continuation_prompt [] -> string {
canonicalize_linefeeds (
^starship prompt
--continuation
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
export def create_right_prompt []: nothing -> string {
^starship prompt --right --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
}
def parse_ms_to_human_readable [ms: string] -> string {
export def create_continuation_prompt []: nothing -> string {
^starship prompt --continuation --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
}
def parse_ms_to_human_readable [ms: string]: string -> string {
if $ms == "" {
$ms
} else {
let $time_in_ms = $ms | into int;
if $time_in_ms < 1000 {
$"($time_in_ms | into string)ms"
@@ -41,22 +31,15 @@ def parse_ms_to_human_readable [ms: string] -> string {
$"(($time_in_ms // (1000 * 60 * 60 * 24)) | into string)d/(parse_ms_to_human_readable ($time_in_ms mod (1000 * 60 * 60 * 24)))"
} | into string
}
export def create_transient_prompt_left [] -> string {
if $env.LAST_EXIT_CODE == 0 {
$"(ansi green_bold)(ansi reset)"
} else {
$"(ansi red_bold)(ansi reset)"
}
}
export def create_transient_prompt_indicator [] -> string {
$"(ansi blue_bold)(parse_ms_to_human_readable $env.CMD_DURATION_MS) (if $env.LAST_EXIT_CODE == 0 { ansi green_bold } else { ansi red_bold })(ansi reset) "
}
def canonicalize_linefeeds (x: string) -> string {
if ("OS" in $env) and ($env.OS == "Windows_NT") {
$x | str replace "\n" "\r\n"
export def create_transient_prompt_left []: nothing -> string {
if (get_env "LAST_EXIT_CODE") == 0 {
$"(ansi green_bold)󱔳(ansi reset)"
} else {
$x
$"(ansi red_bold)󱔷(ansi reset)"
}
}
export def create_transient_prompt_indicator []: nothing -> string {
$"(ansi blue_bold) 󰔛 (parse_ms_to_human_readable (get_env "CMD_DURATION_MS")) (if (get_env "LAST_EXIT_CODE") == 0 { ansi green_bold } else { ansi red_bold })(ansi reset) "
}

View File

@@ -1,458 +0,0 @@
export module mod {
export def main [] {"
Subcommands:
clean: Remove tasks from the status list.
edit: Edit the command, path or label of a stashed or queued task.
group: Add or remove groups.
kill: Kill specific running tasks or whole task groups.
log: Display the output of tasks.
pause: Either pause a running tasks or a specific groups of tasks.
queue: Queue stashed tasks for execution.
remove: Remove tasks from the queue.
restart: Restart failed or successful task(s).
send: Send something to a task. Useful for sending confirmations such as 'y' or 'n'.
set-parallel-limit: Set the maximum parallel tasks for a group.
shutdown: Shutdown pueue and thus this module.
spawn: Spawn a task to run in the background, even when the shell is closed.
start: Resume operation of specific tasks or groups of tasks.
stash: Stash a task that is not currently running.
status: Display the current status of all tasks.
switch: Switches the queue position of two tasks.
wait: Wait until the provided tasks are finished.
"}
# Spawn a task to run in the background, even when the shell is closed.
#
# Note that a fresh Nushell interpreter is spawned to execute the
# given task, so it won't inherit the current scope's variables,
# custom commands and alias definitions.
#
# It will only inherit environment variables which can be converted to a string.
#
# Note that the closure can't take arguments.
#
# Example usage: task spawn { echo "Hello, World!" }
export def spawn [
command: closure # The closure to run.
--working-directory (-w): directory # Specify the working directory the task will be run in.
--immediate (-i) # Immediately start the task.
--stashed (-s) # Create the task in Stashed state. Useful to avoid immediate execution if the queue is empty
--delay (-d): duration # Queue the task for execution only after the duration.
--group (-g): string # The group to spawn the task under.
--after (-a): int # Start the task once all specified tasks have successfully finished. As soon as one of the dependencies fails, this task will fail as well.
--priority (-o): string # Start this task with a higher priority. The higher the number, the faster it will be processed.
--label (-l): string # Label the task. This string will be shown in the `status` column of `task status`.
] -> int {
mut args = []
if $working_directory != null {
$args = ($args | prepend ["--working-directory", $working_directory])
}
if $immediate {
$args = ($args | prepend "--immediate")
}
if $stashed {
$args = ($args | prepend "--stashed")
}
if $delay != null {
$args = ($args | prepend ["--delay" ($delay | format duration sec | parse "{secs} {_}" | get 0.secs)])
}
if $group != null {
$args = ($args | prepend ["--group" $group])
}
if $after != null {
$args = ($args | prepend ["--after" $after])
}
if $priority != null {
$args = ($args | prepend ["--priority" $priority])
}
if $label != null {
$args = ($args | prepend ["--label" $label])
}
let source_path = mktemp --tmpdir --suffix "-nu-task"
(
view source $command
| str trim --left --char "{"
| str trim --right --char "}"
)
| save --force $source_path
(pueue add --print-task-id ...$args $"nu --config '($nu.config-path)' --env-config '($nu.env-path)' ($source_path)")
}
# Remove tasks from the queue.
# Running or paused tasks need to be killed first.
export def remove [
...ids: int # IDs of the tasks to remove from the status list.
] {
pueue remove ...$ids
}
# Switches the queue position of two tasks.
# Only works for queued or stashed tasks.
export def switch [
task_id_1: int # The first task ID.
task_id_2: int # The second task ID.
] {
pueue switch $task_id_1 $task_id_2
}
# Stash a task that is not currently running.
#
# Stashed tasks won't be automatically started.
# You will have to queue them or start them by hand.
export def stash [
...ids: int # IDs of the tasks to stash.
] {
pueue stash ...$ids
}
# Queue stashed tasks for execution.
export def queue [
...ids: int # IDs of the tasks to queue.
--delay (-d): duration # Queue only after the specified delay.
] {
let args = if $delay != null {
["--delay" ($delay | format duration sec | parse '{secs} {_}' | get 0.secs)]
} else {
[]
}
pueue enqueue ...$args ...$ids
}
# Resume operation of specific tasks or groups of tasks.
#
# By default, this resumes the default group and all its tasks.
# It can also be used force-start specific tasks or start whole groups.
export def start [
...ids: int # IDs of the tasks to start. By default all the tasks in the default group will be started.
--group (-g): string # Resume a specific group and all paused tasks in it. The group will be set to running and its paused tasks will be resumed.
--all (-a) # Resume all groups. All groups will be set to running and paused tasks will be resumed.
] {
mut args = []
if $group != null {
$args = ($args | prepend ["--group" $group])
}
if $all {
$args = ($args | prepend "--all")
}
pueue start ...$args
}
# Restart failed or successful task(s).
#
# By default, identical tasks will be created and
# enqueued, but it's possible to restart in-place.
#
# You can also edit a few properties, such as
# the path and the command of the task, before restarting.
export def restart [
...ids: int # IDs of the tasks to restart.
--all-failed (-a) # Restart all failed tasks across all groups. Nice to use in combination with `--in-place/i`.
--failed-in-group (-g): string # Like `--all-failed`, but only restart tasks failed tasks of a specific group. The group will be set to running and its paused tasks will be resumed.
--start-immediately (-k) # Immediately start the tasks, no matter how many open slots there are. This will ignore any dependencies tasks may have.
--stashed (-s) # Set the restarted task to a "Stashed" state. Useful to avoid immediate execution.
--in-place (-i) # Restart the tasks by reusing the already existing tasks.
--not-in-place (-n) # Opposite of `--in-place`. This is already the default unless you have `restart_in_place` set to true.
--edit (-e) # Edit the tasks' commands before restarting
--edit-path (-p) # Edit the tasks' paths before restarting
--edit-label (-l) # Edit the tasks' labels before restarting
] {
mut args = []
if $all_failed {
$args = ($args | prepend "--all-failed")
}
if $failed_in_group != null {
$args = ($args | prepend "--failed-in-group")
}
if $start_immediately {
$args = ($args | prepend "--start-immediately")
}
if $stashed {
$args = ($args | prepend "--stashed")
}
if $in_place {
$args = ($args | prepend "--in-place")
}
if $not_in_place {
$args = ($args | prepend "--not-in-place")
}
if $edit {
$args = ($args | prepend "--edit")
}
if $edit_path {
$args = ($args | prepend "--edit-path")
}
if $edit_label {
$args = ($args | prepend "--edit-label")
}
pueue restart ...$args ...$ids
}
# Either pause a running tasks or a specific groups of tasks.
#
# By default, pauses the default group and all its tasks.
#
# A paused group won't start any new tasks automatically.
export def pause [
...ids: int # IDs of the tasks to pause.
--group (-g) # Pause a specific group
--all (-a) # Pause all groups.
--wait (-w) # Only pause the specified group and let already running tasks finish by themselves
] {
mut args = []
if $group != null {
$args = ($args | prepend "--group")
}
if $all != null {
$args = ($args | prepend "--all")
}
if $wait != null {
$args = ($args | prepend "--wait")
}
pueue pause ...$args ...$ids
}
# Kill specific running tasks or whole task groups.
#
# Kills all tasks of the default group when no ids or a specific group are provided.
export def kill [
...ids: int # IDs of the tasks to kill.
--group (-g): string # Kill all running tasks in a group. This also pauses the group.
--all (-a) # Kill all running tasks across ALL groups. This also pauses all groups.
--signal (-s): string # Send a UNIX signal instead of simply killing the process. DISCLAIMER: This bypasses Pueue's process handling logic! You might enter weird invalid states, use at your own descretion.
] {
mut args = []
if $group != null {
$args = ($args | prepend ["--group" $group])
}
if $all {
$args = ($args | prepend "--all")
}
if $signal != null {
$args = ($args | prepend ["--signal" $signal])
}
pueue kill ...$args ...$ids
}
# Send something to a task. Useful for sending confirmations such as "y\n".
export def send [
id: int # ID of the task to send something to.
input: string # The input that should be sent to the process.
] {
pueue send $id $input
}
# Edit the command, path or label of a stashed or queued task.
#
# By default only the command is edited.
#
# Multiple properties can be added in one go.
export def edit [
id: int # ID of the task to edit.
--command (-c) # Edit the task's command
--path (-p) # Edit the task's path
--label (-l) # Edit the task's label
] {
mut args = []
if $command {
$args = ($args | prepend "--command")
}
if $path {
$args = ($args | prepend "--path")
}
if $label {
$args = ($args | prepend "--label")
}
pueue edit ...$args $id
}
# Use this to add or remove groups.
#
# By default, this will simply display all known groups.
export def group [] {
pueue group --json | from json
}
# Create a new group with a name.
export def "group add" [
name: string # The name of the new group.
--parallel (-p): int # The amount of parallel tasks the group can run at one time.
] {
let args = if $parallel != null {
["--parallel" $parallel]
} else {
[]
}
pueue group add ...$args $name
}
# Remove a group with a name.
export def "group remove" [
name: string # The name of the group to be removed.
] {
pueue group remove $name
}
# Display the current status of all tasks.
export def status [
--detailed (-d) # Return a table with more detailed information.
] {
let output = (
pueue status --json
| from json
| get tasks
| transpose --ignore-titles status
| flatten
)
# TODO: Rename the Done column to done.
if not $detailed {
$output | select id label group Done? status? start? end?
} else {
$output
}
}
# Display the output of tasks.
#
# Only the last few lines will be shown by default for multiple tasks.
# If you want to follow the output, use `--tail/-t`.
export def log [
...ids: int # The tasks to check the outputs of.
--last (-l): int # Only print the last N lines of each task's output. This is done by default if you're looking at multiple tasks.
--tail (-t) # Follow the output as it is printing. Only works with 1 task. When used in conjunction with `--last`, the last N lines will be printed before starting to wait for output.
--detailed (-d) # Include all fields, don't simplify output.
] {
def process_raw [raw: string] {
let full = (
$raw
| from json
| transpose -i info
| flatten --all
| flatten --all
)
if $detailed {
$full
} else {
$full | select id label group Done? status? start? end?
}
}
if (($ids | length) == 1) {
if $tail {
let args = if $last != null {
["--lines" $last]
} else {
[]
}
pueue follow ...$ids
} else {
let args = if $last != null {
["--lines" $last]
} else {
[]
}
process_raw (pueue log --full --json ...$args ...$ids)
| first
}
} else {
if $tail {
echo $"(ansi red)--tail can only be used with one task.(ansi reset)"
return
}
let args = if $last != null {
["--lines" $last]
} else {
[]
}
process_raw (pueue log --full --json ...$args ...$ids)
}
}
# Wait until the provided tasks are finished.
#
# This is like join() or await in many languages.
export def wait [
...ids: int # IDs of the tasks to wait for.
--group (-g): string # Wait for all tasks in a specific group.
--all (-a) # Wait for all tasks across all groups and the default group.
--quiet (-q) # Don't show any log output while waiting.
--status (-s): string # Wait for tasks to reach a specific task status.
] {
mut args = []
if $group != null {
$args = ($args | prepend ["--group" $group])
}
if $all {
$args = ($args | prepend $all)
}
if $quiet {
$args = ($args | prepend $quiet)
}
if $status != null {
$args = ($args | prepend ["--status" $status])
}
pueue wait ...$args ...$ids
}
# Remove tasks from the status list.
export def clean [
--successful-only (-s) # Only clean tasks that finished successfully
--group (-g): string # Only clean tasks of a specific group
] {
mut args = []
if $successful_only {
$args = ($args | prepend "--successful-only")
}
if $group != null {
$args = ($args | prepend ["--group" $group])
}
pueue clean ...$args
}
# Shutdown pueue and thus this module.
export def shutdown [] {
pueue shutdown
}
# Set the maximum parallel tasks for a group.
#
# Note that no tasks will be stopped if the number is lowered.
# The limit only applies when schelduing.
export def set-parallel-limit [
max: int # The maximum parallel tasks allowed for a group when schelduing.
--group (-g): string # The group to set the limit for. By default this is `default`.
] {
let args = if $group != null {
["--group" $group]
} else {
[]
}
pueue parallel ...$args $max
}
}

View File

@@ -1,10 +1,10 @@
export def 'exists' [ app: string ] -> bool {
export def 'exists' [ app ]: string -> bool {
not (which $app | is-empty)
}
export def 'sysfetch' [] {
export def 'sysfetch' []: nothing -> nothing {
if (exists fastfetch) {
if ("MAIN_TERM" in $env) and ("kitty" in $env.MAIN_TERM) and ($"($env.HOME)/.config/fastfetch/kitty.jsonc" | path exists) {
if (("kitty" in $env.TERM) or ("ghostty" in $env.TERM)) and ($"($env.HOME)/.config/fastfetch/kitty.jsonc" | path exists) {
fastfetch --load-config $"($env.HOME)/.config/fastfetch/kitty.jsonc"
} else {
fastfetch
@@ -23,7 +23,7 @@ export def 'sysfetch' [] {
}
}
export def 'register-plugins' [] {
export def 'register-plugins' []: nothing -> nothing {
for plugin_dir in $env.NU_PLUGIN_DIRS {
for plugin_path in (ls $"($env.NU_PLUGIN_DIRS.0)/nu_plugin_*").name {
nu -c $"register ($plugin_path)"
@@ -31,7 +31,7 @@ export def 'register-plugins' [] {
}
}
export def 'build-plugins' [] {
export def 'build-plugins' []: nothing -> nothing {
let curdir = pwd
let plugin_dir = $env.NU_PLUGIN_DIRS.0
cd $plugin_dir
@@ -40,7 +40,7 @@ export def 'build-plugins' [] {
register-plugins
}
export def 'install-default-plugins' [] {
export def 'install-default-plugins' []: nothing -> nothing {
[ nu_plugin_inc
nu_plugin_polars
# nu_plugin_gstat

View File

@@ -0,0 +1,2 @@
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2

View File

@@ -0,0 +1,2 @@
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2

View File

@@ -0,0 +1,2 @@
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2

View File

@@ -0,0 +1 @@
vim.keymap.set("i", "'", "'", { buffer = 0 })

View File

@@ -7,6 +7,7 @@ return {
{ "<leader>r", group = "[R]ename" },
{ "<leader>w", group = "[W]orkspace" },
{ "<leader>t", group = "[T]ree" },
{ "<leader>l", group = "[L]azyGit" },
{ "<leader>o", group = "[O]verseer" },
{ "<leader>h", group = "[H]arpoon" },
{ "<leader>x", group = "[X] Trouble" },
@@ -41,7 +42,7 @@ return {
mode = "n",
},
{
"<C-h>",
"<A-a>",
function()
require("harpoon"):list():select(1)
end,
@@ -49,7 +50,7 @@ return {
mode = "n",
},
{
"<C-j>",
"<A-s>",
function()
require("harpoon"):list():select(2)
end,
@@ -57,7 +58,7 @@ return {
mode = "n",
},
{
"<C-k>",
"<A-d>",
function()
require("harpoon"):list():select(3)
end,
@@ -65,7 +66,7 @@ return {
mode = "n",
},
{
"<C-l>",
"<A-f>",
function()
require("harpoon"):list():select(4)
end,
@@ -74,7 +75,30 @@ return {
},
},
lazygit = {
{ "<leader>l", "<cmd>LazyGit<cr>", desc = "[L]azyGit", mode = "n" },
{
"<leader>lg",
function()
vim.api.nvim_command("lua Snacks.lazygit()")
end,
desc = "[L]azy[G]it",
mode = "n",
},
{
"<leader>ll",
function()
vim.api.nvim_command("lua Snacks.lazygit.log()")
end,
desc = "[L]azyGit [L]og",
mode = "n",
},
{
"<leader>lf",
function()
vim.api.nvim_command("lua Snacks.lazygit.log_file()")
end,
desc = "[L]azyGit [F]ile Log",
mode = "n",
},
},
neogen = {
{

View File

@@ -1,19 +1,19 @@
-- vim.keymap.set("n", "<C-h>", "<C-w>h", { noremap = true, silent = true })
-- vim.keymap.set("n", "<C-j>", "<C-w>j", { noremap = true, silent = true })
-- vim.keymap.set("n", "<C-k>", "<C-w>k", { noremap = true, silent = true })
-- vim.keymap.set("n", "<C-l>", "<C-w>l", { noremap = true, silent = true })
vim.keymap.set("n", "<C-Left>", "<C-w>h", { noremap = true, silent = true })
vim.keymap.set("n", "<C-Down>", "<C-w>j", { noremap = true, silent = true })
vim.keymap.set("n", "<C-Up>", "<C-w>k", { noremap = true, silent = true })
vim.keymap.set("n", "<C-Right>", "<C-w>l", { noremap = true, silent = true })
vim.keymap.set("n", "<C-=>", "<C-w>+", { noremap = true, silent = true })
vim.keymap.set("n", "<C-->", "<C-w>-", { noremap = true, silent = true })
vim.keymap.set("n", "<C-.>", "<C-w>>", { noremap = true, silent = true })
vim.keymap.set("n", "<C-,>", "<C-w><", { noremap = true, silent = true })
vim.keymap.set("n", "<C-n>", "<C-w>s", { noremap = true, silent = true })
vim.keymap.set("n", "<A-h>", "<C-w>h", { noremap = true, silent = true })
vim.keymap.set("n", "<A-j>", "<C-w>j", { noremap = true, silent = true })
vim.keymap.set("n", "<A-k>", "<C-w>k", { noremap = true, silent = true })
vim.keymap.set("n", "<A-l>", "<C-w>l", { noremap = true, silent = true })
vim.keymap.set("n", "<A-Left>", "<C-w>h", { noremap = true, silent = true })
vim.keymap.set("n", "<A-Down>", "<C-w>j", { noremap = true, silent = true })
vim.keymap.set("n", "<A-Up>", "<C-w>k", { noremap = true, silent = true })
vim.keymap.set("n", "<A-Right>", "<C-w>l", { noremap = true, silent = true })
vim.keymap.set("n", "<A-=>", "<C-w>+", { noremap = true, silent = true })
vim.keymap.set("n", "<A-->", "<C-w>-", { noremap = true, silent = true })
vim.keymap.set("n", "<A-.>", "<C-w>>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-,>", "<C-w><", { noremap = true, silent = true })
vim.keymap.set("n", "<A-n>", "<C-w>s", { noremap = true, silent = true })
-- This keymap isn't ideal but its the best i can figure out right now
vim.keymap.set("n", "<C-;>", "<C-w>x", { noremap = true, silent = true })
vim.keymap.set("n", "<C-q>", ":q<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-;>", "<C-w>x", { noremap = true, silent = true })
vim.keymap.set("n", "<A-q>", ":q<CR>", { noremap = true, silent = true })
-- Non standard key mappings are here
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, { desc = "[D]iagnostics" })
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, { desc = "[F]ormat" })

View File

@@ -17,29 +17,14 @@ return { -- Mini is so varied it's hard to categorise. So i dumped my mini insta
-- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup()
-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
-- local statusline = require("mini.statusline")
-- set use_icons to true if you have a Nerd Font
-- statusline.setup({ use_icons = vim.g.have_nerd_font })
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
-- cursor location to LINE:COLUMN
---@diagnostic disable-next-line: duplicate-set-field
-- statusline.section_location = function()
-- return "%2l:%-2v"
-- end
-- Setup of mini.notify
-- local notify = require("mini.notify")
-- notify.setup()
-- vim.notify = notify.make_notify({
-- ERROR = { duration = 5000 },
-- WARN = { duration = 4000 },
-- INFO = { duration = 3000 },
-- })
local notify = require("mini.notify")
notify.setup()
vim.notify = notify.make_notify({
ERROR = { duration = 5000 },
WARN = { duration = 4000 },
INFO = { duration = 3000 },
})
-- Some other mini.nvim plugins that look useful to me
require("mini.clue").setup()
@@ -51,28 +36,68 @@ return { -- Mini is so varied it's hard to categorise. So i dumped my mini insta
require("mini.trailspace").setup()
-- My custom mini.starter config
-- This function runs a vim command then exits the buffer that called it
function _Launch_Vim_Cmd(cmd)
local startbuf = vim.api.nvim_get_current_buf()
vim.cmd(cmd)
vim.api.nvim_buf_delete(startbuf, {})
end
local custom_items = {
local starter_items = {
{
name = "Status",
action = "Git status",
section = "Git",
action = "Telescope file_browser",
name = "Tree",
section = "Telescope",
},
{
action = "Telescope live_grep",
name = "Live grep",
section = "Telescope",
},
{
action = "Telescope find_files",
name = "File grep",
section = "Telescope",
},
{
action = "Telescope command_history",
name = "Command history",
section = "Telescope",
},
{
action = "Telescope help_tags",
name = "Help tags",
section = "Telescope",
},
{
name = "Log",
action = [[lua _Launch_Vim_Cmd("Git log --graph --pretty=oneline --abbrev-commit")]],
action = [[lua Snacks.lazygit.log()]],
section = "Git",
},
{
name = "Lazygit",
action = "LazyGit",
action = [[lua Snacks.lazygit()]],
section = "Git",
},
{
name = "Browser",
action = function()
local handle = io.popen("git remote show")
if handle == nil then
vim.notify("Failed to find remote", vim.log.levels.ERROR)
return
end
local result = handle:read("*a")
handle:close()
local remote = vim.split(result, "\n")[1]
handle = io.popen("git remote get-url " .. remote)
if handle == nil then
vim.notify("Failed to get url for " .. remote, vim.log.levels.ERROR)
return
end
local url = handle:read("*a")
handle:close()
handle = io.popen("xdg-open " .. url)
if handle == nil then
vim.notify("Failed to open " .. url, vim.log.levels.ERROR)
return
end
result = handle:read("*a")
handle:close()
end,
section = "Git",
},
{
@@ -96,11 +121,8 @@ return { -- Mini is so varied it's hard to categorise. So i dumped my mini insta
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣷⡀⠀⠀⠀⠀⢹⣿⣆⠀⠀⠀⠀⠀\
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⡇⠀⠀⠀⠀⠸⣿⣿⡄⠀⠀⠀⠀\
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⡿⣿⣿⠀⠀⠀⠀\
⠀⠀⠀⠀⠀⠀⠀⠈⠙⠀⠀⠀⠀⠀",
items = {
require("mini.starter").sections.telescope(),
custom_items,
},
⠀⠀⠀⠀⠀⠀⠀⠈⠙⠀⠀⠀⠀⠀",
items = starter_items,
footer = "",
})
end,

View File

@@ -0,0 +1,14 @@
return {
{
"folke/snacks.nvim",
priority = 1000,
lazy = false,
---@type snacks.Config
opts = {
bigfile = { enabled = true },
lazygit = { enabled = true },
quickfile = { enabled = true },
},
keys = require("config.keys").lazygit,
},
}

View File

@@ -98,12 +98,12 @@ return { -- UI components and other visual elements are declared here
{
"harpoon2",
icon = "󰛢",
indicators = { "H", "J", "K", "L" },
indicators = { "A", "S", "D", "F" },
active_indicators = {
"%#LualineHarpoonActive#H%*",
"%#LualineHarpoonActive#J%*",
"%#LualineHarpoonActive#K%*",
"%#LualineHarpoonActive#L%*",
"%#LualineHarpoonActive#A%*",
"%#LualineHarpoonActive#S%*",
"%#LualineHarpoonActive#D%*",
"%#LualineHarpoonActive#F%*",
},
_separator = "",
no_harpoon = "Harpoon not loaded",

View File

@@ -42,21 +42,6 @@ return { -- General programming utilities go here
},
"tpope/vim-fugitive", -- Also want to add fugitive, since it's apparently a great git plugin
"jlfwong/vim-mercenary", -- Mercenary is the mercurial equivalent of fugitive
{
"kdheepak/lazygit.nvim",
cmd = {
"LazyGit",
"LazyGitConfig",
"LazyGitCurrentFile",
"LazyGitFilter",
"LazyGitFilterCurrentFile",
},
-- optional for floating window border decoration
dependencies = {
"nvim-lua/plenary.nvim",
},
keys = require("config.keys").lazygit,
},
{ -- Oil is a very nice buffer-based filetree editor
"stevearc/oil.nvim",
event = "VeryLazy",
@@ -167,19 +152,19 @@ return { -- General programming utilities go here
-- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert({
-- Select the [n]ext item
["<C-n>"] = cmp.mapping.select_next_item(),
["<M-n>"] = cmp.mapping.select_next_item(),
-- Select the [p]revious item
["<C-p>"] = cmp.mapping.select_prev_item(),
["<M-p>"] = cmp.mapping.select_prev_item(),
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<M-y>"] = cmp.mapping.confirm({ select = true }),
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
["<C-Space>"] = cmp.mapping.complete({}),
["<M-Space>"] = cmp.mapping.complete({}),
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
@@ -189,12 +174,12 @@ return { -- General programming utilities go here
--
-- <c-,> will move you to the right of each of the expansion locations.
-- <c-.> is similar, except moving you backwards.
["<C-,>"] = cmp.mapping(function()
["<M-,>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<C-.>"] = cmp.mapping(function()
["<M-.>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end

View File

@@ -1,17 +1,23 @@
"$schema" = 'https://starship.rs/config-schema.json'
# Inserts a blank line between shell prompts
add_newline = true
continuation_prompt = "[:::](yellow)"
continuation_prompt = "[󰾗━ ](yellow)"
[character]
success_symbol = "[](bold green) "
error_symbol = "[](bold red) "
success_symbol = "[󱔳](bold green) "
error_symbol = "[󱔷](bold red) "
[cmd_duration]
min_time = 2_000 # Show command duration over 2 sec
format = " took [$duration]($style)"
min_time = 0
show_milliseconds = true
show_notifications = true
min_time_to_notify = 30_000
format = " [󰔛 $duration]($style)"
[hostname]
ssh_only = false
ssh_symbol = " "
format = "[$hostname]($style) "
style = "bold dimmed blue"
disabled = false
@@ -24,3 +30,169 @@ show_always = true
# Disable the package module, hiding it from the prompt completely
[package]
disabled = true
# Finally, manually add slightly modified swttings from the nerdfonts preset config
[aws]
symbol = " "
[buf]
symbol = " "
[c]
symbol = " "
[conda]
symbol = " "
[crystal]
symbol = " "
[dart]
symbol = " "
[directory]
read_only = " 󰌾"
[docker_context]
symbol = " "
[elixir]
symbol = " "
[elm]
symbol = " "
[fennel]
symbol = " "
[fossil_branch]
symbol = " "
[git_branch]
symbol = " "
[git_commit]
tag_symbol = '  '
[golang]
symbol = " "
[guix_shell]
symbol = " "
[haskell]
symbol = " "
[haxe]
symbol = " "
[hg_branch]
symbol = " "
[java]
symbol = " "
[julia]
symbol = " "
[kotlin]
symbol = " "
[lua]
symbol = " "
[memory_usage]
symbol = "󰍛 "
[meson]
symbol = "󰔷 "
[nim]
symbol = "󰆥 "
[nix_shell]
symbol = " "
[nodejs]
symbol = " "
[ocaml]
symbol = " "
[os.symbols]
Alpaquita = " "
Alpine = " "
AlmaLinux = " "
Amazon = " "
Android = " "
Arch = " "
Artix = " "
CentOS = " "
Debian = " "
DragonFly = " "
Emscripten = " "
EndeavourOS = " "
Fedora = " "
FreeBSD = " "
Garuda = "󰛓 "
Gentoo = " "
HardenedBSD = "󰞌 "
Illumos = "󰈸 "
Kali = " "
Linux = " "
Mabox = " "
Macos = " "
Manjaro = " "
Mariner = " "
MidnightBSD = " "
Mint = " "
NetBSD = " "
NixOS = " "
OpenBSD = "󰈺 "
openSUSE = " "
OracleLinux = "󰌷 "
Pop = " "
Raspbian = " "
Redhat = " "
RedHatEnterprise = " "
RockyLinux = " "
Redox = "󰀘 "
Solus = "󰠳 "
SUSE = " "
Ubuntu = " "
Unknown = " "
Void = " "
Windows = "󰍲 "
[perl]
symbol = " "
[php]
symbol = " "
[pijul_channel]
symbol = " "
[python]
symbol = " "
[rlang]
symbol = "󰟔 "
[ruby]
symbol = " "
[rust]
symbol = "󱘗 "
[scala]
symbol = " "
[swift]
symbol = " "
[zig]
symbol = " "
[gradle]
symbol = " "

View File

@@ -1,3 +1,485 @@
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
[manager]
keymap = [
{ on = "<Esc>", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
{ on = "<A-[>", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
{ on = "q", run = "quit", desc = "Quit the process" },
{ on = "Q", run = "quit --no-cwd-file", desc = "Quit the process without outputting cwd-file" },
{ on = "<A-c>", run = "close", desc = "Close the current tab, or quit if it's last" },
{ on = "<A-z>", run = "suspend", desc = "Suspend the process" },
# Hopping
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<A-u>", run = "arrow -50%", desc = "Move cursor up half page" },
{ on = "<A-d>", run = "arrow 50%", desc = "Move cursor down half page" },
{ on = "<A-b>", run = "arrow -100%", desc = "Move cursor up one page" },
{ on = "<A-f>", run = "arrow 100%", desc = "Move cursor down one page" },
{ on = "<S-PageUp>", run = "arrow -50%", desc = "Move cursor up half page" },
{ on = "<S-PageDown>", run = "arrow 50%", desc = "Move cursor down half page" },
{ on = "<PageUp>", run = "arrow -100%", desc = "Move cursor up one page" },
{ on = "<PageDown>", run = "arrow 100%", desc = "Move cursor down one page" },
{ on = [
"g",
"g",
], run = "arrow -99999999", desc = "Move cursor to the top" },
{ on = "G", run = "arrow 99999999", desc = "Move cursor to the bottom" },
# Navigation
{ on = "h", run = "leave", desc = "Go back to the parent directory" },
{ on = "l", run = "enter", desc = "Enter the child directory" },
{ on = "<Left>", run = "leave", desc = "Go back to the parent directory" },
{ on = "<Right>", run = "enter", desc = "Enter the child directory" },
{ on = "H", run = "back", desc = "Go back to the previous directory" },
{ on = "L", run = "forward", desc = "Go forward to the next directory" },
# Toggle
{ on = "<Space>", run = [
"toggle",
"arrow 1",
], desc = "Toggle the current selection state" },
{ on = "<A-a>", run = "toggle_all --state=on", desc = "Select all files" },
{ on = "<A-r>", run = "toggle_all", desc = "Invert selection of all files" },
# Visual mode
{ on = "v", run = "visual_mode", desc = "Enter visual mode (selection mode)" },
{ on = "V", run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" },
# Seeking
{ on = "K", run = "seek -5", desc = "Seek up 5 units in the preview" },
{ on = "J", run = "seek 5", desc = "Seek down 5 units in the preview" },
# Spotting
{ on = "<Tab>", run = "spot", desc = "Spot hovered file" },
# Operation
{ on = "o", run = "open", desc = "Open selected files" },
{ on = "O", run = "open --interactive", desc = "Open selected files interactively" },
{ on = "<Enter>", run = "open", desc = "Open selected files" },
{ on = "<S-Enter>", run = "open --interactive", desc = "Open selected files interactively" },
{ on = "y", run = "yank", desc = "Yank selected files (copy)" },
{ on = "x", run = "yank --cut", desc = "Yank selected files (cut)" },
{ on = "p", run = "paste", desc = "Paste yanked files" },
{ on = "P", run = "paste --force", desc = "Paste yanked files (overwrite if the destination exists)" },
{ on = "-", run = "link", desc = "Symlink the absolute path of yanked files" },
{ on = "_", run = "link --relative", desc = "Symlink the relative path of yanked files" },
{ on = "<A-->", run = "hardlink", desc = "Hardlink yanked files" },
{ on = "Y", run = "unyank", desc = "Cancel the yank status" },
{ on = "X", run = "unyank", desc = "Cancel the yank status" },
{ on = "d", run = "remove", desc = "Trash selected files" },
{ on = "D", run = "remove --permanently", desc = "Permanently delete selected files" },
{ on = "a", run = "create", desc = "Create a file (ends with / for directories)" },
{ on = "r", run = "rename --cursor=before_ext", desc = "Rename selected file(s)" },
{ on = ";", run = "shell --interactive", desc = "Run a shell command" },
{ on = ":", run = "shell --block --interactive", desc = "Run a shell command (block until finishes)" },
{ on = ".", run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
{ on = "s", run = "search --via=fd", desc = "Search files by name via fd" },
{ on = "S", run = "search --via=rg", desc = "Search files by content via ripgrep" },
{ on = "<A-s>", run = "escape --search", desc = "Cancel the ongoing search" },
{ on = "z", run = "plugin zoxide", desc = "Jump to a directory via zoxide" },
{ on = "Z", run = "plugin fzf", desc = "Jump to a file/directory via fzf" },
# Linemode
{ on = [
"m",
"s",
], run = "linemode size", desc = "Linemode: size" },
{ on = [
"m",
"p",
], run = "linemode permissions", desc = "Linemode: permissions" },
{ on = [
"m",
"b",
], run = "linemode btime", desc = "Linemode: btime" },
{ on = [
"m",
"m",
], run = "linemode mtime", desc = "Linemode: mtime" },
{ on = [
"m",
"o",
], run = "linemode owner", desc = "Linemode: owner" },
{ on = [
"m",
"n",
], run = "linemode none", desc = "Linemode: none" },
# Copy
{ on = [
"c",
"c",
], run = "copy path", desc = "Copy the file path" },
{ on = [
"c",
"d",
], run = "copy dirname", desc = "Copy the directory path" },
{ on = [
"c",
"f",
], run = "copy filename", desc = "Copy the filename" },
{ on = [
"c",
"n",
], run = "copy name_without_ext", desc = "Copy the filename without extension" },
# Filter
{ on = "f", run = "filter --smart", desc = "Filter files" },
# Find
{ on = "/", run = "find --smart", desc = "Find next file" },
{ on = "?", run = "find --previous --smart", desc = "Find previous file" },
{ on = "n", run = "find_arrow", desc = "Goto the next found" },
{ on = "N", run = "find_arrow --previous", desc = "Goto the previous found" },
# Sorting
{ on = [
",",
"m",
], run = [
"sort mtime --reverse=no",
"linemode mtime",
], desc = "Sort by modified time" },
{ on = [
",",
"M",
], run = [
"sort mtime --reverse",
"linemode mtime",
], desc = "Sort by modified time (reverse)" },
{ on = [
",",
"b",
], run = [
"sort btime --reverse=no",
"linemode btime",
], desc = "Sort by birth time" },
{ on = [
",",
"B",
], run = [
"sort btime --reverse",
"linemode btime",
], desc = "Sort by birth time (reverse)" },
{ on = [
",",
"e",
], run = "sort extension --reverse=no", desc = "Sort by extension" },
{ on = [
",",
"E",
], run = "sort extension --reverse", desc = "Sort by extension (reverse)" },
{ on = [
",",
"a",
], run = "sort alphabetical --reverse=no", desc = "Sort alphabetically" },
{ on = [
",",
"A",
], run = "sort alphabetical --reverse", desc = "Sort alphabetically (reverse)" },
{ on = [
",",
"n",
], run = "sort natural --reverse=no", desc = "Sort naturally" },
{ on = [
",",
"N",
], run = "sort natural --reverse", desc = "Sort naturally (reverse)" },
{ on = [
",",
"s",
], run = [
"sort size --reverse=no",
"linemode size",
], desc = "Sort by size" },
{ on = [
",",
"S",
], run = [
"sort size --reverse",
"linemode size",
], desc = "Sort by size (reverse)" },
{ on = [
",",
"r",
], run = "sort random --reverse=no", desc = "Sort randomly" },
# Goto
{ on = [
"g",
"h",
], run = "cd ~", desc = "Go home" },
{ on = [
"g",
"c",
], run = "cd ~/.config", desc = "Goto ~/.config" },
{ on = [
"g",
"d",
], run = "cd ~/Downloads", desc = "Goto ~/Downloads" },
{ on = [
"g",
"<Space>",
], run = "cd --interactive", desc = "Jump interactively" },
# Tabs
{ on = "t", run = "tab_create --current", desc = "Create a new tab with CWD" },
{ on = "1", run = "tab_switch 0", desc = "Switch to the first tab" },
{ on = "2", run = "tab_switch 1", desc = "Switch to the second tab" },
{ on = "3", run = "tab_switch 2", desc = "Switch to the third tab" },
{ on = "4", run = "tab_switch 3", desc = "Switch to the fourth tab" },
{ on = "5", run = "tab_switch 4", desc = "Switch to the fifth tab" },
{ on = "6", run = "tab_switch 5", desc = "Switch to the sixth tab" },
{ on = "7", run = "tab_switch 6", desc = "Switch to the seventh tab" },
{ on = "8", run = "tab_switch 7", desc = "Switch to the eighth tab" },
{ on = "9", run = "tab_switch 8", desc = "Switch to the ninth tab" },
{ on = "[", run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
{ on = "]", run = "tab_switch 1 --relative", desc = "Switch to the next tab" },
{ on = "{", run = "tab_swap -1", desc = "Swap current tab with previous tab" },
{ on = "}", run = "tab_swap 1", desc = "Swap current tab with next tab" },
# Tasks
{ on = "w", run = "tasks_show", desc = "Show task manager" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[tasks]
keymap = [
{ on = "<Esc>", run = "close", desc = "Close task manager" },
{ on = "<A-[>", run = "close", desc = "Close task manager" },
{ on = "<A-c>", run = "close", desc = "Close task manager" },
{ on = "w", run = "close", desc = "Close task manager" },
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Enter>", run = "inspect", desc = "Inspect the task" },
{ on = "x", run = "cancel", desc = "Cancel the task" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[spot]
keymap = [
{ on = "<Esc>", run = "close", desc = "Close the spot" },
{ on = "<A-[>", run = "close", desc = "Close the spot" },
{ on = "<A-c>", run = "close", desc = "Close the spot" },
{ on = "<Tab>", run = "close", desc = "Close the spot" },
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "h", run = "swipe -1", desc = "Swipe to the next file" },
{ on = "l", run = "swipe 1", desc = "Swipe to the previous file" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Left>", run = "swipe -1", desc = "Swipe to the next file" },
{ on = "<Right>", run = "swipe 1", desc = "Swipe to the previous file" },
# Copy
{ on = ["c", "c"], run = "copy cell", desc = "Copy selected cell" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[pick]
keymap = [
{ on = "<Esc>", run = "close", desc = "Cancel pick" },
{ on = "<A-[>", run = "close", desc = "Cancel pick" },
{ on = "<A-c>", run = "close", desc = "Cancel pick" },
{ on = "<Enter>", run = "close --submit", desc = "Submit the pick" },
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[input]
keymap = [
{ on = "<A-c>", run = "close", desc = "Cancel input" },
{ on = "<Enter>", run = "close --submit", desc = "Submit input" },
{ on = "<Esc>", run = "escape", desc = "Go back the normal mode, or cancel input" },
{ on = "<A-[>", run = "escape", desc = "Go back the normal mode, or cancel input" },
# Mode
{ on = "i", run = "insert", desc = "Enter insert mode" },
{ on = "a", run = "insert --append", desc = "Enter append mode" },
{ on = "I", run = [
"move -999",
"insert",
], desc = "Move to the BOL, and enter insert mode" },
{ on = "A", run = [
"move 999",
"insert --append",
], desc = "Move to the EOL, and enter append mode" },
{ on = "v", run = "visual", desc = "Enter visual mode" },
{ on = "V", run = [
"move -999",
"visual",
"move 999",
], desc = "Enter visual mode and select all" },
# Character-wise movement
{ on = "h", run = "move -1", desc = "Move back a character" },
{ on = "l", run = "move 1", desc = "Move forward a character" },
{ on = "<Left>", run = "move -1", desc = "Move back a character" },
{ on = "<Right>", run = "move 1", desc = "Move forward a character" },
{ on = "<A-b>", run = "move -1", desc = "Move back a character" },
{ on = "<A-f>", run = "move 1", desc = "Move forward a character" },
# Word-wise movement
{ on = "b", run = "backward", desc = "Move back to the start of the current or previous word" },
{ on = "w", run = "forward", desc = "Move forward to the start of the next word" },
{ on = "e", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
{ on = "<A-b>", run = "backward", desc = "Move back to the start of the current or previous word" },
{ on = "<A-f>", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
# Line-wise movement
{ on = "0", run = "move -999", desc = "Move to the BOL" },
{ on = "$", run = "move 999", desc = "Move to the EOL" },
{ on = "<A-a>", run = "move -999", desc = "Move to the BOL" },
{ on = "<A-e>", run = "move 999", desc = "Move to the EOL" },
{ on = "<Home>", run = "move -999", desc = "Move to the BOL" },
{ on = "<End>", run = "move 999", desc = "Move to the EOL" },
# Delete
{ on = "<Backspace>", run = "backspace", desc = "Delete the character before the cursor" },
{ on = "<Delete>", run = "backspace --under", desc = "Delete the character under the cursor" },
{ on = "<A-h>", run = "backspace", desc = "Delete the character before the cursor" },
{ on = "<A-d>", run = "backspace --under", desc = "Delete the character under the cursor" },
# Kill
{ on = "<A-u>", run = "kill bol", desc = "Kill backwards to the BOL" },
{ on = "<A-k>", run = "kill eol", desc = "Kill forwards to the EOL" },
{ on = "<A-w>", run = "kill backward", desc = "Kill backwards to the start of the current word" },
{ on = "<A-d>", run = "kill forward", desc = "Kill forwards to the end of the current word" },
# Cut/Yank/Paste
{ on = "d", run = "delete --cut", desc = "Cut the selected characters" },
{ on = "D", run = [
"delete --cut",
"move 999",
], desc = "Cut until the EOL" },
{ on = "c", run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" },
{ on = "C", run = [
"delete --cut --insert",
"move 999",
], desc = "Cut until the EOL, and enter insert mode" },
{ on = "x", run = [
"delete --cut",
"move 1 --in-operating",
], desc = "Cut the current character" },
{ on = "y", run = "yank", desc = "Copy the selected characters" },
{ on = "p", run = "paste", desc = "Paste the copied characters after the cursor" },
{ on = "P", run = "paste --before", desc = "Paste the copied characters before the cursor" },
# Undo/Redo
{ on = "u", run = "undo", desc = "Undo the last operation" },
{ on = "<A-r>", run = "redo", desc = "Redo the last operation" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[confirm]
keymap = [
{ on = "<Esc>", run = "close", desc = "Cancel the confirm" },
{ on = "<A-[>", run = "close", desc = "Cancel the confirm" },
{ on = "<A-c>", run = "close", desc = "Cancel the confirm" },
{ on = "<Enter>", run = "close --submit", desc = "Submit the confirm" },
{ on = "n", run = "close", desc = "Cancel the confirm" },
{ on = "y", run = "close --submit", desc = "Submit the confirm" },
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[completion]
keymap = [
{ on = "<A-c>", run = "close", desc = "Cancel completion" },
{ on = "<Tab>", run = "close --submit", desc = "Submit the completion" },
{ on = "<Enter>", run = [
"close --submit",
"close_input --submit",
], desc = "Submit the completion and input" },
{ on = "<A-k>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<A-j>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<A-p>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<A-n>", run = "arrow 1", desc = "Move cursor down" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[help]
keymap = [
{ on = "<Esc>", run = "escape", desc = "Clear the filter, or hide the help" },
{ on = "<A-[>", run = "escape", desc = "Clear the filter, or hide the help" },
{ on = "<A-c>", run = "close", desc = "Hide the help" },
# Navigation
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
# Filtering
{ on = "f", run = "filter", desc = "Apply a filter for the help items" },
]
[[manager.prepend_keymap]]
on = ["c", "m"]
run = "plugin chmod"

View File

@@ -1,5 +1,5 @@
[plugin]
deps = [{ use = "Reledia/glow", rev = "f52b382" }, { use = "Reledia/hexyl", rev = "ccc0a4a" }, { use = "Rolv-Apneseth/starship", rev = "77a65f5" }, { use = "yazi-rs/plugins:git", rev = "4f1d0ae" }, { use = "yazi-rs/plugins:full-border", rev = "4f1d0ae" }, { use = "yazi-rs/plugins:chmod", rev = "4f1d0ae" }, { use = "yazi-rs/plugins:max-preview", rev = "4f1d0ae" }, { use = "yazi-rs/plugins:mime-ext", rev = "4f1d0ae" }]
deps = [{ use = "Reledia/glow", rev = "5ce76dc" }, { use = "Reledia/hexyl", rev = "39d3d4e" }, { use = "Rolv-Apneseth/starship", rev = "9c37d37" }, { use = "yazi-rs/plugins:git", rev = "71c4fc2" }, { use = "yazi-rs/plugins:full-border", rev = "71c4fc2" }, { use = "yazi-rs/plugins:chmod", rev = "71c4fc2" }, { use = "yazi-rs/plugins:max-preview", rev = "71c4fc2" }, { use = "yazi-rs/plugins:mime-ext", rev = "71c4fc2" }]
[flavor]
deps = []

View File

@@ -15,33 +15,25 @@ return {
local urls = selected_or_hovered()
if #urls == 0 then
return ya.notify({
title = "Chmod",
content = "No file selected",
level = "warn",
timeout = 5,
})
return ya.notify { title = "Chmod", content = "No file selected", level = "warn", timeout = 5 }
end
local value, event = ya.input({
local value, event = ya.input {
title = "Chmod:",
position = { "top-center", y = 3, w = 40 },
})
}
if event ~= 1 then
return
end
local status, err = Command("chmod"):arg(value):args(urls):spawn():wait()
if not status or not status.success then
ya.notify({
ya.notify {
title = "Chmod",
content = string.format(
"Chmod with selected files failed, exit code %s",
status and status.code or err
),
content = string.format("Chmod on selected files failed, error: %s", status and status.code or err),
level = "error",
timeout = 5,
})
}
end
end,
}

View File

@@ -1,12 +1,3 @@
-- TODO: remove this once v0.4 is released
local v4 = function(typ, area, ...)
if typ == "bar" then
return ui.Table and ui.Bar(...):area(area) or ui.Bar(area, ...)
else
return ui.Table and ui.Border(...):area(area) or ui.Border(area, ...)
end
end
local function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build
@@ -14,14 +5,14 @@ local function setup(_, opts)
Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then
return v4("bar", ui.Rect.default, ui.Bar.TOP)
return ui.Bar(ui.Bar.TOP)
end
return v4(
"bar",
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) },
ui.Bar.TOP
):symbol(c)
return ui.Bar(ui.Bar.TOP)
:area(
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) }
)
:symbol(c)
end
local c = self._chunks
@@ -33,9 +24,9 @@ local function setup(_, opts)
local style = THEME.manager.border_style
self._base = ya.list_merge(self._base or {}, {
v4("border", self._area, ui.Border.ALL):type(type):style(style),
v4("bar", self._chunks[1], ui.Bar.RIGHT):style(style),
v4("bar", self._chunks[3], ui.Bar.LEFT):style(style),
ui.Border(ui.Border.ALL):area(self._area):type(type):style(style),
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
ui.Bar(ui.Bar.LEFT):area(self._chunks[3]):style(style),
bar("", c[1].right - 1, c[1].y),
bar("", c[1].right - 1, c[1].bottom - 1),

View File

@@ -1,7 +1,7 @@
# git.yazi
> [!NOTE]
> Yazi v0.3.3 or later is required for this plugin to work.
> Yazi v0.4.1 or later is required for this plugin to work.
Show the status of Git file changes as linemode in the file list.
@@ -37,9 +37,6 @@ run = "git"
## Advanced
> [!NOTE]
> This section currently requires Yazi nightly that includes https://github.com/sxyazi/yazi/pull/1637
You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with:
- `THEME.git.modified`

View File

@@ -27,9 +27,19 @@ local function match(line)
end
local function root(cwd)
local is_worktree = function(url)
local file, head = io.open(tostring(url)), nil
if file then
head = file:read(8)
file:close()
end
return head == "gitdir: "
end
repeat
local cha = fs.cha(cwd:join(".git"))
if cha and cha.is_dir then
local next = cwd:join(".git")
local cha = fs.cha(next)
if cha and (cha.is_dir or is_worktree(next)) then
return tostring(cwd)
end
cwd = cwd:parent()
@@ -137,15 +147,15 @@ local function setup(st, opts)
if not change or signs[change] == "" then
return ui.Line("")
elseif self._file:is_hovered() then
return ui.Line({ ui.Span(" "), ui.Span(signs[change]) })
return ui.Line { ui.Span(" "), ui.Span(signs[change]) }
else
return ui.Line({ ui.Span(" "), ui.Span(signs[change]):style(styles[change]) })
return ui.Line { ui.Span(" "), ui.Span(signs[change]):style(styles[change]) }
end
end, opts.order)
end
local function fetch(self)
local cwd = self.files[1].url:parent()
local function fetch(_, job)
local cwd = job.files[1].url:parent()
local repo = root(cwd)
if not repo then
remove(tostring(cwd))
@@ -153,7 +163,7 @@ local function fetch(self)
end
local paths = {}
for _, f in ipairs(self.files) do
for _, f in ipairs(job.files) do
paths[#paths + 1] = tostring(f.url)
end
@@ -165,7 +175,7 @@ local function fetch(self)
:stdout(Command.PIPED)
:output()
if not output then
ya.err("Cannot spawn git command, error code " .. tostring(err))
ya.err("Cannot spawn git command, error: " .. err)
return 0
end
@@ -179,7 +189,7 @@ local function fetch(self)
end
end
if self.files[1].cha.is_dir then
if job.files[1].cha.is_dir then
ya.dict_merge(changed, bubble_up(changed))
ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo)))
else

View File

@@ -16,3 +16,15 @@ prepend_previewers = [
```
Make sure you have [glow](https://github.com/charmbracelet/glow) installed, and can be found in `PATH`.
## Feature
+ You can modify line wrap in `init.lua`, the current value is 55.
+ You can press `ctrl+e` to scroll up and `ctrl+y` to scroll down the readme file in preview panel in yazi: (add this to `keymap.toml`)
```toml
prepend_keymap = [
# glow.yazi
{ on = ["<C-e>"], run = "seek 5" },
{ on = ["<C-y>"], run = "seek -5" },
]
```

View File

@@ -1,13 +1,16 @@
local M = {}
function M:peek()
local child = Command("/usr/bin/env glow")
function M:peek(job)
-- Set a fixed width of 55 characters for the preview
local preview_width = 55
local child = Command("glow")
:args({
"--style",
"dark",
"--width",
tostring(self.area.w),
tostring(self.file.url),
tostring(preview_width), -- Use fixed width instead of job.area.w
tostring(job.file.url),
})
:env("CLICOLOR_FORCE", "1")
:stdout(Command.PIPED)
@@ -15,61 +18,59 @@ function M:peek()
:spawn()
if not child then
return self:fallback_to_builtin()
return require("code").peek(job)
end
local limit = self.area.h
local limit = job.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
return self:fallback_to_builtin()
return require("code").peek(job)
elseif event ~= 0 then
break
end
i = i + 1
if i > self.skip then
if i > job.skip then
lines = lines .. next
end
until i >= self.skip + limit
until i >= job.skip + limit
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{
if job.skip > 0 and i < job.skip + limit then
ya.manager_emit("peek", {
tostring(math.max(0, i - limit)),
only_if = tostring(self.file.url),
upper_bound = "",
}
)
only_if = job.file.url,
upper_bound = true
})
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Text.parse(lines):area(self.area) })
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
end
end
function M:seek(units)
function M:seek(job)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + step)),
only_if = tostring(self.file.url),
})
end
if not h or h.url ~= job.file.url then
return
end
function M:fallback_to_builtin()
local err, bound = ya.preview_code(self)
if bound then
ya.manager_emit("peek", { bound, only_if = self.file.url, upper_bound = true })
elseif err and not err:find("cancelled", 1, true) then
ya.preview_widgets(self, {
ui.Text({ ui.Line(err):reverse() }):area(self.area),
})
local scroll_amount = 1
local scroll_offset = job.units
if job.key == "ctrl-e" then
scroll_offset = scroll_amount
elseif job.key == "ctrl-y" then
scroll_offset = -scroll_amount
else
scroll_offset = job.units
end
ya.manager_emit('peek', {
math.max(0, cx.active.preview.skip + scroll_offset),
only_if = job.file.url,
})
end
return M

View File

@@ -1,12 +1,12 @@
local M = {}
function M:peek()
function M:peek(job)
local child
local l = self.file.cha.len
if l == 0 then
child = Command("hexyl")
:args({
tostring(self.file.url),
tostring(job.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
@@ -17,15 +17,15 @@ function M:peek()
"--border",
"none",
"--terminal-width",
tostring(self.area.w),
tostring(self.file.url),
tostring(job.area.w),
tostring(job.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
end
local limit = self.area.h
local limit = job.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
@@ -36,32 +36,22 @@ function M:peek()
end
i = i + 1
if i > self.skip then
if i > job.skip then
lines = lines .. next
end
until i >= self.skip + limit
until i >= job.skip + limit
child:start_kill()
if self.skip > 0 and i < self.skip + limit then
ya.manager_emit(
"peek",
{ math.max(0, i - limit), only_if = self.file.url, upper_bound = true }
)
if job.skip > 0 and i < job.skip + limit then
ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true })
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Text.parse(lines):area(self.area) })
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
end
end
function M:seek(units)
local h = cx.active.current.hovered
if h and h.url == self.file.url then
local step = math.floor(units * self.area.h / 10)
ya.manager_emit("peek", {
tostring(math.max(0, cx.active.preview.skip + step)),
only_if = tostring(self.file.url),
})
end
require("code").seek(job, units)
end
return M

View File

@@ -17,7 +17,7 @@ Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin --sync max-preview"
run = "plugin max-preview"
desc = "Maximize or restore preview"
```

View File

@@ -1,3 +1,5 @@
--- @sync entry
local function entry(st)
if st.old then
Tab.layout, st.old = st.old, nil

View File

@@ -17,7 +17,7 @@ Add this to your `~/.config/yazi/yazi.toml`:
```toml
[[plugin.prepend_fetchers]]
id = "mime"
if = "!mime"
if = "!(mime|dummy)"
name = "*"
run = "mime-ext"
prio = "high"
@@ -31,13 +31,13 @@ You can also customize it in your `~/.config/yazi/init.lua` with:
require("mime-ext"):setup {
-- Expand the existing filename database (lowercase), for example:
with_files = {
makefile = "text/x-makefile",
makefile = "text/makefile",
-- ...
},
-- Expand the existing extension database (lowercase), for example:
with_exts = {
mk = "text/x-makefile",
mk = "text/makefile",
-- ...
},
@@ -50,7 +50,6 @@ require("mime-ext"):setup {
## TODO
- Add more file types (PRs welcome!).
- Eliminating `x-` as part of Yazi v0.4 as it's discouraged as per [rfc6838#section-3.4](https://datatracker.ietf.org/doc/html/rfc6838#section-3.4)
- Compress mime-type tables.
## License

File diff suppressed because it is too large Load Diff

View File

@@ -50,21 +50,21 @@ If you use a `starship` theme with a background colour, it might look a bit to c
```lua
local old_build = Tab.build
Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then
return ui.Bar(ui.Rect.default, ui.Bar.TOP)
return ui.Bar(ui.Bar.TOP):area(ui.Rect.default)
end
return ui.Bar(
ui.Rect({
return ui.Bar(ui.Bar.TOP)
:area(ui.Rect({
x = x,
y = math.max(0, y),
w = ya.clamp(0, self._area.w - x, 1),
h = math.min(1, self._area.h),
}),
ui.Bar.TOP
):symbol(c)
}))
:symbol(c)
end
local c = self._chunks
@@ -76,15 +76,14 @@ Tab.build = function(self, ...)
local style = THEME.manager.border_style
self._base = ya.list_merge(self._base or {}, {
-- Enable for full border
--[[ ui.Border(self._area, ui.Border.ALL):type(ui.Border.ROUNDED):style(style), ]]
ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style),
ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style),
ui.Border(ui.Border.ALL):area(self._area):type(ui.Border.ROUNDED):style(style),
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
ui.Bar(ui.Bar.LEFT):area(self._chunks[1]):style(style),
bar("", c[1].right - 1, c[1].y),
bar("", c[1].right - 1, c[1].bottom - 1),
bar("", c[2].right, c[2].y),
bar("", c[2].right, c[1].bottom - 1),
bar("", c[2].right, c[2].bottom - 1),
})
old_build(self, ...)

View File

@@ -61,7 +61,12 @@ return {
ps.sub("tab", callback)
end,
entry = function(_, args)
entry = function(_, job_or_args)
-- yazi 2024-11-29 changed the way arguments are passed to the plugin
-- entry point. They were moved inside {args = {...}}. If the user is using
-- a version before this change, they can use the old implementation.
-- https://github.com/sxyazi/yazi/pull/1966
local args = job_or_args.args or job_or_args
local command = Command("starship"):arg("prompt"):cwd(args[1]):env("STARSHIP_SHELL", "")
-- Point to custom starship config

View File

@@ -1,14 +1,10 @@
// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true"
keybinds {
normal {
// uncomment this and adjust key if using copy_on_select=false
// bind "Alt c" { Copy; }
}
normal { }
locked {
bind "Ctrl g" { SwitchToMode "Normal"; }
bind "Ctrl Alt g" { SwitchToMode "Normal"; }
}
resize {
bind "Ctrl n" { SwitchToMode "Normal"; }
bind "Ctrl Alt n" { SwitchToMode "Normal"; }
bind "h" "Left" { Resize "Increase Left"; }
bind "j" "Down" { Resize "Increase Down"; }
bind "k" "Up" { Resize "Increase Up"; }
@@ -21,7 +17,7 @@ keybinds {
bind "-" { Resize "Decrease"; }
}
pane {
bind "Ctrl p" { SwitchToMode "Normal"; }
bind "Ctrl Alt p" { SwitchToMode "Normal"; }
bind "h" "Left" { MoveFocus "Left"; }
bind "l" "Right" { MoveFocus "Right"; }
bind "j" "Down" { MoveFocus "Down"; }
@@ -38,7 +34,7 @@ keybinds {
bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;}
}
move {
bind "Ctrl h" { SwitchToMode "Normal"; }
bind "Ctrl Alt h" { SwitchToMode "Normal"; }
bind "n" "Tab" { MovePane; }
bind "p" { MovePaneBackwards; }
bind "h" "Left" { MovePane "Left"; }
@@ -47,7 +43,7 @@ keybinds {
bind "l" "Right" { MovePane "Right"; }
}
tab {
bind "Ctrl t" { SwitchToMode "Normal"; }
bind "Ctrl Alt t" { SwitchToMode "Normal"; }
bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; }
bind "h" "Left" "Up" "k" { GoToPreviousTab; }
bind "l" "Right" "Down" "j" { GoToNextTab; }
@@ -69,26 +65,24 @@ keybinds {
bind "Tab" { ToggleTab; }
}
scroll {
bind "Ctrl s" { SwitchToMode "Normal"; }
bind "Ctrl Alt s" { SwitchToMode "Normal"; }
bind "e" { EditScrollback; SwitchToMode "Normal"; }
bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; }
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Ctrl Alt f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; }
// uncomment this and adjust key if using copy_on_select=false
// bind "Alt c" { Copy; }
}
search {
bind "Ctrl s" { SwitchToMode "Normal"; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "Ctrl Alt s" { SwitchToMode "Normal"; }
bind "Ctrl Alt c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; }
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
bind "Ctrl Alt f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Ctrl Alt b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; }
bind "n" { Search "down"; }
@@ -98,20 +92,20 @@ keybinds {
bind "o" { SearchToggleOption "WholeWord"; }
}
entersearch {
bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; }
bind "Ctrl Alt c" "Esc" { SwitchToMode "Scroll"; }
bind "Enter" { SwitchToMode "Search"; }
}
renametab {
bind "Ctrl c" { SwitchToMode "Normal"; }
bind "Ctrl Alt c" { SwitchToMode "Normal"; }
bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; }
}
renamepane {
bind "Ctrl c" { SwitchToMode "Normal"; }
bind "Ctrl Alt c" { SwitchToMode "Normal"; }
bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; }
}
session {
bind "Ctrl o" { SwitchToMode "Normal"; }
bind "Ctrl s" { SwitchToMode "Scroll"; }
bind "Ctrl Alt o" { SwitchToMode "Normal"; }
bind "Ctrl Alt s" { SwitchToMode "Scroll"; }
bind "d" { Detach; }
bind "w" {
LaunchOrFocusPlugin "zellij:session-manager" {
@@ -123,7 +117,7 @@ keybinds {
}
tmux {
bind "[" { SwitchToMode "Scroll"; }
bind "Ctrl b" { Write 2; SwitchToMode "Normal"; }
bind "Ctrl Alt b" { Write 2; SwitchToMode "Normal"; }
bind "\"" { NewPane "Down"; SwitchToMode "Normal"; }
bind "%" { NewPane "Right"; SwitchToMode "Normal"; }
bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
@@ -145,41 +139,41 @@ keybinds {
bind "x" { CloseFocus; SwitchToMode "Normal"; }
}
shared_except "locked" {
bind "Ctrl g" { SwitchToMode "Locked"; }
bind "Ctrl q" { Quit; }
bind "Alt n" { NewPane; }
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
bind "Alt j" "Alt Down" { MoveFocus "Down"; }
bind "Alt k" "Alt Up" { MoveFocus "Up"; }
bind "Alt =" "Alt +" { Resize "Increase"; }
bind "Alt -" { Resize "Decrease"; }
bind "Alt [" { PreviousSwapLayout; }
bind "Alt ]" { NextSwapLayout; }
bind "Ctrl Alt g" { SwitchToMode "Locked"; }
bind "Ctrl Alt q" { Quit; }
bind "Ctrl Alt n" { NewPane; }
bind "Ctrl Alt h" "Ctrl Alt Left" { MoveFocusOrTab "Left"; }
bind "Ctrl Alt l" "Ctrl Alt Right" { MoveFocusOrTab "Right"; }
bind "Ctrl Alt j" "Ctrl Alt Down" { MoveFocus "Down"; }
bind "Ctrl Alt k" "Ctrl Alt Up" { MoveFocus "Up"; }
bind "Ctrl Alt =" "Ctrl Alt +" { Resize "Increase"; }
bind "Ctrl Alt -" { Resize "Decrease"; }
bind "Ctrl Alt [" { PreviousSwapLayout; }
bind "Ctrl Alt ]" { NextSwapLayout; }
}
shared_except "normal" "locked" {
bind "Enter" "Esc" { SwitchToMode "Normal"; }
}
shared_except "pane" "locked" {
bind "Ctrl p" { SwitchToMode "Pane"; }
bind "Ctrl Alt p" { SwitchToMode "Pane"; }
}
shared_except "resize" "locked" {
bind "Ctrl n" { SwitchToMode "Resize"; }
bind "Ctrl Alt n" { SwitchToMode "Resize"; }
}
shared_except "scroll" "locked" {
bind "Ctrl s" { SwitchToMode "Scroll"; }
bind "Ctrl Alt s" { SwitchToMode "Scroll"; }
}
shared_except "session" "locked" {
bind "Ctrl o" { SwitchToMode "Session"; }
bind "Ctrl Alt o" { SwitchToMode "Session"; }
}
shared_except "tab" "locked" {
bind "Ctrl t" { SwitchToMode "Tab"; }
bind "Ctrl Alt t" { SwitchToMode "Tab"; }
}
shared_except "move" "locked" {
bind "Ctrl h" { SwitchToMode "Move"; }
bind "Ctrl Alt h" { SwitchToMode "Move"; }
}
shared_except "tmux" "locked" {
bind "Ctrl b" { SwitchToMode "Tmux"; }
bind "Ctrl Alt b" { SwitchToMode "Tmux"; }
}
}
@@ -191,174 +185,5 @@ plugins {
session-manager { path "session-manager"; }
}
// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
// eg. when terminal window with an active zellij session is closed
// Options:
// - detach (Default)
// - quit
//
// on_force_close "quit"
// Send a request for a simplified ui (without arrow fonts) to plugins
// Options:
// - true
// - false (Default)
//
// simplified_ui true
// Choose the path to the default shell that zellij will use for opening new panes
// Default: $SHELL
//
// default_shell "fish"
// Choose the path to override cwd that zellij will use for opening new panes
//
// default_cwd ""
// Toggle between having pane frames around the panes
// Options:
// - true (default)
// - false
//
// pane_frames true
// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible
// Options:
// - true (default)
// - false
//
// auto_layout true
// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected
// Options:
// - true (default)
// - false
//
// session_serialization false
// Whether pane viewports are serialized along with the session, default is false
// Options:
// - true
// - false (default)
// serialize_pane_viewport true
// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0
// defaults to the scrollback size. If this number is higher than the scrollback size, it will
// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true.
//
// scrollback_lines_to_serialize 10000
// Define color themes for Zellij
// For more examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes
// Once these themes are defined, one of them should to be selected in the "theme" section of this file
//
themes {
dracula {
fg 248 248 242
bg 40 42 54
red 255 85 85
green 80 250 123
yellow 241 250 140
blue 98 114 164
magenta 255 121 198
orange 255 184 108
cyan 139 233 253
black 0 0 0
white 255 255 255
}
tokyo-night {
fg 169 177 214
bg 26 27 38
black 56 62 90
red 249 51 87
green 158 206 106
yellow 224 175 104
blue 122 162 247
magenta 187 154 247
cyan 42 195 222
white 192 202 245
orange 255 158 100
}
}
// Choose the theme that is specified in the themes section.
// Default: default
//
theme "tokyo-night"
// The name of the default layout to load on startup
// Default: "default"
//
default_layout "compact"
// Choose the mode that zellij uses when starting up.
// Default: normal
//
// default_mode "locked"
// Toggle enabling the mouse mode.
// On certain configurations, or terminals this could
// potentially interfere with copying text.
// Options:
// - true (default)
// - false
//
// mouse_mode false
// Configure the scroll back buffer size
// This is the number of lines zellij stores for each pane in the scroll back
// buffer. Excess number of lines are discarded in a FIFO fashion.
// Valid values: positive integers
// Default value: 10000
//
// scroll_buffer_size 10000
// Provide a command to execute when copying text. The text will be piped to
// the stdin of the program to perform the copy. This can be used with
// terminal emulators which do not support the OSC 52 ANSI control sequence
// that will be used by default if this option is not set.
// Examples:
//
// copy_command "xclip -selection clipboard" // x11
// copy_command "wl-copy" // wayland
// copy_command "pbcopy" // osx
// Choose the destination for copied text
// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard.
// Does not apply when using copy_command.
// Options:
// - system (default)
// - primary
//
// copy_clipboard "primary"
// Enable or disable automatic copy (and clear) of selection when releasing mouse
// Default: true
//
// copy_on_select false
// Path to the default editor to use to edit pane scrollbuffer
// Default: $EDITOR or $VISUAL
//
// scrollback_editor "/usr/bin/vim"
// When attaching to an existing session with other users,
// should the session be mirrored (true)
// or should each user have their own cursor (false)
// Default: false
//
// mirror_session true
// The folder in which Zellij will look for layouts
//
// layout_dir "/path/to/my/layout_dir"
// The folder in which Zellij will look for themes
//
// theme_dir "/path/to/my/theme_dir"
// Enable or disable the rendering of styled and colored underlines (undercurl).
// May need to be disabled for certain unsupported terminals
// Default: true
//
// styled_underlines false