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

@@ -1,16 +1,16 @@
[user] [user]
name = Cian Hughes name = Cian Hughes
email = chughes000@gmail.com email = chughes000@gmail.com
[init] [init]
defaultBranch = "main" defaultBranch = "main"
[credential] [credential]
helper = manager helper = manager
credentialStore = gpg credentialStore = gpg
[filter "lfs"] [filter "lfs"]
clean = git-lfs clean -- %f clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f smudge = git-lfs smudge -- %f
process = git-lfs filter-process process = git-lfs filter-process
required = true required = true
[core] [core]
pager = delta pager = delta
[diff] [diff]

View File

@@ -2,3 +2,10 @@ mod? nix "~/.config/nix"
default: default:
@just -g --list @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+] discard_event
map ctrl+shift+n discard_event map ctrl+shift+n discard_event
map ctrl+shift+q discard_event map ctrl+shift+q discard_event
# I like the zellij bindings so lets make something similar here # Next, lets bind my usual keys, with ctrl as the modifier key
map alt+n new_window map ctrl+h new_window
map alt+shift+n launch --cwd=current map ctrl+shift+h launch --cwd=current
map ctrl+alt+n new_os_window map ctrl+n new_os_window
map ctrl+alt+shift+n new_os_window_with_cwd map ctrl+shift+n new_os_window_with_cwd
map alt+q close_window map ctrl+q close_window
map alt+l next_window map ctrl+right next_window
map alt+right next_window map ctrl+left previous_window
map alt+h previous_window map ctrl+shift+right move_window_forward
map alt+left previous_window map ctrl+shift+left move_window_backward
map alt+shift+l move_window_forward map ctrl+space start_resizing_window
map alt+shift+right move_window_forward map ctrl+t new_tab
map alt+shift+h move_window_backward map ctrl+shift+t set_tab_title
map alt+shift+left move_window_backward map ctrl+l next_tab
map alt+r start_resizing_window map ctrl+h previous_tab
# Lets fill in the gaps with tab controls that make sense map alt+shift+l move_tab_forward
map alt+t new_tab map alt+shift+h move_tab_backward
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

View File

@@ -33,9 +33,6 @@ export alias bashpoem = poetry run bash
export alias nupoem = poetry run nu export alias nupoem = poetry run nu
export alias jupyterpoem = poetry run jupyter 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? # Who even uses vim or *especially* vi in this day and age?
export alias vim = nvim export alias vim = nvim
export alias vi = 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/mix/mix-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/nano/nano-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/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/poetry/poetry-completions.nu
source ~/.config/nushell/nu_scripts/custom-completions/pre-commit/pre-commit-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 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/atuin.nu
source ~/.config/nushell/completions/zoxide.nu source ~/.config/nushell/completions/zoxide.nu
source ~/.config/nushell/completions/nu_scripts.nu source ~/.config/nushell/completions/nu_scripts.nu
# import nushell libs
use task.nu
# Finally, we run a system info fetch # Finally, we run a system info fetch
sysfetch 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_se = (ansi --escape "0m") # end standout-mode
$env.LESS_TERMCAP_us = (ansi --escape "00;36m") # begin underline $env.LESS_TERMCAP_us = (ansi --escape "00;36m") # begin underline
$env.LESS_TERMCAP_ue = (ansi --escape "0m") # end 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 # Finally, add session path variables
$env.PATH = ( $env.PATH = (

View File

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

View File

@@ -1,62 +1,45 @@
export def create_left_prompt [] -> string { def get_env [s: string]: string -> string {
canonicalize_linefeeds ( try { $env | get --ignore-errors $s } catch { "" }
^starship prompt
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
} }
export def create_right_prompt [] -> string { export def create_left_prompt []: nothing -> string {
canonicalize_linefeeds ( ^starship prompt --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
^starship prompt
--right
--cmd-duration $env.CMD_DURATION_MS
$"--status=($env.LAST_EXIT_CODE)"
--terminal-width (term size).columns
)
} }
export def create_continuation_prompt [] -> string { export def create_right_prompt []: nothing -> string {
canonicalize_linefeeds ( ^starship prompt --right --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
^starship prompt
--continuation
--cmd-duration $env.CMD_DURATION_MS
$"--status=($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 {
let $time_in_ms = $ms | into int; ^starship prompt --continuation --cmd-duration (get_env "CMD_DURATION_MS") --status (get_env "LAST_EXIT_CODE") --terminal-width (term size).columns
if $time_in_ms < 1000 { }
$"($time_in_ms | into string)ms"
} else if $time_in_ms < 1000 * 60 { def parse_ms_to_human_readable [ms: string]: string -> string {
$"(($time_in_ms / 1000) | into string --decimals 2)s" if $ms == "" {
} else if $time_in_ms < 1000 * 60 * 60 { $ms
$"(($time_in_ms / (1000 * 60)) | into string --decimals 2)m"
} else if $time_in_ms < 1000 * 60 * 60 * 24 {
$"(($time_in_ms / (1000 * 60 * 60)) | into string --decimals 2)h"
} else { } else {
$"(($time_in_ms // (1000 * 60 * 60 * 24)) | into string)d/(parse_ms_to_human_readable ($time_in_ms mod (1000 * 60 * 60 * 24)))" let $time_in_ms = $ms | into int;
} | into string if $time_in_ms < 1000 {
} $"($time_in_ms | into string)ms"
} else if $time_in_ms < 1000 * 60 {
export def create_transient_prompt_left [] -> string { $"(($time_in_ms / 1000) | into string --decimals 2)s"
if $env.LAST_EXIT_CODE == 0 { } else if $time_in_ms < 1000 * 60 * 60 {
$"(ansi green_bold)(ansi reset)" $"(($time_in_ms / (1000 * 60)) | into string --decimals 2)m"
} else { } else if $time_in_ms < 1000 * 60 * 60 * 24 {
$"(ansi red_bold)(ansi reset)" $"(($time_in_ms / (1000 * 60 * 60)) | into string --decimals 2)h"
} else {
$"(($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_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 { export def create_transient_prompt_left []: nothing -> string {
if ("OS" in $env) and ($env.OS == "Windows_NT") { if (get_env "LAST_EXIT_CODE") == 0 {
$x | str replace "\n" "\r\n" $"(ansi green_bold)󱔳(ansi reset)"
} else { } 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) not (which $app | is-empty)
} }
export def 'sysfetch' [] { export def 'sysfetch' []: nothing -> nothing {
if (exists fastfetch) { 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" fastfetch --load-config $"($env.HOME)/.config/fastfetch/kitty.jsonc"
} else { } else {
fastfetch 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_dir in $env.NU_PLUGIN_DIRS {
for plugin_path in (ls $"($env.NU_PLUGIN_DIRS.0)/nu_plugin_*").name { for plugin_path in (ls $"($env.NU_PLUGIN_DIRS.0)/nu_plugin_*").name {
nu -c $"register ($plugin_path)" 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 curdir = pwd
let plugin_dir = $env.NU_PLUGIN_DIRS.0 let plugin_dir = $env.NU_PLUGIN_DIRS.0
cd $plugin_dir cd $plugin_dir
@@ -40,7 +40,7 @@ export def 'build-plugins' [] {
register-plugins register-plugins
} }
export def 'install-default-plugins' [] { export def 'install-default-plugins' []: nothing -> nothing {
[ nu_plugin_inc [ nu_plugin_inc
nu_plugin_polars nu_plugin_polars
# nu_plugin_gstat # 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>r", group = "[R]ename" },
{ "<leader>w", group = "[W]orkspace" }, { "<leader>w", group = "[W]orkspace" },
{ "<leader>t", group = "[T]ree" }, { "<leader>t", group = "[T]ree" },
{ "<leader>l", group = "[L]azyGit" },
{ "<leader>o", group = "[O]verseer" }, { "<leader>o", group = "[O]verseer" },
{ "<leader>h", group = "[H]arpoon" }, { "<leader>h", group = "[H]arpoon" },
{ "<leader>x", group = "[X] Trouble" }, { "<leader>x", group = "[X] Trouble" },
@@ -41,7 +42,7 @@ return {
mode = "n", mode = "n",
}, },
{ {
"<C-h>", "<A-a>",
function() function()
require("harpoon"):list():select(1) require("harpoon"):list():select(1)
end, end,
@@ -49,7 +50,7 @@ return {
mode = "n", mode = "n",
}, },
{ {
"<C-j>", "<A-s>",
function() function()
require("harpoon"):list():select(2) require("harpoon"):list():select(2)
end, end,
@@ -57,7 +58,7 @@ return {
mode = "n", mode = "n",
}, },
{ {
"<C-k>", "<A-d>",
function() function()
require("harpoon"):list():select(3) require("harpoon"):list():select(3)
end, end,
@@ -65,7 +66,7 @@ return {
mode = "n", mode = "n",
}, },
{ {
"<C-l>", "<A-f>",
function() function()
require("harpoon"):list():select(4) require("harpoon"):list():select(4)
end, end,
@@ -74,7 +75,30 @@ return {
}, },
}, },
lazygit = { 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 = { neogen = {
{ {

View File

@@ -1,19 +1,19 @@
-- vim.keymap.set("n", "<C-h>", "<C-w>h", { noremap = true, silent = true }) vim.keymap.set("n", "<A-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", "<A-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", "<A-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", "<A-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", "<A-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", "<A-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", "<A-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", "<A-Right>", "<C-w>l", { noremap = true, silent = true })
vim.keymap.set("n", "<C-=>", "<C-w>+", { noremap = true, silent = true }) vim.keymap.set("n", "<A-=>", "<C-w>+", { noremap = true, silent = true })
vim.keymap.set("n", "<C-->", "<C-w>-", { noremap = true, silent = true }) vim.keymap.set("n", "<A-->", "<C-w>-", { noremap = true, silent = true })
vim.keymap.set("n", "<C-.>", "<C-w>>", { noremap = true, silent = true }) vim.keymap.set("n", "<A-.>", "<C-w>>", { noremap = true, silent = true })
vim.keymap.set("n", "<C-,>", "<C-w><", { noremap = true, silent = true }) vim.keymap.set("n", "<A-,>", "<C-w><", { noremap = true, silent = true })
vim.keymap.set("n", "<C-n>", "<C-w>s", { 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 -- 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", "<A-;>", "<C-w>x", { noremap = true, silent = true })
vim.keymap.set("n", "<C-q>", ":q<CR>", { noremap = true, silent = true }) vim.keymap.set("n", "<A-q>", ":q<CR>", { noremap = true, silent = true })
-- Non standard key mappings are here -- Non standard key mappings are here
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, { desc = "[D]iagnostics" }) 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" }) 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 [)] ['] -- - sr)' - [S]urround [R]eplace [)] [']
require("mini.surround").setup() 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 -- Setup of mini.notify
-- local notify = require("mini.notify") local notify = require("mini.notify")
-- notify.setup() notify.setup()
-- vim.notify = notify.make_notify({ vim.notify = notify.make_notify({
-- ERROR = { duration = 5000 }, ERROR = { duration = 5000 },
-- WARN = { duration = 4000 }, WARN = { duration = 4000 },
-- INFO = { duration = 3000 }, INFO = { duration = 3000 },
-- }) })
-- Some other mini.nvim plugins that look useful to me -- Some other mini.nvim plugins that look useful to me
require("mini.clue").setup() 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() require("mini.trailspace").setup()
-- My custom mini.starter config -- My custom mini.starter config
local starter_items = {
-- 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 = {
{ {
name = "Status", action = "Telescope file_browser",
action = "Git status", name = "Tree",
section = "Git", 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", name = "Log",
action = [[lua _Launch_Vim_Cmd("Git log --graph --pretty=oneline --abbrev-commit")]], action = [[lua Snacks.lazygit.log()]],
section = "Git", section = "Git",
}, },
{ {
name = "Lazygit", 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", section = "Git",
}, },
{ {
@@ -96,11 +121,8 @@ return { -- Mini is so varied it's hard to categorise. So i dumped my mini insta
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣷⡀⠀⠀⠀⠀⢹⣿⣆⠀⠀⠀⠀⠀\ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣷⡀⠀⠀⠀⠀⢹⣿⣆⠀⠀⠀⠀⠀\
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⡇⠀⠀⠀⠀⠸⣿⣿⡄⠀⠀⠀⠀\ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⡇⠀⠀⠀⠀⠸⣿⣿⡄⠀⠀⠀⠀\
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⡿⣿⣿⠀⠀⠀⠀\ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⡿⣿⣿⠀⠀⠀⠀\
⠀⠀⠀⠀⠀⠀⠀⠈⠙⠀⠀⠀⠀⠀", ⠀⠀⠀⠀⠀⠀⠀⠈⠙⠀⠀⠀⠀⠀",
items = { items = starter_items,
require("mini.starter").sections.telescope(),
custom_items,
},
footer = "", footer = "",
}) })
end, 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", "harpoon2",
icon = "󰛢", icon = "󰛢",
indicators = { "H", "J", "K", "L" }, indicators = { "A", "S", "D", "F" },
active_indicators = { active_indicators = {
"%#LualineHarpoonActive#H%*", "%#LualineHarpoonActive#A%*",
"%#LualineHarpoonActive#J%*", "%#LualineHarpoonActive#S%*",
"%#LualineHarpoonActive#K%*", "%#LualineHarpoonActive#D%*",
"%#LualineHarpoonActive#L%*", "%#LualineHarpoonActive#F%*",
}, },
_separator = "", _separator = "",
no_harpoon = "Harpoon not loaded", 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 "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 "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 { -- Oil is a very nice buffer-based filetree editor
"stevearc/oil.nvim", "stevearc/oil.nvim",
event = "VeryLazy", event = "VeryLazy",
@@ -167,19 +152,19 @@ return { -- General programming utilities go here
-- No, but seriously. Please read `:help ins-completion`, it is really good! -- No, but seriously. Please read `:help ins-completion`, it is really good!
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
-- Select the [n]ext item -- Select the [n]ext item
["<C-n>"] = cmp.mapping.select_next_item(), ["<M-n>"] = cmp.mapping.select_next_item(),
-- Select the [p]revious 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. -- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it. -- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet. -- 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. -- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display -- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available. -- 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. -- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like: -- 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-,> will move you to the right of each of the expansion locations.
-- <c-.> is similar, except moving you backwards. -- <c-.> is similar, except moving you backwards.
["<C-,>"] = cmp.mapping(function() ["<M-,>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<C-.>"] = cmp.mapping(function() ["<M-.>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then if luasnip.locally_jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
end end

View File

@@ -1,17 +1,23 @@
"$schema" = 'https://starship.rs/config-schema.json'
# Inserts a blank line between shell prompts # Inserts a blank line between shell prompts
add_newline = true add_newline = true
continuation_prompt = "[:::](yellow)" continuation_prompt = "[󰾗━ ](yellow)"
[character] [character]
success_symbol = "[](bold green) " success_symbol = "[󱔳](bold green) "
error_symbol = "[](bold red) " error_symbol = "[󱔷](bold red) "
[cmd_duration] [cmd_duration]
min_time = 2_000 # Show command duration over 2 sec min_time = 0
format = " took [$duration]($style)" show_milliseconds = true
show_notifications = true
min_time_to_notify = 30_000
format = " [󰔛 $duration]($style)"
[hostname] [hostname]
ssh_only = false ssh_only = false
ssh_symbol = " "
format = "[$hostname]($style) " format = "[$hostname]($style) "
style = "bold dimmed blue" style = "bold dimmed blue"
disabled = false disabled = false
@@ -23,4 +29,170 @@ show_always = true
# Disable the package module, hiding it from the prompt completely # Disable the package module, hiding it from the prompt completely
[package] [package]
disabled = true 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,9 +1,491 @@
"$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]] [[manager.prepend_keymap]]
on = [ "c", "m" ] on = ["c", "m"]
run = "plugin chmod" run = "plugin chmod"
desc = "Chmod on selected files" desc = "Chmod on selected files"
[[manager.prepend_keymap]] [[manager.prepend_keymap]]
on = "T" on = "T"
run = "plugin --sync max-preview" run = "plugin --sync max-preview"
desc = "Maximize or restore preview" desc = "Maximize or restore preview"

View File

@@ -1,5 +1,5 @@
[plugin] [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] [flavor]
deps = [] deps = []

View File

@@ -1,47 +1,39 @@
local selected_or_hovered = ya.sync(function() local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {} local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do for _, u in pairs(tab.selected) do
paths[#paths + 1] = tostring(u) paths[#paths + 1] = tostring(u)
end end
if #paths == 0 and tab.current.hovered then if #paths == 0 and tab.current.hovered then
paths[1] = tostring(tab.current.hovered.url) paths[1] = tostring(tab.current.hovered.url)
end end
return paths return paths
end) end)
return { return {
entry = function() entry = function()
ya.manager_emit("escape", { visual = true }) ya.manager_emit("escape", { visual = true })
local urls = selected_or_hovered() local urls = selected_or_hovered()
if #urls == 0 then if #urls == 0 then
return ya.notify({ return ya.notify { title = "Chmod", content = "No file selected", level = "warn", timeout = 5 }
title = "Chmod", end
content = "No file selected",
level = "warn",
timeout = 5,
})
end
local value, event = ya.input({ local value, event = ya.input {
title = "Chmod:", title = "Chmod:",
position = { "top-center", y = 3, w = 40 }, position = { "top-center", y = 3, w = 40 },
}) }
if event ~= 1 then if event ~= 1 then
return return
end end
local status, err = Command("chmod"):arg(value):args(urls):spawn():wait() local status, err = Command("chmod"):arg(value):args(urls):spawn():wait()
if not status or not status.success then if not status or not status.success then
ya.notify({ ya.notify {
title = "Chmod", title = "Chmod",
content = string.format( content = string.format("Chmod on selected files failed, error: %s", status and status.code or err),
"Chmod with selected files failed, exit code %s", level = "error",
status and status.code or err timeout = 5,
), }
level = "error", end
timeout = 5, end,
})
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 function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build local old_build = Tab.build
@@ -14,14 +5,14 @@ local function setup(_, opts)
Tab.build = function(self, ...) Tab.build = function(self, ...)
local bar = function(c, x, y) local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then 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 end
return v4( return ui.Bar(ui.Bar.TOP)
"bar", :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.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 end
local c = self._chunks local c = self._chunks
@@ -33,9 +24,9 @@ local function setup(_, opts)
local style = THEME.manager.border_style local style = THEME.manager.border_style
self._base = ya.list_merge(self._base or {}, { self._base = ya.list_merge(self._base or {}, {
v4("border", self._area, ui.Border.ALL):type(type):style(style), ui.Border(ui.Border.ALL):area(self._area):type(type):style(style),
v4("bar", self._chunks[1], ui.Bar.RIGHT):style(style), ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
v4("bar", self._chunks[3], ui.Bar.LEFT):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].y),
bar("", c[1].right - 1, c[1].bottom - 1), bar("", c[1].right - 1, c[1].bottom - 1),

View File

@@ -1,7 +1,7 @@
# git.yazi # git.yazi
> [!NOTE] > [!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. Show the status of Git file changes as linemode in the file list.
@@ -37,9 +37,6 @@ run = "git"
## Advanced ## 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: You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with:
- `THEME.git.modified` - `THEME.git.modified`

View File

@@ -1,161 +1,171 @@
local WIN = ya.target_family() == "windows" local WIN = ya.target_family() == "windows"
local PATS = { local PATS = {
{ "[MT]", 6 }, -- Modified { "[MT]", 6 }, -- Modified
{ "[AC]", 5 }, -- Added { "[AC]", 5 }, -- Added
{ "?$", 4 }, -- Untracked { "?$", 4 }, -- Untracked
{ "!$", 3 }, -- Ignored { "!$", 3 }, -- Ignored
{ "D", 2 }, -- Deleted { "D", 2 }, -- Deleted
{ "U", 1 }, -- Updated { "U", 1 }, -- Updated
{ "[AD][AD]", 1 }, -- Updated { "[AD][AD]", 1 }, -- Updated
} }
local function match(line) local function match(line)
local signs = line:sub(1, 2) local signs = line:sub(1, 2)
for _, p in ipairs(PATS) do for _, p in ipairs(PATS) do
local path local path
if signs:find(p[1]) then if signs:find(p[1]) then
path = line:sub(4, 4) == '"' and line:sub(5, -2) or line:sub(4) path = line:sub(4, 4) == '"' and line:sub(5, -2) or line:sub(4)
path = WIN and path:gsub("/", "\\") or path path = WIN and path:gsub("/", "\\") or path
end end
if not path then if not path then
elseif path:find("[/\\]$") then elseif path:find("[/\\]$") then
return p[2] == 3 and 30 or p[2], path:sub(1, -2) return p[2] == 3 and 30 or p[2], path:sub(1, -2)
else else
return p[2], path return p[2], path
end end
end end
end end
local function root(cwd) local function root(cwd)
repeat local is_worktree = function(url)
local cha = fs.cha(cwd:join(".git")) local file, head = io.open(tostring(url)), nil
if cha and cha.is_dir then if file then
return tostring(cwd) head = file:read(8)
end file:close()
cwd = cwd:parent() end
until not cwd return head == "gitdir: "
end
repeat
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()
until not cwd
end end
local function bubble_up(changed) local function bubble_up(changed)
local new, empty = {}, Url("") local new, empty = {}, Url("")
for k, v in pairs(changed) do for k, v in pairs(changed) do
if v ~= 3 and v ~= 30 then if v ~= 3 and v ~= 30 then
local url = Url(k):parent() local url = Url(k):parent()
while url and url ~= empty do while url and url ~= empty do
local s = tostring(url) local s = tostring(url)
new[s] = (new[s] or 0) > v and new[s] or v new[s] = (new[s] or 0) > v and new[s] or v
url = url:parent() url = url:parent()
end end
end end
end end
return new return new
end end
local function propagate_down(ignored, cwd, repo) local function propagate_down(ignored, cwd, repo)
local new, rel = {}, cwd:strip_prefix(repo) local new, rel = {}, cwd:strip_prefix(repo)
for k, v in pairs(ignored) do for k, v in pairs(ignored) do
if v == 30 then if v == 30 then
if rel:starts_with(k) then if rel:starts_with(k) then
new[tostring(repo:join(rel))] = 30 new[tostring(repo:join(rel))] = 30
elseif cwd == repo:join(k):parent() then elseif cwd == repo:join(k):parent() then
new[k] = 3 new[k] = 3
end end
end end
end end
return new return new
end end
local add = ya.sync(function(st, cwd, repo, changed) local add = ya.sync(function(st, cwd, repo, changed)
st.dirs[cwd] = repo st.dirs[cwd] = repo
st.repos[repo] = st.repos[repo] or {} st.repos[repo] = st.repos[repo] or {}
for k, v in pairs(changed) do for k, v in pairs(changed) do
if v == 0 then if v == 0 then
st.repos[repo][k] = nil st.repos[repo][k] = nil
elseif v == 30 then elseif v == 30 then
st.dirs[k] = "" st.dirs[k] = ""
else else
st.repos[repo][k] = v st.repos[repo][k] = v
end end
end end
ya.render() ya.render()
end) end)
local remove = ya.sync(function(st, cwd) local remove = ya.sync(function(st, cwd)
local dir = st.dirs[cwd] local dir = st.dirs[cwd]
if not dir then if not dir then
return return
end end
ya.render() ya.render()
st.dirs[cwd] = nil st.dirs[cwd] = nil
if not st.repos[dir] then if not st.repos[dir] then
return return
end end
for _, r in pairs(st.dirs) do for _, r in pairs(st.dirs) do
if r == dir then if r == dir then
return return
end end
end end
st.repos[dir] = nil st.repos[dir] = nil
end) end)
local function setup(st, opts) local function setup(st, opts)
st.dirs = {} st.dirs = {}
st.repos = {} st.repos = {}
opts = opts or {} opts = opts or {}
opts.order = opts.order or 1500 opts.order = opts.order or 1500
-- Chosen by ChatGPT fairly, PRs are welcome to adjust them -- Chosen by ChatGPT fairly, PRs are welcome to adjust them
local t = THEME.git or {} local t = THEME.git or {}
local styles = { local styles = {
[6] = t.modified and ui.Style(t.modified) or ui.Style():fg("#ffa500"), [6] = t.modified and ui.Style(t.modified) or ui.Style():fg("#ffa500"),
[5] = t.added and ui.Style(t.added) or ui.Style():fg("#32cd32"), [5] = t.added and ui.Style(t.added) or ui.Style():fg("#32cd32"),
[4] = t.untracked and ui.Style(t.untracked) or ui.Style():fg("#a9a9a9"), [4] = t.untracked and ui.Style(t.untracked) or ui.Style():fg("#a9a9a9"),
[3] = t.ignored and ui.Style(t.ignored) or ui.Style():fg("#696969"), [3] = t.ignored and ui.Style(t.ignored) or ui.Style():fg("#696969"),
[2] = t.deleted and ui.Style(t.deleted) or ui.Style():fg("#ff4500"), [2] = t.deleted and ui.Style(t.deleted) or ui.Style():fg("#ff4500"),
[1] = t.updated and ui.Style(t.updated) or ui.Style():fg("#1e90ff"), [1] = t.updated and ui.Style(t.updated) or ui.Style():fg("#1e90ff"),
} }
local signs = { local signs = {
[6] = t.modified_sign and t.modified_sign or "", [6] = t.modified_sign and t.modified_sign or "",
[5] = t.added_sign and t.added_sign or "", [5] = t.added_sign and t.added_sign or "",
[4] = t.untracked_sign and t.untracked_sign or "", [4] = t.untracked_sign and t.untracked_sign or "",
[3] = t.ignored_sign and t.ignored_sign or "", [3] = t.ignored_sign and t.ignored_sign or "",
[2] = t.deleted_sign and t.deleted_sign or "", [2] = t.deleted_sign and t.deleted_sign or "",
[1] = t.updated_sign and t.updated_sign or "U", [1] = t.updated_sign and t.updated_sign or "U",
} }
Linemode:children_add(function(self) Linemode:children_add(function(self)
local url = self._file.url local url = self._file.url
local dir = st.dirs[tostring(url:parent())] local dir = st.dirs[tostring(url:parent())]
local change local change
if dir then if dir then
change = dir == "" and 3 or st.repos[dir][tostring(url):sub(#dir + 2)] change = dir == "" and 3 or st.repos[dir][tostring(url):sub(#dir + 2)]
end end
if not change or signs[change] == "" then if not change or signs[change] == "" then
return ui.Line("") return ui.Line("")
elseif self._file:is_hovered() then 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 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
end, opts.order) end, opts.order)
end end
local function fetch(self) local function fetch(_, job)
local cwd = self.files[1].url:parent() local cwd = job.files[1].url:parent()
local repo = root(cwd) local repo = root(cwd)
if not repo then if not repo then
remove(tostring(cwd)) remove(tostring(cwd))
return 1 return 1
end end
local paths = {} local paths = {}
for _, f in ipairs(self.files) do for _, f in ipairs(job.files) do
paths[#paths + 1] = tostring(f.url) paths[#paths + 1] = tostring(f.url)
end end
-- stylua: ignore -- stylua: ignore
local output, err = Command("git") local output, err = Command("git")
@@ -164,35 +174,35 @@ local function fetch(self)
:args(paths) :args(paths)
:stdout(Command.PIPED) :stdout(Command.PIPED)
:output() :output()
if not output then if not output then
ya.err("Cannot spawn git command, error code " .. tostring(err)) ya.err("Cannot spawn git command, error: " .. err)
return 0 return 0
end end
local changed, ignored = {}, {} local changed, ignored = {}, {}
for line in output.stdout:gmatch("[^\r\n]+") do for line in output.stdout:gmatch("[^\r\n]+") do
local sign, path = match(line) local sign, path = match(line)
if sign == 30 then if sign == 30 then
ignored[path] = sign ignored[path] = sign
else else
changed[path] = sign changed[path] = sign
end end
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, bubble_up(changed))
ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo))) ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo)))
else else
ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo))) ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo)))
end end
for _, p in ipairs(paths) do for _, p in ipairs(paths) do
local s = p:sub(#repo + 2) local s = p:sub(#repo + 2)
changed[s] = changed[s] or 0 changed[s] = changed[s] or 0
end end
add(tostring(cwd), repo, changed) add(tostring(cwd), repo, changed)
return 3 return 3
end end
return { setup = setup, fetch = fetch } return { setup = setup, fetch = fetch }

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

View File

@@ -1,67 +1,57 @@
local M = {} local M = {}
function M:peek() function M:peek(job)
local child local child
local l = self.file.cha.len local l = self.file.cha.len
if l == 0 then if l == 0 then
child = Command("hexyl") child = Command("hexyl")
:args({ :args({
tostring(self.file.url), tostring(job.file.url),
}) })
:stdout(Command.PIPED) :stdout(Command.PIPED)
:stderr(Command.PIPED) :stderr(Command.PIPED)
:spawn() :spawn()
else else
child = Command("hexyl") child = Command("hexyl")
:args({ :args({
"--border", "--border",
"none", "none",
"--terminal-width", "--terminal-width",
tostring(self.area.w), tostring(job.area.w),
tostring(self.file.url), tostring(job.file.url),
}) })
:stdout(Command.PIPED) :stdout(Command.PIPED)
:stderr(Command.PIPED) :stderr(Command.PIPED)
:spawn() :spawn()
end end
local limit = self.area.h local limit = job.area.h
local i, lines = 0, "" local i, lines = 0, ""
repeat repeat
local next, event = child:read_line() local next, event = child:read_line()
if event == 1 then if event == 1 then
ya.err(tostring(event)) ya.err(tostring(event))
elseif event ~= 0 then elseif event ~= 0 then
break break
end end
i = i + 1 i = i + 1
if i > self.skip then if i > job.skip then
lines = lines .. next lines = lines .. next
end end
until i >= self.skip + limit until i >= job.skip + limit
child:start_kill() child:start_kill()
if self.skip > 0 and i < self.skip + limit then if job.skip > 0 and i < job.skip + limit then
ya.manager_emit( ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true })
"peek", else
{ math.max(0, i - limit), only_if = self.file.url, upper_bound = true } lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
) ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
else end
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(self, { ui.Text.parse(lines):area(self.area) })
end
end end
function M:seek(units) function M:seek(units)
local h = cx.active.current.hovered require("code").seek(job, units)
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
end end
return M return M

View File

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

View File

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

View File

@@ -17,7 +17,7 @@ Add this to your `~/.config/yazi/yazi.toml`:
```toml ```toml
[[plugin.prepend_fetchers]] [[plugin.prepend_fetchers]]
id = "mime" id = "mime"
if = "!mime" if = "!(mime|dummy)"
name = "*" name = "*"
run = "mime-ext" run = "mime-ext"
prio = "high" prio = "high"
@@ -31,13 +31,13 @@ You can also customize it in your `~/.config/yazi/init.lua` with:
require("mime-ext"):setup { require("mime-ext"):setup {
-- Expand the existing filename database (lowercase), for example: -- Expand the existing filename database (lowercase), for example:
with_files = { with_files = {
makefile = "text/x-makefile", makefile = "text/makefile",
-- ... -- ...
}, },
-- Expand the existing extension database (lowercase), for example: -- Expand the existing extension database (lowercase), for example:
with_exts = { with_exts = {
mk = "text/x-makefile", mk = "text/makefile",
-- ... -- ...
}, },
@@ -50,7 +50,6 @@ require("mime-ext"):setup {
## TODO ## TODO
- Add more file types (PRs welcome!). - 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. - Compress mime-type tables.
## License ## 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 ```lua
local old_build = Tab.build local old_build = Tab.build
Tab.build = function(self, ...) Tab.build = function(self, ...)
local bar = function(c, x, y) local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then 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 end
return ui.Bar( return ui.Bar(ui.Bar.TOP)
ui.Rect({ :area(ui.Rect({
x = x, x = x,
y = math.max(0, y), y = math.max(0, y),
w = ya.clamp(0, self._area.w - x, 1), w = ya.clamp(0, self._area.w - x, 1),
h = math.min(1, self._area.h), h = math.min(1, self._area.h),
}), }))
ui.Bar.TOP :symbol(c)
):symbol(c)
end end
local c = self._chunks local c = self._chunks
@@ -76,15 +76,14 @@ Tab.build = function(self, ...)
local style = THEME.manager.border_style local style = THEME.manager.border_style
self._base = ya.list_merge(self._base or {}, { self._base = ya.list_merge(self._base or {}, {
-- Enable for full border ui.Border(ui.Border.ALL):area(self._area):type(ui.Border.ROUNDED):style(style),
--[[ ui.Border(self._area, ui.Border.ALL):type(ui.Border.ROUNDED):style(style), ]] ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
ui.Bar(self._chunks[1], ui.Bar.RIGHT):style(style), ui.Bar(ui.Bar.LEFT):area(self._chunks[1]):style(style),
ui.Bar(self._chunks[3], ui.Bar.LEFT):style(style),
bar("", c[1].right - 1, c[1].y), bar("", c[1].right - 1, c[1].y),
bar("", c[1].right - 1, c[1].bottom - 1), bar("", c[1].right - 1, c[1].bottom - 1),
bar("", c[2].right, c[2].y), 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, ...) old_build(self, ...)

View File

@@ -61,7 +61,12 @@ return {
ps.sub("tab", callback) ps.sub("tab", callback)
end, 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", "") local command = Command("starship"):arg("prompt"):cwd(args[1]):env("STARSHIP_SHELL", "")
-- Point to custom starship config -- 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 { keybinds {
normal { normal { }
// uncomment this and adjust key if using copy_on_select=false
// bind "Alt c" { Copy; }
}
locked { locked {
bind "Ctrl g" { SwitchToMode "Normal"; } bind "Ctrl Alt g" { SwitchToMode "Normal"; }
} }
resize { resize {
bind "Ctrl n" { SwitchToMode "Normal"; } bind "Ctrl Alt n" { SwitchToMode "Normal"; }
bind "h" "Left" { Resize "Increase Left"; } bind "h" "Left" { Resize "Increase Left"; }
bind "j" "Down" { Resize "Increase Down"; } bind "j" "Down" { Resize "Increase Down"; }
bind "k" "Up" { Resize "Increase Up"; } bind "k" "Up" { Resize "Increase Up"; }
@@ -21,7 +17,7 @@ keybinds {
bind "-" { Resize "Decrease"; } bind "-" { Resize "Decrease"; }
} }
pane { pane {
bind "Ctrl p" { SwitchToMode "Normal"; } bind "Ctrl Alt p" { SwitchToMode "Normal"; }
bind "h" "Left" { MoveFocus "Left"; } bind "h" "Left" { MoveFocus "Left"; }
bind "l" "Right" { MoveFocus "Right"; } bind "l" "Right" { MoveFocus "Right"; }
bind "j" "Down" { MoveFocus "Down"; } bind "j" "Down" { MoveFocus "Down"; }
@@ -38,7 +34,7 @@ keybinds {
bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;} bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;}
} }
move { move {
bind "Ctrl h" { SwitchToMode "Normal"; } bind "Ctrl Alt h" { SwitchToMode "Normal"; }
bind "n" "Tab" { MovePane; } bind "n" "Tab" { MovePane; }
bind "p" { MovePaneBackwards; } bind "p" { MovePaneBackwards; }
bind "h" "Left" { MovePane "Left"; } bind "h" "Left" { MovePane "Left"; }
@@ -47,7 +43,7 @@ keybinds {
bind "l" "Right" { MovePane "Right"; } bind "l" "Right" { MovePane "Right"; }
} }
tab { tab {
bind "Ctrl t" { SwitchToMode "Normal"; } bind "Ctrl Alt t" { SwitchToMode "Normal"; }
bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; } bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; }
bind "h" "Left" "Up" "k" { GoToPreviousTab; } bind "h" "Left" "Up" "k" { GoToPreviousTab; }
bind "l" "Right" "Down" "j" { GoToNextTab; } bind "l" "Right" "Down" "j" { GoToNextTab; }
@@ -69,26 +65,24 @@ keybinds {
bind "Tab" { ToggleTab; } bind "Tab" { ToggleTab; }
} }
scroll { scroll {
bind "Ctrl s" { SwitchToMode "Normal"; } bind "Ctrl Alt s" { SwitchToMode "Normal"; }
bind "e" { EditScrollback; SwitchToMode "Normal"; } bind "e" { EditScrollback; SwitchToMode "Normal"; }
bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; } bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "j" "Down" { ScrollDown; } bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; } 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 "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; } bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; } bind "u" { HalfPageScrollUp; }
// uncomment this and adjust key if using copy_on_select=false
// bind "Alt c" { Copy; }
} }
search { search {
bind "Ctrl s" { SwitchToMode "Normal"; } bind "Ctrl Alt s" { SwitchToMode "Normal"; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; } bind "Ctrl Alt c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "j" "Down" { ScrollDown; } bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; } 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 "Ctrl Alt b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; } bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; } bind "u" { HalfPageScrollUp; }
bind "n" { Search "down"; } bind "n" { Search "down"; }
@@ -98,20 +92,20 @@ keybinds {
bind "o" { SearchToggleOption "WholeWord"; } bind "o" { SearchToggleOption "WholeWord"; }
} }
entersearch { entersearch {
bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; } bind "Ctrl Alt c" "Esc" { SwitchToMode "Scroll"; }
bind "Enter" { SwitchToMode "Search"; } bind "Enter" { SwitchToMode "Search"; }
} }
renametab { renametab {
bind "Ctrl c" { SwitchToMode "Normal"; } bind "Ctrl Alt c" { SwitchToMode "Normal"; }
bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; } bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; }
} }
renamepane { renamepane {
bind "Ctrl c" { SwitchToMode "Normal"; } bind "Ctrl Alt c" { SwitchToMode "Normal"; }
bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; } bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; }
} }
session { session {
bind "Ctrl o" { SwitchToMode "Normal"; } bind "Ctrl Alt o" { SwitchToMode "Normal"; }
bind "Ctrl s" { SwitchToMode "Scroll"; } bind "Ctrl Alt s" { SwitchToMode "Scroll"; }
bind "d" { Detach; } bind "d" { Detach; }
bind "w" { bind "w" {
LaunchOrFocusPlugin "zellij:session-manager" { LaunchOrFocusPlugin "zellij:session-manager" {
@@ -123,7 +117,7 @@ keybinds {
} }
tmux { tmux {
bind "[" { SwitchToMode "Scroll"; } 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 "Down"; SwitchToMode "Normal"; }
bind "%" { NewPane "Right"; SwitchToMode "Normal"; } bind "%" { NewPane "Right"; SwitchToMode "Normal"; }
bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; } bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
@@ -145,41 +139,41 @@ keybinds {
bind "x" { CloseFocus; SwitchToMode "Normal"; } bind "x" { CloseFocus; SwitchToMode "Normal"; }
} }
shared_except "locked" { shared_except "locked" {
bind "Ctrl g" { SwitchToMode "Locked"; } bind "Ctrl Alt g" { SwitchToMode "Locked"; }
bind "Ctrl q" { Quit; } bind "Ctrl Alt q" { Quit; }
bind "Alt n" { NewPane; } bind "Ctrl Alt n" { NewPane; }
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; } bind "Ctrl Alt h" "Ctrl Alt Left" { MoveFocusOrTab "Left"; }
bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; } bind "Ctrl Alt l" "Ctrl Alt Right" { MoveFocusOrTab "Right"; }
bind "Alt j" "Alt Down" { MoveFocus "Down"; } bind "Ctrl Alt j" "Ctrl Alt Down" { MoveFocus "Down"; }
bind "Alt k" "Alt Up" { MoveFocus "Up"; } bind "Ctrl Alt k" "Ctrl Alt Up" { MoveFocus "Up"; }
bind "Alt =" "Alt +" { Resize "Increase"; } bind "Ctrl Alt =" "Ctrl Alt +" { Resize "Increase"; }
bind "Alt -" { Resize "Decrease"; } bind "Ctrl Alt -" { Resize "Decrease"; }
bind "Alt [" { PreviousSwapLayout; } bind "Ctrl Alt [" { PreviousSwapLayout; }
bind "Alt ]" { NextSwapLayout; } bind "Ctrl Alt ]" { NextSwapLayout; }
} }
shared_except "normal" "locked" { shared_except "normal" "locked" {
bind "Enter" "Esc" { SwitchToMode "Normal"; } bind "Enter" "Esc" { SwitchToMode "Normal"; }
} }
shared_except "pane" "locked" { shared_except "pane" "locked" {
bind "Ctrl p" { SwitchToMode "Pane"; } bind "Ctrl Alt p" { SwitchToMode "Pane"; }
} }
shared_except "resize" "locked" { shared_except "resize" "locked" {
bind "Ctrl n" { SwitchToMode "Resize"; } bind "Ctrl Alt n" { SwitchToMode "Resize"; }
} }
shared_except "scroll" "locked" { shared_except "scroll" "locked" {
bind "Ctrl s" { SwitchToMode "Scroll"; } bind "Ctrl Alt s" { SwitchToMode "Scroll"; }
} }
shared_except "session" "locked" { shared_except "session" "locked" {
bind "Ctrl o" { SwitchToMode "Session"; } bind "Ctrl Alt o" { SwitchToMode "Session"; }
} }
shared_except "tab" "locked" { shared_except "tab" "locked" {
bind "Ctrl t" { SwitchToMode "Tab"; } bind "Ctrl Alt t" { SwitchToMode "Tab"; }
} }
shared_except "move" "locked" { shared_except "move" "locked" {
bind "Ctrl h" { SwitchToMode "Move"; } bind "Ctrl Alt h" { SwitchToMode "Move"; }
} }
shared_except "tmux" "locked" { 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"; } 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" theme "tokyo-night"
// The name of the default layout to load on startup
// Default: "default"
//
default_layout "compact" 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