diff options
Diffstat (limited to '.config')
27 files changed, 1486 insertions, 476 deletions
diff --git a/.config/.gitignore-template b/.config/.gitignore-template index 6a6b95c..815c548 100644 --- a/.config/.gitignore-template +++ b/.config/.gitignore-template @@ -23,4 +23,4 @@ uv.lock # Jupyter ./.ipynb_checkpoints/ - +**/build/ diff --git a/.config/aerospace/aerospace.toml b/.config/aerospace/aerospace.toml index 1e6ad54..a55f3af 100644 --- a/.config/aerospace/aerospace.toml +++ b/.config/aerospace/aerospace.toml @@ -67,6 +67,13 @@ alt-shift-1 = 'move-node-to-workspace 1' alt-shift-2 = 'move-node-to-workspace 2' alt-shift-3 = 'move-node-to-workspace 3' +alt-f = "fullscreen" + + +[[on-window-detected]] +if.app-id = 'com.apple.Preview' +run = ['layout floating','move-node-to-workspace 3'] +check-further-callbacks = false [[on-window-detected]] if.app-id = 'com.mitchellh.ghostty' diff --git a/.config/btop/btop.conf b/.config/btop/btop.conf index 21392cb..eccfefe 100644 --- a/.config/btop/btop.conf +++ b/.config/btop/btop.conf @@ -1,4 +1,4 @@ -#? Config file for btop v. 1.4.4 +#? Config file for btop v. 1.4.5 #* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes. #* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes" @@ -54,7 +54,7 @@ update_ms = 2000 #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct", #* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly. -proc_sorting = "pid" +proc_sorting = "user" #* Reverse sorting order, True or False. proc_reversed = False @@ -109,6 +109,9 @@ cpu_bottom = False #* Shows the system uptime in the CPU box. show_uptime = True +#* Shows the CPU package current power consumption in watts. Requires running `make setcap` or `make setuid` or running with sudo. +show_cpu_watts = True + #* Show cpu temperature. check_temp = True diff --git a/.config/fish/conf.d/fish_frozen_key_bindings.fish b/.config/fish/conf.d/fish_frozen_key_bindings.fish new file mode 100644 index 0000000..495aee9 --- /dev/null +++ b/.config/fish/conf.d/fish_frozen_key_bindings.fish @@ -0,0 +1,14 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# the 'fish_key_bindings' variable from its old default scope (universal) +# to its new default scope (global). We recommend you delete this file +# and configure key bindings in ~/.config/fish/config.fish if needed. + +# set --global fish_key_bindings fish_default_key_bindings + +# Prior to version 4.3, fish shipped an event handler that runs +# `set --universal fish_key_bindings fish_default_key_bindings` +# whenever the fish_key_bindings variable is erased. +# This means that as long as any fish < 4.3 is still running on this system, +# we cannot complete the migration. +# As a workaround, erase the universal variable at every shell startup. +set --erase --universal fish_key_bindings diff --git a/.config/fish/conf.d/fish_frozen_theme.fish b/.config/fish/conf.d/fish_frozen_theme.fish new file mode 100644 index 0000000..64255bf --- /dev/null +++ b/.config/fish/conf.d/fish_frozen_theme.fish @@ -0,0 +1,48 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# theme variables from universal to global scope. +# Don't edit this file, as it will be written by the web-config tool (`fish_config`). +# To customize your theme, delete this file and see +# help interactive#syntax-highlighting +# or +# man fish-interactive | less +/^SYNTAX.HIGHLIGHTING +# for appropriate commands to add to ~/.config/fish/config.fish instead. +# See also the release notes for fish 4.3.0 (run `help relnotes`). + +set --global fish_color_autosuggestion 4c566a +set --global fish_color_cancel --reverse +set --global fish_color_command 88c0d0 +set --global fish_color_comment 4c566a --italics +set --global fish_color_cwd 5e81ac +set --global fish_color_cwd_root bf616a +set --global fish_color_end 81a1c1 +set --global fish_color_error bf616a +set --global fish_color_escape ebcb8b +set --global fish_color_history_current e5e9f0 --bold +set --global fish_color_host a3be8c +set --global fish_color_host_remote ebcb8b +set --global fish_color_keyword 81a1c1 +set --global fish_color_match --background=brblue +set --global fish_color_normal normal +set --global fish_color_operator 81a1c1 +set --global fish_color_option 8fbcbb +set --global fish_color_param d8dee9 +set --global fish_color_quote a3be8c +set --global fish_color_redirection b48ead --bold +set --global fish_color_search_match --bold --background=434c5e +set --global fish_color_selection d8dee9 --bold --background=434c5e +set --global fish_color_status bf616a +set --global fish_color_user a3be8c +set --global fish_color_valid_path --underline +set --global fish_pager_color_background +set --global fish_pager_color_completion e5e9f0 +set --global fish_pager_color_description ebcb8b --italics +set --global fish_pager_color_prefix normal --bold --underline +set --global fish_pager_color_progress 3b4252 --background=d08770 +set --global fish_pager_color_secondary_background +set --global fish_pager_color_secondary_completion +set --global fish_pager_color_secondary_description +set --global fish_pager_color_secondary_prefix +set --global fish_pager_color_selected_background --background=434c5e +set --global fish_pager_color_selected_completion +set --global fish_pager_color_selected_description +set --global fish_pager_color_selected_prefix diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 9c5de4a..357db65 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -4,6 +4,25 @@ end function fish_greeting; end +function spf + set os $(uname -s) + + if test "$os" = "Linux" + set spf_last_dir "$HOME/.local/state/superfile/lastdir" + end + + if test "$os" = "Darwin" + set spf_last_dir "$HOME/Library/Application Support/superfile/lastdir" + end + + command spf $argv + + if test -f "$spf_last_dir" + source "$spf_last_dir" + rm -f -- "$spf_last_dir" >> /dev/null + end +end + function f set tmp (mktemp -t "yazi-cwd.XXXXXX") yazi $argv --cwd-file="$tmp" @@ -48,12 +67,16 @@ alias cc="clear & cd" alias l="eza --color=always --long --git --no-filesize --icons=always --no-time --no-user --no-permissions --group-directories-first" alias ll="eza --color=always --long --git --icons=always --no-user --group-directories-first" alias la="eza -a --color=always --long --git --no-filesize --icons=always --no-time --no-user --no-permissions --group-directories-first" -alias ff="fastfetch" +alias fa="fastfetch" +alias ff="yazi" alias p=pgcli alias t="tmux attach" -alias d="deactivate" +# alias d="deactivate" +alias d="zi" alias venv="python3 -m venv venv" alias cd="z" +# alias timewr="rm -rf ~/.local/share/timewarrior/data/" +alias s="ssh pi@tom.tinysun.net" alias gi="git init && aig" alias gs="git status" alias aig="cp ~/.config/.gitignore-template ./.gitignore" @@ -79,3 +102,20 @@ export EDITOR="nvim" fish_add_path "/Users/tomiko/.local/bin" starship init fish | source +alias conda="/opt/homebrew/anaconda3/bin/conda" + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +# if test -f /opt/homebrew/anaconda3/bin/conda +# eval /opt/homebrew/anaconda3/bin/conda "shell.fish" "hook" $argv | source +# else +# if test -f "/opt/homebrew/anaconda3/etc/fish/conf.d/conda.fish" +# . "/opt/homebrew/anaconda3/etc/fish/conf.d/conda.fish" +# else +# set -x PATH "/opt/homebrew/anaconda3/bin" $PATH +# end +# end +# <<< conda initialize <<< + +set -Ux CARAPACE_BRIDGES 'zsh,fish,bash,inshellisense' # optional +carapace _carapace | source diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index eb2b27e..b59d7d6 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -1,43 +1,7 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 -SETUVAR __fish_initialized:3800 -SETUVAR fish_color_autosuggestion:4c566a -SETUVAR fish_color_cancel:\x2d\x2dreverse -SETUVAR fish_color_command:88c0d0 -SETUVAR fish_color_comment:4c566a\x1e\x2d\x2ditalics -SETUVAR fish_color_cwd:5e81ac -SETUVAR fish_color_cwd_root:bf616a -SETUVAR fish_color_end:81a1c1 -SETUVAR fish_color_error:bf616a -SETUVAR fish_color_escape:ebcb8b -SETUVAR fish_color_history_current:e5e9f0\x1e\x2d\x2dbold -SETUVAR fish_color_host:a3be8c -SETUVAR fish_color_host_remote:ebcb8b -SETUVAR fish_color_keyword:81a1c1 -SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue -SETUVAR fish_color_normal:normal -SETUVAR fish_color_operator:81a1c1 -SETUVAR fish_color_option:8fbcbb -SETUVAR fish_color_param:d8dee9 -SETUVAR fish_color_quote:a3be8c -SETUVAR fish_color_redirection:b48ead\x1e\x2d\x2dbold -SETUVAR fish_color_search_match:\x2d\x2dbold\x1e\x2d\x2dbackground\x3d434c5e -SETUVAR fish_color_selection:d8dee9\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3d434c5e -SETUVAR fish_color_status:bf616a -SETUVAR fish_color_user:a3be8c -SETUVAR fish_color_valid_path:\x2d\x2dunderline -SETUVAR fish_key_bindings:fish_default_key_bindings -SETUVAR fish_pager_color_background:\x1d -SETUVAR fish_pager_color_completion:e5e9f0 -SETUVAR fish_pager_color_description:ebcb8b\x1e\x2d\x2ditalics -SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline -SETUVAR fish_pager_color_progress:3b4252\x1e\x2d\x2dbackground\x3dd08770 -SETUVAR fish_pager_color_secondary_background:\x1d -SETUVAR fish_pager_color_secondary_completion:\x1d -SETUVAR fish_pager_color_secondary_description:\x1d -SETUVAR fish_pager_color_secondary_prefix:\x1d -SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3d434c5e -SETUVAR fish_pager_color_selected_completion:\x1d -SETUVAR fish_pager_color_selected_description:\x1d -SETUVAR fish_pager_color_selected_prefix:\x1d -SETUVAR fish_user_paths:/Users/tomiko/\x2elocal/bin +SETUVAR --export CARAPACE_BRIDGES:zsh\x2cfish\x2cbash\x2cinshellisense +SETUVAR --export JAVA_HOME:/opt/homebrew/opt/openjdk\x4017/libexec/openjdk\x2ejdk/Contents/Home +SETUVAR --export --path PATH:/opt/homebrew/opt/openjdk\x4017/libexec/openjdk\x2ejdk/Contents/Home/bin\x1e/opt/homebrew/bin\x1e/opt/homebrew/sbin\x1e/Users/tomiko/\x2ecargo/bin\x1e/Users/tomiko/\x2elocal/bin\x1e/Applications/Ghostty\x2eapp/Contents/MacOS\x1e/usr/local/bin\x1e/System/Cryptexes/App/usr/bin\x1e/usr/bin\x1e/bin\x1e/usr/sbin\x1e/sbin\x1e/var/run/com\x2eapple\x2esecurity\x2ecryptexd/codex\x2esystem/bootstrap/usr/local/bin\x1e/var/run/com\x2eapple\x2esecurity\x2ecryptexd/codex\x2esystem/bootstrap/usr/bin\x1e/var/run/com\x2eapple\x2esecurity\x2ecryptexd/codex\x2esystem/bootstrap/usr/appleinternal/bin\x1e/Library/Apple/usr/bin\x1e/Applications/VMware\x20Fusion\x2eapp/Contents/Public\x1e/usr/local/share/dotnet\x1e\x7e/\x2edotnet/tools\x1e/Library/TeX/texbin\x1e/Applications/Wireshark\x2eapp/Contents/MacOS\x1e/Users/tom/\x2elocal/bin +SETUVAR __fish_initialized:4300 +SETUVAR fish_user_paths:/Users/tomiko/\x2elocal/bin\x1e/Applications/Ghostty\x2eapp/Contents/MacOS diff --git a/.config/ghostty/config b/.config/ghostty/config index 488a14b..d998684 100644 --- a/.config/ghostty/config +++ b/.config/ghostty/config @@ -1,6 +1,6 @@ macos-window-shadow = false theme = nord -font-size = 22 +font-size = 16 #font-family = "Maple Mono" font-family = "IosevkaTerm Nerd Font" keybind = global:alt+c=toggle_quick_terminal @@ -12,8 +12,13 @@ confirm-close-surface = false macos-titlebar-style = hidden quick-terminal-animation-duration = 0 background = #000000 -background-blur = 15 -background-opacity = 0.8 +#background-blur = 15 +#background-opacity = 0.8 +background-image="/Users/tomiko/dotfiles/.config/ghostty/ign-0008.png" +background-image-fit="cover" +background-image-opacity=0.3 + keybind = super+k=text:\x13\x4b keybind = super+l=text:\x13\x4c +#keybind = ctrl+a=text:\x67\x0a diff --git a/.config/ghostty/ign-0008.png b/.config/ghostty/ign-0008.png Binary files differnew file mode 100644 index 0000000..cb9ee96 --- /dev/null +++ b/.config/ghostty/ign-0008.png diff --git a/.config/karabiner/karabiner.json b/.config/karabiner/karabiner.json index a67e6b5..20d87d2 100644 --- a/.config/karabiner/karabiner.json +++ b/.config/karabiner/karabiner.json @@ -5,6 +5,151 @@ "complex_modifications": { "rules": [ { + "description": "Disable cmd + tab", + "enabled": false, + "manipulators": [ + { + "from": { + "key_code": "tab", + "modifiers": { "mandatory": ["left_command"] } + }, + "to": [], + "type": "basic" + } + ] + }, + { + "description": "c1", + "manipulators": [ + { + "from": { + "key_code": "a", + "modifiers": { "mandatory": ["left_option", "left_control", "left_command", "left_shift"] } + }, + "to": [{ "key_code": "left_control" }], + "to_if_alone": [ + { + "key_code": "a", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+2 -> Ctrl+S then 2", + "manipulators": [ + { + "from": { + "key_code": "2", + "modifiers": { "mandatory": ["left_option", "left_control", "left_command", "left_shift"] } + }, + "to": [ + { + "key_code": "s", + "modifiers": ["left_control"] + }, + { "key_code": "2" } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+3 -> Ctrl+S then 3", + "manipulators": [ + { + "from": { + "key_code": "3", + "modifiers": { "mandatory": ["left_option", "left_control", "left_command", "left_shift"] } + }, + "to": [ + { + "key_code": "s", + "modifiers": ["left_control"] + }, + { "key_code": "3" } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+4 -> Ctrl+S then 4", + "manipulators": [ + { + "from": { + "key_code": "4", + "modifiers": { "mandatory": ["left_option", "left_control", "left_command", "left_shift"] } + }, + "to": [ + { + "key_code": "s", + "modifiers": ["left_control"] + }, + { "key_code": "4" } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+1 -> Ctrl+S then 1", + "manipulators": [ + { + "from": { + "key_code": "1", + "modifiers": { "mandatory": ["left_option", "left_control", "left_command", "left_shift"] } + }, + "to": [ + { + "key_code": "s", + "modifiers": ["left_control"] + }, + { "key_code": "1" } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+q -> left_option+q", + "manipulators": [ + { + "from": { + "key_code": "q", + "modifiers": { "mandatory": ["left_option", "left_control", "left_shift", "left_command"] } + }, + "to": [ + { + "key_code": "q", + "modifiers": ["left_option"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+a -> left_control+a", + "manipulators": [ + { + "from": { + "key_code": "a", + "modifiers": { "mandatory": ["left_option", "left_control", "left_shift", "left_command"] } + }, + "to": [ + { + "key_code": "a", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { "description": "Disable Control + Left Click", "manipulators": [ { @@ -40,11 +185,11 @@ ] }, { - "description": "Hyper+q -> left_control+s", + "description": "Hyper+s -> left_control+s", "manipulators": [ { "from": { - "key_code": "q", + "key_code": "s", "modifiers": { "mandatory": ["left_option", "left_control", "left_shift", "left_command"] } }, "to": [ @@ -56,6 +201,330 @@ "type": "basic" } ] + }, + { + "description": "Hyper+h -> left_arrow", + "manipulators": [ + { + "from": { + "key_code": "h", + "modifiers": { "mandatory": ["left_shift", "left_control", "left_option", "left_command"] } + }, + "to": [ + { + "key_code": "left_arrow", + "modifiers": [] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+j -> down_arrow", + "manipulators": [ + { + "from": { + "key_code": "j", + "modifiers": { "mandatory": ["left_shift", "left_control", "left_option", "left_command"] } + }, + "to": [ + { + "key_code": "down_arrow", + "modifiers": [] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+k -> up_arrow", + "manipulators": [ + { + "from": { + "key_code": "k", + "modifiers": { "mandatory": ["left_shift", "left_control", "left_option", "left_command"] } + }, + "to": [ + { + "key_code": "up_arrow", + "modifiers": [] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+l -> right_arrow", + "manipulators": [ + { + "from": { + "key_code": "l", + "modifiers": { "mandatory": ["left_shift", "left_control", "left_option", "left_command"] } + }, + "to": [ + { + "key_code": "right_arrow", + "modifiers": [] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+u -> left_control+d", + "manipulators": [ + { + "from": { + "key_code": "u", + "modifiers": { "mandatory": ["left_shift", "left_control", "left_option", "left_command"] } + }, + "to": [ + { + "key_code": "d", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+i -> left_control+u", + "manipulators": [ + { + "from": { + "key_code": "i", + "modifiers": { "mandatory": ["left_shift", "left_control", "left_option", "left_command"] } + }, + "to": [ + { + "key_code": "u", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+o -> return_or_enter", + "manipulators": [ + { + "from": { + "key_code": "o", + "modifiers": { "mandatory": ["left_control", "left_shift", "left_command", "left_option"] } + }, + "to": [ + { + "key_code": "return_or_enter", + "modifiers": [] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+p -> delete_or_backspace", + "manipulators": [ + { + "from": { + "key_code": "p", + "modifiers": { "mandatory": ["left_control", "left_shift", "left_command", "left_option"] } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": [] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+semicolon -> left_command+z", + "manipulators": [ + { + "from": { + "key_code": "semicolon", + "modifiers": { "mandatory": ["left_command", "left_shift", "left_option", "left_control"] } + }, + "to": [ + { + "key_code": "z", + "modifiers": ["left_command"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+quote -> left_shift, left_command+z", + "manipulators": [ + { + "from": { + "key_code": "quote", + "modifiers": { "mandatory": ["left_command", "left_control", "left_option", "left_shift"] } + }, + "to": [ + { + "key_code": "z", + "modifiers": ["left_shift", "left_command"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+period -> left_control+n", + "manipulators": [ + { + "from": { + "key_code": "period", + "modifiers": { "mandatory": ["left_control", "left_shift", "left_command", "left_option"] } + }, + "to": [ + { + "key_code": "n", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+comma -> left_control+p", + "manipulators": [ + { + "from": { + "key_code": "comma", + "modifiers": { "mandatory": ["left_control", "left_shift", "left_command", "left_option"] } + }, + "to": [ + { + "key_code": "p", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+slash -> left_control+y", + "manipulators": [ + { + "from": { + "key_code": "slash", + "modifiers": { "mandatory": ["left_command", "left_control", "left_shift", "left_option"] } + }, + "to": [ + { + "key_code": "y", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+m -> left_option+c", + "manipulators": [ + { + "from": { + "key_code": "m", + "modifiers": { "mandatory": ["left_command", "left_option", "left_control", "left_shift"] } + }, + "to": [ + { + "key_code": "c", + "modifiers": ["left_option"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+c -> left_command+c", + "manipulators": [ + { + "from": { + "key_code": "c", + "modifiers": { "mandatory": ["left_command", "left_control", "left_option", "left_shift"] } + }, + "to": [ + { + "key_code": "c", + "modifiers": ["left_command"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+v -> left_command+v", + "manipulators": [ + { + "from": { + "key_code": "v", + "modifiers": { "mandatory": ["left_command", "left_control", "left_option", "left_shift"] } + }, + "to": [ + { + "key_code": "v", + "modifiers": ["left_command"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+y -> left_control+c", + "manipulators": [ + { + "from": { + "key_code": "y", + "modifiers": { "mandatory": ["left_shift", "left_command", "left_option", "left_control"] } + }, + "to": [ + { + "key_code": "c", + "modifiers": ["left_control"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Hyper+t -> left_command+tab", + "manipulators": [ + { + "from": { + "key_code": "t", + "modifiers": { "mandatory": ["left_option", "left_shift", "left_command", "left_control"] } + }, + "to": [ + { + "key_code": "tab", + "modifiers": ["left_command"] + } + ], + "type": "basic" + } + ] } ] }, diff --git a/.config/linearmouse/linearmouse.json b/.config/linearmouse/linearmouse.json index 9427db9..b8eedbc 100644 --- a/.config/linearmouse/linearmouse.json +++ b/.config/linearmouse/linearmouse.json @@ -1,132 +1,127 @@ { + "$schema" : "https:\/\/schema.linearmouse.app\/0.10.2", "schemes" : [ { - "scrolling" : { - "distance" : { - "vertical" : 3 - }, - "acceleration" : { - "vertical" : 1 - }, - "reverse" : { - "vertical" : true - }, - "speed" : { - "vertical" : 0 - } - }, "if" : { "device" : { - "serialNumber" : "000000000000", + "category" : "mouse", "productID" : "0xa6", "productName" : "Razer Viper V2 Pro", - "category" : "mouse", + "serialNumber" : "000000000000", "vendorID" : "0x1532" } }, "pointer" : { - "disableAcceleration" : true, - "acceleration" : 1.2 - } - }, - { + "acceleration" : 1.2, + "disableAcceleration" : true + }, "scrolling" : { "acceleration" : { "vertical" : 1 }, + "distance" : { + "vertical" : 3 + }, "reverse" : { "vertical" : true }, "speed" : { "vertical" : 0 - }, - "distance" : { - "vertical" : 3 } - }, + } + }, + { "if" : { "device" : { - "productID" : "0x27da", - "serialNumber" : "pqrs.org:Karabiner-DriverKit-VirtualHIDPointing", "category" : "mouse", + "productID" : "0x27da", "productName" : "Karabiner DriverKit VirtualHIDPointing 1.7.0", + "serialNumber" : "pqrs.org:Karabiner-DriverKit-VirtualHIDPointing", "vendorID" : "0x16c0" } }, "pointer" : { "disableAcceleration" : true - } - }, - { + }, "scrolling" : { - "speed" : 0, - "acceleration" : 1, + "acceleration" : { + "vertical" : 1 + }, + "distance" : { + "vertical" : 3 + }, "reverse" : { "vertical" : true }, - "distance" : 3 - }, + "speed" : { + "vertical" : 0 + } + } + }, + { "if" : { "device" : { "category" : "mouse", + "productID" : "0xb021", "productName" : "Logitech Pebble", - "vendorID" : "0x46d", "serialNumber" : "2E61FDC85A9743AE", - "productID" : "0xb021" + "vendorID" : "0x46d" } }, "pointer" : { - "disableAcceleration" : true, - "acceleration" : 0.8663 + "acceleration" : 0.8663, + "disableAcceleration" : true + }, + "scrolling" : { + "acceleration" : 1, + "distance" : 3, + "reverse" : { + "vertical" : true + }, + "speed" : 0 } }, { - "scrolling" : { - "reverse" : true, - "acceleration" : 1, - "speed" : 0, - "distance" : { - "horizontal" : 3, - "vertical" : "auto" - } - }, "if" : { "device" : { "category" : "mouse", "productID" : "0xd031", - "vendorID" : "0x3434", - "productName" : "Keychron Link " + "productName" : "Keychron Link ", + "vendorID" : "0x3434" } }, "pointer" : { "acceleration" : 0.8655, "disableAcceleration" : true + }, + "scrolling" : { + "acceleration" : 1, + "distance" : 3, + "reverse" : true, + "speed" : 0 } }, { - "pointer" : { - "disableAcceleration" : true - }, "if" : { "device" : { "category" : "mouse", - "vendorID" : "0x3434", - "serialNumber" : "SN1234567890", "productID" : "0xd03f", - "productName" : "Keychron M6" + "productName" : "Keychron M6", + "serialNumber" : "SN1234567890", + "vendorID" : "0x3434" } }, + "pointer" : { + "disableAcceleration" : true + }, "scrolling" : { "acceleration" : 1, - "reverse" : true, "distance" : 3, + "reverse" : true, "speed" : 0 } }, { - "pointer" : { - "disableAcceleration" : true - }, "if" : { "device" : { "category" : "mouse", @@ -135,49 +130,49 @@ "vendorID" : "0x3434" } }, + "pointer" : { + "disableAcceleration" : true + }, "scrolling" : { + "acceleration" : 1, "distance" : 3, - "speed" : 0, "reverse" : true, - "acceleration" : 1 + "speed" : 0 } }, { "buttons" : { "universalBackForward" : true }, - "pointer" : { - "disableAcceleration" : true, - "acceleration" : 0.6 - }, "if" : { "device" : { - "productID" : "0x27da", "category" : "mouse", - "serialNumber" : "pqrs.org:Karabiner-DriverKit-VirtualHIDPointing", + "productID" : "0x27da", "productName" : "Karabiner DriverKit VirtualHIDPointing 1.8.0", + "serialNumber" : "pqrs.org:Karabiner-DriverKit-VirtualHIDPointing", "vendorID" : "0x16c0" } }, + "pointer" : { + "acceleration" : 0.6, + "disableAcceleration" : true + }, "scrolling" : { + "acceleration" : { + "vertical" : 1 + }, "distance" : { "vertical" : 3 }, - "speed" : { - "vertical" : 0 - }, "reverse" : { "vertical" : true }, - "acceleration" : { - "vertical" : 1 + "speed" : { + "vertical" : 0 } } }, { - "pointer" : { - "acceleration" : 0.8059 - }, "if" : { "device" : { "category" : "trackpad", @@ -185,17 +180,20 @@ "productName" : "Apple Internal Keyboard \/ Trackpad", "vendorID" : "0x0" } + }, + "pointer" : { + "acceleration" : 0.8059 } }, { "if" : { + "app" : "org.pqrs.Karabiner-Elements.Settings", "device" : { - "vendorID" : "0x0", - "productName" : "Apple Internal Keyboard \/ Trackpad", + "category" : "trackpad", "productID" : "0x0", - "category" : "trackpad" - }, - "app" : "org.pqrs.Karabiner-Elements.Settings" + "productName" : "Apple Internal Keyboard \/ Trackpad", + "vendorID" : "0x0" + } }, "scrolling" : { "acceleration" : { @@ -204,52 +202,78 @@ } }, { - "pointer" : { - "acceleration" : 0.2, - "disableAcceleration" : true, - "speed" : 0.1 - }, "if" : { "device" : { - "serialNumber" : "vial:f64c2b3c", "category" : "mouse", - "vendorID" : "0xc2ab", "productID" : "0x3939", - "productName" : "Ferris sweep" + "productName" : "Ferris sweep", + "serialNumber" : "vial:f64c2b3c", + "vendorID" : "0xc2ab" } }, + "pointer" : { + "acceleration" : 0.2, + "disableAcceleration" : true, + "speed" : 0.1 + }, "scrolling" : { - "distance" : { - "vertical" : 3 - }, "acceleration" : { "vertical" : 1 }, + "distance" : { + "vertical" : 3 + }, "speed" : { "vertical" : 0 } } }, { + "if" : { + "device" : { + "category" : "mouse", + "productID" : "0xd030", + "productName" : "Keychron Link ", + "vendorID" : "0x3434" + } + }, "pointer" : { "acceleration" : 1.0387, "disableAcceleration" : true }, + "scrolling" : { + "acceleration" : 1, + "distance" : 3, + "reverse" : true, + "speed" : 0 + } + }, + { "if" : { "device" : { "category" : "mouse", - "productName" : "Keychron Link ", - "productID" : "0xd030", + "productID" : "0xd043", + "productName" : "Keychron 1K Link", "vendorID" : "0x3434" } }, + "pointer" : { + "disableAcceleration" : true + }, "scrolling" : { - "distance" : 3, - "acceleration" : 1, - "speed" : 0, - "reverse" : true + "acceleration" : { + "vertical" : 1 + }, + "distance" : { + "vertical" : 3 + }, + "reverse" : { + "vertical" : true + }, + "speed" : { + "vertical" : 0 + } } } - ], - "$schema" : "https:\/\/schema.linearmouse.app\/0.10.0" -} + ] +}
\ No newline at end of file diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 369d7ab..74ad888 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,44 +1,46 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink-emoji.nvim": { "branch": "master", "commit": "f22ce8cac02a6ece05368220f1e38bd34fe376f9" }, - "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, + "blink-emoji.nvim": { "branch": "master", "commit": "066013e4c98a9318408ee3f1ca2dbcb6fa3e4c06" }, + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, "bullets.vim": { "branch": "master", "commit": "1c13e510e11d08b0259e8e627f128359c5521962" }, "cmp-sql": { "branch": "master", "commit": "54193ac99e3855c6ffaa36f83a7c50213df03157" }, - "conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, - "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, + "conform.nvim": { "branch": "master", "commit": "9fd3d5e0b689ec1bf400c53cbbec72c6fdf24081" }, + "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, + "flash.nvim": { "branch": "main", "commit": "3be9bf7e85550045ec576379a0c45aac144d0438" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "8c8845ca6d05bc768b7ce27ebe3682ddf7e6a996" }, - "gitsigns.nvim": { "branch": "main", "commit": "8bdaccdb897945a3c99c1ad8df94db0ddf5c8790" }, - "hardtime.nvim": { "branch": "main", "commit": "145b930954a3146cfb5b8a73cdcad42eb7d2740c" }, - "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, + "fzf-lua": { "branch": "main", "commit": "9244bd48e0e6167ffe521209d0cfddc70bb70c21" }, + "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, + "image.nvim": { "branch": "master", "commit": "c75654b37cd13df17475a53d9dc3e3d1b5e09fa1" }, + "jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" }, + "lazy.nvim": { "branch": "main", "commit": "16e52715b70b4d0fc6af3563ccc0ed9df82ae23e" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "60eaff7a470b8e78ddff09d847d17a011f560759" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "93a9ff9b34c91c0cb0f7de8d5f7e4abce51d8903" }, - "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" }, - "mini.nvim": { "branch": "main", "commit": "de0a88d925c8e69fdbb498141207ee43504e5cd1" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" }, + "mini.nvim": { "branch": "main", "commit": "cf32454e91b3d963a12fef0314811fb035b62d49" }, + "molten-nvim": { "branch": "main", "commit": "4fd7be6a12b5efda5179db642f13bad60893acca" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" }, "nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" }, - "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, - "nvim-lspconfig": { "branch": "master", "commit": "03bc581e05e81d33808b42b2d7e76d70adb3b595" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "51cf7c995ed1eb6642aecf19067ee634fa1b6ba2" }, + "nvim-lspconfig": { "branch": "master", "commit": "52a893217b2c12e215c6851bd8813b43204416cd" }, "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, - "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, - "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, - "outline.nvim": { "branch": "main", "commit": "321f89ef79f168a78685f70d70c52d0e7b563abb" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" }, - "render-markdown.nvim": { "branch": "main", "commit": "d69f0d8c80ba293d25dad498ec86e9b583a6bbbf" }, - "rustaceanvim": { "branch": "master", "commit": "5120207f90846704a74cbf043295698b009bd5de" }, - "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, - "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, - "typst-preview.nvim": { "branch": "master", "commit": "dea4525d5420b7c32eebda7de15a6beb9d6574fa" }, - "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, - "vim-tmux-navigator": { "branch": "master", "commit": "96da8e10ce83b754f442c3e25d1bf74451d220f2" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, + "oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" }, + "outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "pyworks.nvim": { "branch": "main", "commit": "5e7f0298849d4b1d3dd2f272d27b48a93bcdd424" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "3277ad5f96eb03c9d618c88e24f683e4364e578c" }, + "render-markdown.nvim": { "branch": "main", "commit": "475d3ad8cae486b0df6fc6050cf5b5ea1de42db8" }, + "rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" }, + "snacks.nvim": { "branch": "main", "commit": "4e1070867a701b863d4bce4fd54a6c11314de506" }, + "typst-preview.nvim": { "branch": "master", "commit": "1603d37bb44ed2efa0b4378d1dfedc087b4f2141" }, + "undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" }, + "uv.nvim": { "branch": "main", "commit": "be4a7d47a976249282bb2f71fc773ac2f5325973" }, + "vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" }, + "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } } diff --git a/.config/nvim/lua/config/plugins/blink-cmp.lua b/.config/nvim/lua/config/plugins/blink-cmp.lua index d51ba4a..424d463 100644 --- a/.config/nvim/lua/config/plugins/blink-cmp.lua +++ b/.config/nvim/lua/config/plugins/blink-cmp.lua @@ -68,14 +68,14 @@ return { name = "Emoji", score_offset = 15, -- Tune by preference opts = { insert = true }, -- Insert emoji (default) or complete its name - should_show_items = function() - return vim.tbl_contains( - -- Enable emoji completion only for git commits and markdown. - -- By default, enabled for all file-types. - { "gitcommit", "markdown" }, - vim.o.filetype - ) - end, + -- should_show_items = function() + -- return vim.tbl_contains( + -- -- Enable emoji completion only for git commits and markdown. + -- -- By default, enabled for all file-types. + -- { "gitcommit", "markdown" }, + -- vim.o.filetype + -- ) + -- end, }, sql = { -- IMPORTANT: use the same name as you would for nvim-cmp diff --git a/.config/nvim/lua/config/plugins/jupytext.lua b/.config/nvim/lua/config/plugins/jupytext.lua new file mode 100644 index 0000000..2f57193 --- /dev/null +++ b/.config/nvim/lua/config/plugins/jupytext.lua @@ -0,0 +1,6 @@ +return { + "GCBallesteros/jupytext.nvim", + config = true, + -- Depending on your nvim distro or config you may need to make the loading not lazy + -- lazy=false, +} diff --git a/.config/nvim/lua/config/plugins/learn.lua b/.config/nvim/lua/config/plugins/learn.lua index ebaf057..2d82d9f 100644 --- a/.config/nvim/lua/config/plugins/learn.lua +++ b/.config/nvim/lua/config/plugins/learn.lua @@ -1,8 +1,8 @@ return { - { - "m4xshen/hardtime.nvim", - lazy = false, - dependencies = { "MunifTanjim/nui.nvim" }, - opts = {}, - }, + -- { + -- "m4xshen/hardtime.nvim", + -- lazy = false, + -- dependencies = { "MunifTanjim/nui.nvim" }, + -- opts = {}, + -- }, } diff --git a/.config/nvim/lua/config/plugins/lsp.lua b/.config/nvim/lua/config/plugins/lsp.lua index dca3f5f..4d4dcc0 100644 --- a/.config/nvim/lua/config/plugins/lsp.lua +++ b/.config/nvim/lua/config/plugins/lsp.lua @@ -167,35 +167,25 @@ return { local servers = { bashls = {}, marksman = {}, - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, - -- - - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - -- settings = { - -- Lua = { - -- completion = { - -- callSnippet = 'Replace', - -- }, - -- -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- -- diagnostics = { disable = { 'missing-fields' } }, - -- }, - -- }, + pyright = { + settings = { + python = { + analysis = { + typeCheckingMode = "basic", + autoSearchPaths = true, + useLibraryCodeForTypes = true, + }, + }, + }, }, - } - - -- Ensure the servers and tools above are installed + clangd = { + cmd = { + "clangd", + "--fallback-style={BasedOnStyle: LLVM, IndentWidth: 4, TabWidth: 4, UseTab: Never}", + }, + }, + lua_ls = {}, + } -- Ensure the servers and tools above are installed -- -- To check the current status of installed tools and/or manually install -- other tools, you can run diff --git a/.config/nvim/lua/config/plugins/neotree.lua b/.config/nvim/lua/config/plugins/neotree.lua new file mode 100644 index 0000000..11a0a98 --- /dev/null +++ b/.config/nvim/lua/config/plugins/neotree.lua @@ -0,0 +1,17 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "nvim-tree/nvim-web-devicons", -- optional, but recommended + }, + lazy = false, -- neo-tree will lazily load itself + opts = { + window = { + position = "right", + }, + }, + }, +} diff --git a/.config/nvim/lua/config/plugins/notebook.lua b/.config/nvim/lua/config/plugins/notebook.lua new file mode 100644 index 0000000..f3eff87 --- /dev/null +++ b/.config/nvim/lua/config/plugins/notebook.lua @@ -0,0 +1,14 @@ +return { + { + "jeryldev/pyworks.nvim", + dependencies = { + "benlubas/molten-nvim", + "3rd/image.nvim", + }, + config = function() + require("pyworks").setup() -- See Configuration section for options + end, + lazy = false, + priority = 100, + }, +} diff --git a/.config/nvim/lua/config/plugins/uv.lua b/.config/nvim/lua/config/plugins/uv.lua new file mode 100644 index 0000000..121921b --- /dev/null +++ b/.config/nvim/lua/config/plugins/uv.lua @@ -0,0 +1,7 @@ +return { + "benomahony/uv.nvim", + event = "VeryLazy", + opts = { + picker_integration = true, + }, +} diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 5c2a498..25b566a 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -10,7 +10,7 @@ vim.keymap.set("x", "c", '"_c') local fzf = require("fzf-lua") -k.add({ +wk.add({ { mode = { "n" }, { "<C-d>", "<C-d>zz", desc = "Move down in buffer with cursor centered" }, @@ -25,6 +25,7 @@ k.add({ { "<C-j>", "<C-w><C-j>", hidden = true }, -- Move to lower window { "<C-k>", "<C-w><C-k>", hidden = true }, -- Move to upper window { "<C-q>", "<C-w><C-q>", hidden = true }, -- Close window + { "<leader>l", "<cmd>Neotree toggle<CR>", desc = "Neotree toggle" }, { "<leader><leader>", function() diff --git a/.config/sesh/sesh.toml b/.config/sesh/sesh.toml index 0404b98..b7fcbb6 100644 --- a/.config/sesh/sesh.toml +++ b/.config/sesh/sesh.toml @@ -1,4 +1,4 @@ [default_session] -startup_command = "nvim ." +startup_command = "" startup_command_ignore_dirs = ["~/.config"] preview_command = "eza --all --git --icons --color=always {}" diff --git a/.config/yazi/package.toml b/.config/yazi/package.toml index 869975b..7098a8d 100644 --- a/.config/yazi/package.toml +++ b/.config/yazi/package.toml @@ -1,12 +1,12 @@ [[plugin.deps]] use = "KKV9/compress" -rev = "60b24af" -hash = "ee025be766240cc98e671754ac836da3" +rev = "c9c16d8" +hash = "a68bde26a61da040131aa95069f638c2" [[plugin.deps]] use = "yazi-rs/plugins:smart-enter" -rev = "600614a" -hash = "c1a2739e9ef2d837030ccb4267be3ed1" +rev = "03cdd4b" +hash = "56fdabc96fc1f4d53c96eb884b02a5be" [flavor] deps = [] diff --git a/.config/yazi/plugins/compress.yazi/README.md b/.config/yazi/plugins/compress.yazi/README.md index 385fe38..ae1f329 100644 --- a/.config/yazi/plugins/compress.yazi/README.md +++ b/.config/yazi/plugins/compress.yazi/README.md @@ -1,48 +1,173 @@ -# ~~archive.yazi~~ compress.yazi +<h1 align="center">🗜️ compress.yazi</h1> +<p align="center"> + <b>A blazing fast, flexible archive plugin for <a href="https://github.com/sxyazi/yazi">Yazi</a></b><br> + <i>Effortlessly compress your files and folders with style!</i> +</p> -A Yazi plugin that compresses selected files to an archive. Supporting yazi versions 0.2.5 and up. +--- -## Supported file types +## 📖 Table of Contents -| Extention | Unix Command | Windows Command | -| ------------- | ------------- | --------------- | -| .zip | zip -r | 7z a -tzip | -| .7z | 7z a | 7z a | -| .tar | tar rpf | tar rpf | -| .tar.gz | gzip | 7z a -tgzip | -| .tar.xz | xz | 7z a -txz | -| .tar.bz2 | bzip2 | 7z a -tbzip2 | -| .tar.zst | zstd | zstd | +- [Features](#-features) +- [Supported File Types](#-supported-file-types) +- [Installation](#%EF%B8%8F-installation) +- [Keymap Example](#-keymap-example) +- [Usage](#%EF%B8%8F-usage) +- [Flags](#%EF%B8%8F-flags) +- [Tips](#-tips) +- [Credits](#-credits) +--- -**NOTE:** Windows users are required to install 7-Zip and add 7z.exe to the `path` environment variable, only tar archives will be available otherwise. +## 🚀 Features +- 🗂️ **Multi-format support:** zip, 7z, rar, tar, tar.gz, tar.xz, tar.bz2, tar.zst, tar.lz4, tar.lha +- 🌍 **Cross-platform:** Works on Unix & Windows +- 🔒 **Password protection:** Secure your archives (zip/7z/rar) +- 🛡️ **Header encryption:** Hide file lists (7z/rar) +- ⚡ **Compression level:** Choose your balance of speed vs. size +- 🛑 **Overwrite safety:** Never lose files by accident +- 🎯 **Seamless Yazi integration:** Fast, native-like UX -## Install +--- + +## 📦 Supported File Types + +| Extension | Default Command | 7z Command | Bsdtar Command (Win10+ & Unix) | +| ------------- | ----------------- | -------------- | ------------------------------ | +| `.zip` | `zip -r` | `7z a -tzip` | `tar -caf` | +| `.7z` | `7z a` | `7z a` | | +| `.rar` | `rar a` | | | +| `.tar` | `tar rpf` | | `tar rpf` | +| `.tar.gz` | `tar rpf + gzip` | `7z a -tgzip` | `tar -czf` | +| `.tar.xz` | `tar rpf + xz` | `7z a -txz` | `tar -cJf` | +| `.tar.bz2` | `tar rpf + bzip2` | `7z a -tbzip2` | `tar -cjf` | +| `.tar.zst` | `tar rpf + zstd` | | `tar --zstd -cf` | +| `.tar.lz4` | `tar rpf + lz4` | | | +| `.tar.lha` | `tar rpf + lha` | | | + +--- + +## ⚡️ Installation ```bash -# For Unix platforms +# Unix git clone https://github.com/KKV9/compress.yazi.git ~/.config/yazi/plugins/compress.yazi -## For Windows +# Windows (CMD, not PowerShell!) git clone https://github.com/KKV9/compress.yazi.git %AppData%\yazi\config\plugins\compress.yazi # Or with yazi plugin manager -ya pack -a KKV9/compress +ya pkg add KKV9/compress ``` -- Add this to your `keymap.toml`: +--- + +### 🔧 Extras (Windows) + +To enable additional compression formats and features on Windows, follow these steps: + +1. **Install [7-Zip](https://www.7-zip.org/):** + Add `C:\Program Files\7-Zip` to your `PATH`. + This enables support for `.7z` archives and password-protected `.zip` files. + +2. **Alternative: Install [Nanazip](https://github.com/M2Team/NanaZip):** + A modern alternative to 7-Zip with similar functionality and extra features. + +3. **Install [WinRAR](https://www.win-rar.com/download.html):** + Add `C:\Program Files\WinRAR` to your `PATH`. + This enables support for `.rar` archives. + +4. **Install Additional Tools:** + To use formats like `lha`, `lz4`, `gzip`, etc., install their respective tools and ensure they are added to your `PATH`. + +--- + +## 🎹 Keymap Example + +Add this to your `keymap.toml`: + ```toml -[[manager.prepend_keymap]] -on = [ "c", "a" ] +[[mgr.prepend_keymap]] +on = [ "c", "a", "a" ] run = "plugin compress" desc = "Archive selected files" + +[[mgr.prepend_keymap]] +on = [ "c", "a", "p" ] +run = "plugin compress -p" +desc = "Archive selected files (password)" + +[[mgr.prepend_keymap]] +on = [ "c", "a", "h" ] +run = "plugin compress -ph" +desc = "Archive selected files (password+header)" + +[[mgr.prepend_keymap]] +on = [ "c", "a", "l" ] +run = "plugin compress -l" +desc = "Archive selected files (compression level)" + +[[mgr.prepend_keymap]] +on = [ "c", "a", "u" ] +run = "plugin compress -phl" +desc = "Archive selected files (password+header+level)" +``` + +--- + +## 🛠️ Usage + +1. **Select files/folders** in Yazi. +2. Press <kbd>c</kbd> <kbd>a</kbd> to open the archive dialog. +3. Choose: + - <kbd>a</kbd> for a standard archive + - <kbd>p</kbd> for password protection (zip/7z/rar) + - <kbd>h</kbd> to encrypt header (7z/rar) + - <kbd>l</kbd> to set compression level (all compression algorithims) + - <kbd>u</kbd> for all options together +4. **Type a name** for your archive (or leave blank for suggested name). +5. **Enter password** and/or **compression level** if prompted. +6. **Overwrite protect** if a file already exists, the new file will be given a suffix _#. +7. Enjoy your shiny new archive! + +--- + +## 🏳️🌈 Flags + +- Combine flags for more power! +- when separating flags with spaces, make sure to single quote them (eg., `'-ph rar'`) +- `-p` Password protect (zip/7z/rar) +- `-h` Encrypt header (7z/rar) +- `-l` Set compression level (all compression algorithims) +- `<extention>` Specify a default extention (eg., `7z`, `tar.gz`) + +#### Combining multiple flags: +```toml +[[mgr.prepend_keymap]] +on = [ "c", "a", "7" ] +run = "plugin compress '-ph 7z'" +desc = "Archive selected files to 7z (password+header)" +[[mgr.prepend_keymap]] +on = [ "c", "a", "r" ] +run = "plugin compress '-p -l rar'" +desc = "Archive selected files to rar (password+level)" ``` -## Usage +--- + +## 💡 Tips + +- The file extension **must** match a supported type. +- The required compression tool **must** be installed and in your `PATH` (7zip/rar etc.). +- If no extention is provided, the default extention (zip) will be appended automatically. + +--- + +## 📣 Credits + +Made with ❤️ for [Yazi](https://github.com/sxyazi/yazi) by [KKV9](https://github.com/KKV9). +Contributions are welcome! Feel free to submit a pull request. - - Select files or folders to add, then press `c` `a` to create a new archive. - - Type a name for the new file. - - The file extention must match one of the supported filetype extentions. - - The desired archive/compression command must be installed on your system. +--- diff --git a/.config/yazi/plugins/compress.yazi/main.lua b/.config/yazi/plugins/compress.yazi/main.lua index 333587f..2197bb2 100644 --- a/.config/yazi/plugins/compress.yazi/main.lua +++ b/.config/yazi/plugins/compress.yazi/main.lua @@ -1,228 +1,497 @@ --- Send error notification
-local function notify_error(message, urgency)
- ya.notify({
- title = "Archive",
- content = message,
- level = urgency,
- timeout = 5,
- })
-end
-
-- Check for windows
local is_windows = ya.target_family() == "windows"
+-- Define flags and strings
+local is_password, is_encrypted, is_level, cmd_password, cmd_level, default_extension = false, false, false, "", "", "zip"
--- Make table of selected or hovered: path = filenames
-local selected_or_hovered = ya.sync(function()
- local tab, paths, names, path_fnames = cx.active, {}, {}, {}
- for _, u in pairs(tab.selected) do
- paths[#paths + 1] = tostring(u:parent())
- names[#names + 1] = tostring(u:name())
- end
- if #paths == 0 and tab.current.hovered then
- paths[1] = tostring(tab.current.hovered.url:parent())
- names[1] = tostring(tab.current.hovered.name)
- end
- for idx, name in ipairs(names) do
- if not path_fnames[paths[idx]] then
- path_fnames[paths[idx]] = {}
- end
- table.insert(path_fnames[paths[idx]], name)
- end
- return path_fnames, tostring(tab.current.cwd)
-end)
-
--- Check if archive command is available
-local function is_command_available(cmd)
- local stat_cmd
-
- if is_windows then
- stat_cmd = string.format("where %s > nul 2>&1", cmd)
- else
- stat_cmd = string.format("command -v %s >/dev/null 2>&1", cmd)
- end
-
- local cmd_exists = os.execute(stat_cmd)
- if cmd_exists then
- return true
- else
- return false
- end
+-- Function to check valid filename
+local function is_valid_filename(name)
+ -- Trim whitespace from both ends
+ name = name:match("^%s*(.-)%s*$")
+ if name == "" then
+ return false
+ end
+ if is_windows then
+ -- Windows forbidden chars and reserved names
+ if name:find('[<>:"/\\|%?%*]') then
+ return false
+ end
+ else
+ -- Unix forbidden chars
+ if name:find("/") or name:find("%z") then
+ return false
+ end
+ end
+ return true
end
--- Archive command list --> string
-local function find_binary(cmd_list)
- for _, cmd in ipairs(cmd_list) do
- if is_command_available(cmd) then
- return cmd
- end
- end
- return cmd_list[1] -- Return first command as fallback
+-- Function to send notifications
+local function notify_error(message, urgency)
+ ya.notify(
+ {
+ title = "Archive",
+ content = message,
+ level = urgency,
+ timeout = 5
+ }
+ )
end
--- Check if file exists
-local function file_exists(name)
- local f = io.open(name, "r")
- if f ~= nil then
- io.close(f)
- return true
- else
- return false
- end
+-- Function to check if command is available
+local function is_command_available(cmd)
+ local stat_cmd
+ if is_windows then
+ stat_cmd = string.format("where %s > nul 2>&1", cmd)
+ else
+ stat_cmd = string.format("command -v %s >/dev/null 2>&1", cmd)
+ end
+ local cmd_exists = os.execute(stat_cmd)
+ if cmd_exists then
+ return true
+ else
+ return false
+ end
+end
+
+-- Function to change command arrays --> string -- Use first command available or first command
+local function find_command_name(cmd_list)
+ for _, cmd in ipairs(cmd_list) do
+ if is_command_available(cmd) then
+ return cmd
+ end
+ end
+ return cmd_list[1] -- Return first command as fallback
end
--- Append filename to it's parent directory
+-- Function to append filename to it's parent directory url
local function combine_url(path, file)
- path, file = Url(path), Url(file)
- return tostring(path:join(file))
+ path, file = Url(path), Url(file)
+ return tostring(path:join(file))
end
+-- Function to make a table of selected or hovered files: path = filenames
+local selected_or_hovered =
+ ya.sync(
+ function()
+ local tab, paths, names, path_fnames = cx.active, {}, {}, {}
+ for _, u in pairs(tab.selected) do
+ paths[#paths + 1] = tostring(u.parent)
+ names[#names + 1] = tostring(u.name)
+ end
+ if #paths == 0 and tab.current.hovered then
+ paths[1] = tostring(tab.current.hovered.url.parent)
+ names[1] = tostring(tab.current.hovered.name)
+ end
+ for idx, name in ipairs(names) do
+ if not path_fnames[paths[idx]] then
+ path_fnames[paths[idx]] = {}
+ end
+ table.insert(path_fnames[paths[idx]], name)
+ end
+ return path_fnames, names, tostring(tab.current.cwd)
+ end
+)
+
+-- Table of archive commands
+local archive_commands = {
+ ["%.zip$"] = {
+ {command = "zip", args = {"-r"}, level_arg = "-", level_min = 0, level_max = 9, passwordable = true},
+ {
+ command = {"7z", "7zz", "7za"},
+ args = {"a", "-tzip"},
+ level_arg = "-mx=",
+ level_min = 0,
+ level_max = 9,
+ passwordable = true
+ },
+ {
+ command = {"tar", "bsdtar"},
+ args = {"-caf"},
+ level_arg = {"--option", "compression-level="},
+ level_min = 1,
+ level_max = 9
+ }
+ },
+ ["%.7z$"] = {
+ {
+ command = {"7z", "7zz", "7za"},
+ args = {"a"},
+ level_arg = "-mx=",
+ level_min = 0,
+ level_max = 9,
+ header_arg = "-mhe=on",
+ passwordable = true
+ }
+ },
+ ["%.rar$"] = {
+ {
+ command = "rar",
+ args = {"a"},
+ level_arg = "-m",
+ level_min = 0,
+ level_max = 5,
+ header_arg = "-hp",
+ passwordable = true
+ }
+ },
+ ["%.tar.gz$"] = {
+ {command = {"tar", "bsdtar"}, args = {"rpf"}, level_arg = "-", level_min = 1, level_max = 9, compress = "gzip"},
+ {
+ command = {"tar", "bsdtar"},
+ args = {"rpf"},
+ level_arg = "-mx=",
+ level_min = 1,
+ level_max = 9,
+ compress = "7z",
+ compress_args = {"a", "-tgzip"}
+ },
+ {
+ command = {"tar", "bsdtar"},
+ args = {"-czf"},
+ level_arg = {"--option", "gzip:compression-level="},
+ level_min = 1,
+ level_max = 9
+ }
+ },
+ ["%.tar.xz$"] = {
+ {command = {"tar", "bsdtar"}, args = {"rpf"}, level_arg = "-", level_min = 1, level_max = 9, compress = "xz"},
+ {
+ command = {"tar", "bsdtar"},
+ args = {"rpf"},
+ level_arg = "-mx=",
+ level_min = 1,
+ level_max = 9,
+ compress = "7z",
+ compress_args = {"a", "-txz"}
+ },
+ {
+ command = {"tar", "bsdtar"},
+ args = {"-cJf"},
+ level_arg = {"--option", "xz:compression-level="},
+ level_min = 1,
+ level_max = 9
+ }
+ },
+ ["%.tar.bz2$"] = {
+ {command = {"tar", "bsdtar"}, args = {"rpf"}, level_arg = "-", level_min = 1, level_max = 9, compress = "bzip2"},
+ {
+ command = {"tar", "bsdtar"},
+ args = {"rpf"},
+ level_arg = "-mx=",
+ level_min = 1,
+ level_max = 9,
+ compress = "7z",
+ compress_args = {"a", "-tbzip2"}
+ },
+ {
+ command = {"tar", "bsdtar"},
+ args = {"-cjf"},
+ level_arg = {"--option", "bzip2:compression-level="},
+ level_min = 1,
+ level_max = 9
+ }
+ },
+ ["%.tar.zst$"] = {
+ {
+ command = {"tar", "bsdtar"},
+ args = {"rpf"},
+ level_arg = "-",
+ level_min = 1,
+ level_max = 22,
+ compress = "zstd",
+ compress_args = {"--ultra"}
+ }
+ },
+ ["%.tar.lz4$"] = {
+ {
+ command = {"tar", "bsdtar"},
+ args = {"rpf"},
+ level_arg = "-",
+ level_min = 1,
+ level_max = 12,
+ compress = "lz4"
+ }
+ },
+ ["%.tar.lha$"] = {
+ {
+ command = {"tar", "bsdtar"},
+ args = {"rpf"},
+ level_arg = "-o",
+ level_min = 5,
+ level_max = 7,
+ compress = "lha",
+ compress_args = {"-a"}
+ }
+ },
+ ["%.tar$"] = {
+ {command = {"tar", "bsdtar"}, args = {"rpf"}}
+ }
+}
+
return {
- entry = function()
- -- Exit visual mode
- ya.manager_emit("escape", { visual = true })
-
- -- Define file table and output_dir (pwd)
- local path_fnames, output_dir = selected_or_hovered()
-
- -- Get input
- local output_name, event = ya.input({
- title = "Create archive:",
- position = { "top-center", y = 3, w = 40 },
- })
- if event ~= 1 then
- return
- end
-
- -- Use appropriate archive command
- local archive_commands = {
- ["%.zip$"] = { command = "zip", args = { "-r" } },
- ["%.7z$"] = { command = { "7z", "7zz" }, args = { "a" } },
- ["%.tar.gz$"] = { command = "tar", args = { "rpf" }, compress = "gzip" },
- ["%.tar.xz$"] = { command = "tar", args = { "rpf" }, compress = "xz" },
- ["%.tar.bz2$"] = { command = "tar", args = { "rpf" }, compress = "bzip2" },
- ["%.tar.zst$"] = { command = "tar", args = { "rpf" }, compress = "zstd", compress_args = { "--rm" } },
- ["%.tar$"] = { command = "tar", args = { "rpf" } },
- }
-
- if is_windows then
- archive_commands = {
- ["%.zip$"] = { command = "7z", args = { "a", "-tzip" } },
- ["%.7z$"] = { command = "7z", args = { "a" } },
- ["%.tar.gz$"] = {
- command = "tar",
- args = { "rpf" },
- compress = "7z",
- compress_args = { "a", "-tgzip", "-sdel", output_name },
- },
- ["%.tar.xz$"] = {
- command = "tar",
- args = { "rpf" },
- compress = "7z",
- compress_args = { "a", "-txz", "-sdel", output_name },
- },
- ["%.tar.bz2$"] = {
- command = "tar",
- args = { "rpf" },
- compress = "7z",
- compress_args = { "a", "-tbzip2", "-sdel", output_name },
- },
- ["%.tar.zst$"] = { command = "tar", args = { "rpf" }, compress = "zstd", compress_args = { "--rm" } },
- ["%.tar$"] = { command = "tar", args = { "rpf" } },
- }
- end
-
- -- Match user input to archive command
- local archive_cmd, archive_args, archive_compress, archive_compress_args
- for pattern, cmd_pair in pairs(archive_commands) do
- if output_name:match(pattern) then
- archive_cmd = cmd_pair.command
- archive_args = cmd_pair.args
- archive_compress = cmd_pair.compress
- archive_compress_args = cmd_pair.compress_args or {}
- end
- end
-
- -- Check if archive command has multiple names
- if type(archive_cmd) == "table" then
- archive_cmd = find_binary(archive_cmd)
- end
-
- -- Check if no archive command is available for the extention
- if not archive_cmd then
- notify_error("Unsupported file extention", "error")
- return
- end
-
- -- Exit if archive command is not available
- if not is_command_available(archive_cmd) then
- notify_error(string.format("%s not available", archive_cmd), "error")
- return
- end
-
- -- Exit if compress command is not available
- if archive_compress and not is_command_available(archive_compress) then
- notify_error(string.format("%s compression not available", archive_compress), "error")
- return
- end
-
- -- If file exists show overwrite prompt
- local output_url = combine_url(output_dir, output_name)
- while true do
- if file_exists(output_url) then
- local overwrite_answer = ya.input({
- title = "Overwrite " .. output_name .. "? y/N:",
- position = { "top-center", y = 3, w = 40 },
- })
- if overwrite_answer:lower() ~= "y" then
- notify_error("Operation canceled", "warn")
- return -- If no overwrite selected, exit
- else
- local rm_status, rm_err = os.remove(output_url)
- if not rm_status then
- notify_error(string.format("Failed to remove %s, exit code %s", output_name, rm_err), "error")
- return
- end -- If overwrite fails, exit
- end
- end
- if archive_compress and not output_name:match("%.tar$") then
- output_name = output_name:match("(.*%.tar)") -- Test for .tar and .tar.*
- output_url = combine_url(output_dir, output_name) -- Update output_url
- else
- break
- end
- end
-
- -- Add to output archive in each path, their respective files
- for path, names in pairs(path_fnames) do
- local archive_status, archive_err =
- Command(archive_cmd):args(archive_args):arg(output_url):args(names):cwd(path):spawn():wait()
- if not archive_status or not archive_status.success then
- notify_error(
- string.format(
- "%s with selected files failed, exit code %s",
- archive_args,
- archive_status and archive_status.code or archive_err
- ),
- "error"
- )
- end
- end
-
- -- Use compress command if needed
- if archive_compress then
- local compress_status, compress_err =
- Command(archive_compress):args(archive_compress_args):arg(output_name):cwd(output_dir):spawn():wait()
- if not compress_status or not compress_status.success then
- notify_error(
- string.format(
- "%s with %s failed, exit code %s",
- archive_compress,
- output_name,
- compress_status and compress_status.code or compress_err
- ),
- "error"
- )
- end
- end
- end,
+ entry = function(_, job)
+ -- Parse flags and default extension
+ if job.args ~= nil then
+ for _, arg in ipairs(job.args) do
+ if arg:match("^%-(%w+)$") then
+ -- Handle combined flags (e.g., -phl)
+ for flag in arg:sub(2):gmatch(".") do
+ if flag == "p" then
+ is_password = true
+ elseif flag == "h" then
+ is_encrypted = true
+ elseif flag == "l" then
+ is_level = true
+ end
+ end
+ elseif arg:match("^[%w%.]+$") then
+ -- Handle default extension (e.g., 7z, zip)
+ if archive_commands["%." .. arg .. "$"] then
+ default_extension = arg
+ else
+ notify_error(string.format("Unsupported extension: %s", arg), "warn")
+ end
+ else
+ notify_error(string.format("Unknown argument: %s", arg), "warn")
+ end
+ end
+ end
+
+ -- Exit visual mode
+ ya.emit("escape", {visual = true})
+ -- Define file table and output_dir (pwd)
+ local path_fnames, fnames, output_dir = selected_or_hovered()
+ -- Get archive filename
+ local output_name, event =
+ ya.input(
+ {
+ title = "Create archive:",
+ pos = {"top-center", y = 3, w = 40}
+ }
+ )
+ if event ~= 1 then
+ return
+ end
+
+ -- Determine the default name for the archive
+ local default_name = #fnames == 1 and fnames[1] or Url(output_dir).name
+ output_name = output_name == "" and string.format("%s.%s", default_name, default_extension) or output_name
+
+ -- Add default extension if none is specified
+ if not output_name:match("%.%w+$") then
+ output_name = string.format("%s.%s", output_name, default_extension)
+ end
+
+ -- Validate the final archive filename
+ if not is_valid_filename(output_name) then
+ notify_error("Invalid archive filename", "error")
+ return
+ end
+
+ -- Match user input to archive command
+ local archive_cmd,
+ archive_args,
+ archive_compress,
+ archive_level_arg,
+ archive_level_min,
+ archive_level_max,
+ archive_header_arg,
+ archive_passwordable,
+ archive_compress_args
+ local matched_pattern = false
+ for pattern, cmd_list in pairs(archive_commands) do
+ if output_name:match(pattern) then
+ matched_pattern = true -- Mark that file extension is correct
+ for _, cmd in ipairs(cmd_list) do
+ -- Check if archive_cmd is available
+ local find_command = type(cmd.command) == "table" and find_command_name(cmd.command) or cmd.command
+ if is_command_available(find_command) then
+ -- Check if compress_cmd (if listed) is available
+ if cmd.compress == nil or is_command_available(cmd.compress) then
+ archive_cmd = find_command
+ archive_args = cmd.args
+ archive_compress = cmd.compress or ""
+ archive_level_arg = is_level and cmd.level_arg or ""
+ archive_level_min = cmd.level_min
+ archive_level_max = cmd.level_max
+ archive_header_arg = is_encrypted and cmd.header_arg or ""
+ archive_passwordable = cmd.passwordable or false
+ archive_compress_args = cmd.compress_args or {}
+ break
+ end
+ end
+ end
+ if archive_cmd then
+ break
+ end
+ end
+ end
+
+ -- Check if no archive command is available for the extension
+ if not matched_pattern then
+ notify_error("Unsupported file extension", "error")
+ return
+ end
+
+ -- Check if no suitable archive program was found
+ if not archive_cmd then
+ notify_error("Could not find a suitable archive program for the selected file extension", "error")
+ return
+ end
+
+ -- Check if archive command has multiple names
+ if type(archive_cmd) == "table" then
+ archive_cmd = find_command_name(archive_cmd)
+ end
+
+ -- Exit if archive command is not available
+ if not is_command_available(archive_cmd) then
+ notify_error(string.format("%s not available", archive_cmd), "error")
+ return
+ end
+
+ -- Exit if compress command is not available
+ if archive_compress ~= "" and not is_command_available(archive_compress) then
+ notify_error(string.format("%s compression not available", archive_compress), "error")
+ return
+ end
+
+ -- Add password arg if selected
+ if archive_passwordable and is_password then
+ local output_password, event =
+ ya.input(
+ {
+ title = "Enter password:",
+ obscure = true,
+ pos = {"top-center", y = 3, w = 40}
+ }
+ )
+ if event ~= 1 then
+ return
+ end
+ if output_password ~= "" then
+ cmd_password = "-P" .. output_password
+ if archive_cmd == "rar" and is_encrypted then
+ cmd_password = archive_header_arg .. output_password -- Add archive arg for rar
+ end
+ table.insert(archive_args, cmd_password)
+ end
+ end
+
+ -- Add header arg if selected for 7z
+ if is_encrypted and archive_header_arg ~= "" and archive_cmd ~= "rar" then
+ table.insert(archive_args, archive_header_arg)
+ end
+
+ -- Add level arg if selected
+ if archive_level_arg ~= "" and is_level then
+ local output_level, event =
+ ya.input(
+ {
+ title = string.format("Enter compression level (%s - %s)", archive_level_min, archive_level_max),
+ pos = {"top-center", y = 3, w = 40}
+ }
+ )
+ if event ~= 1 then
+ return
+ end
+ -- Validate user input for compression level
+ if
+ output_level ~= "" and tonumber(output_level) ~= nil and tonumber(output_level) >= archive_level_min and
+ tonumber(output_level) <= archive_level_max
+ then
+ cmd_level =
+ type(archive_level_arg) == "table" and archive_level_arg[#archive_level_arg] .. output_level or
+ archive_level_arg .. output_level
+ local target_args = archive_compress == "" and archive_args or archive_compress_args
+ if type(archive_level_arg) == "table" then
+ -- Insert each element of archive_level_arg (except last) into target_args at the correct position
+ for i = 1, #archive_level_arg - 1 do
+ table.insert(target_args, i, archive_level_arg[i])
+ end
+ table.insert(target_args, #archive_level_arg, cmd_level) -- Add level at the end
+ else
+ -- Insert the compression level argument at the start if not a table
+ table.insert(target_args, 1, cmd_level)
+ end
+ else
+ notify_error("Invalid level specified. Using defaults.", "warn")
+ end
+ end
+
+ -- Store the original output name for later use
+ local original_name = output_name
+
+ -- If compression is needed, adjust the output name to exclude extensions like ".tar"
+ if archive_compress ~= "" then
+ output_name = output_name:match("(.*%.tar)") or output_name
+ end
+
+ -- Create a temporary directory for intermediate files
+ local temp_dir_name = ".tmp_compress"
+ local temp_dir = combine_url(output_dir, temp_dir_name)
+ local temp_dir, _ = tostring(fs.unique_name(Url(temp_dir)))
+
+ -- Attempt to create the temporary directory
+ local temp_dir_status, temp_dir_err = fs.create("dir_all", Url(temp_dir))
+ if not temp_dir_status then
+ -- Notify the user if the temporary directory creation fails
+ notify_error(string.format("Failed to create temp directory, error code: %s", temp_dir_err), "error")
+ return
+ end
+
+ -- Define the temporary output file path within the temporary directory
+ local temp_output_url = combine_url(temp_dir, output_name)
+
+ -- Add files to the output archive
+ for filepath, filenames in pairs(path_fnames) do
+ -- Execute the archive command for each path and its respective files
+ local archive_status, archive_err =
+ Command(archive_cmd):arg(archive_args):arg(temp_output_url):arg(filenames):cwd(filepath):spawn():wait()
+ if not archive_status or not archive_status.success then
+ -- Notify the user if the archiving process fails and clean up the temporary directory
+ notify_error(string.format("Failed to create archive %s with '%s', error: %s", output_name, archive_cmd, archive_err), "error")
+ local cleanup_status, cleanup_err = fs.remove("dir_all", Url(temp_dir))
+ if not cleanup_status then
+ notify_error(string.format("Failed to clean up temporary directory %s, error: %s", temp_dir, cleanup_err), "error")
+ end
+ return
+ end
+ end
+
+ -- If compression is required, execute the compression command
+ if archive_compress ~= "" then
+ local compress_status, compress_err =
+ Command(archive_compress):arg(archive_compress_args):arg(temp_output_url):spawn():wait()
+ if not compress_status or not compress_status.success then
+ -- Notify the user if the compression process fails and clean up the temporary directory
+ notify_error(string.format("Failed to compress archive %s with '%s', error: %s", output_name, archive_compress, compress_err), "error")
+ local cleanup_status, cleanup_err = fs.remove("dir_all", Url(temp_dir))
+ if not cleanup_status then
+ notify_error(string.format("Failed to clean up temporary directory %s, error: %s", temp_dir, cleanup_err), "error")
+ end
+ return
+ end
+ end
+
+ -- Move the final file from the temporary directory to the output directory
+ local final_output_url, temp_url_processed = combine_url(output_dir, original_name), combine_url(temp_dir, original_name)
+ final_output_url, _ = tostring(fs.unique_name(Url(final_output_url)))
+ local move_status, move_err = os.rename(temp_url_processed, final_output_url)
+ if not move_status then
+ -- Notify the user if the move operation fails and clean up the temporary directory
+ notify_error(string.format("Failed to move %s to %s, error: %s", temp_url_processed, final_output_url, move_err), "error")
+ local cleanup_status, cleanup_err = fs.remove("dir_all", Url(temp_dir))
+ if not cleanup_status then
+ notify_error(string.format("Failed to clean up temporary directory %s, error: %s", temp_dir, cleanup_err), "error")
+ end
+ return
+ end
+
+ -- Cleanup the temporary directory after successful operation
+ local cleanup_status, cleanup_err = fs.remove("dir_all", Url(temp_dir))
+ if not cleanup_status then
+ notify_error(string.format("Failed to clean up temporary directory %s, error: %s", temp_dir, cleanup_err), "error")
+ end
+ end
}
+
diff --git a/.config/yazi/plugins/smart-enter.yazi/README.md b/.config/yazi/plugins/smart-enter.yazi/README.md index d4c6bbd..742f2e1 100644 --- a/.config/yazi/plugins/smart-enter.yazi/README.md +++ b/.config/yazi/plugins/smart-enter.yazi/README.md @@ -5,7 +5,7 @@ ## Installation ```sh -ya pack -a yazi-rs/plugins:smart-enter +ya pkg add yazi-rs/plugins:smart-enter ``` ## Usage @@ -13,7 +13,7 @@ ya pack -a yazi-rs/plugins:smart-enter Bind your <kbd>l</kbd> key to the plugin, in your `~/.config/yazi/keymap.toml`: ```toml -[[manager.prepend_keymap]] +[[mgr.prepend_keymap]] on = "l" run = "plugin smart-enter" desc = "Enter the child directory, or open the file" @@ -36,5 +36,5 @@ require("smart-enter"):setup { This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file. -[open]: https://yazi-rs.github.io/docs/configuration/keymap/#manager.open -[enter]: https://yazi-rs.github.io/docs/configuration/keymap/#manager.enter +[open]: https://yazi-rs.github.io/docs/configuration/keymap/#mgr.open +[enter]: https://yazi-rs.github.io/docs/configuration/keymap/#mgr.enter diff --git a/.config/yazi/plugins/smart-enter.yazi/main.lua b/.config/yazi/plugins/smart-enter.yazi/main.lua index 37a465a..e9e2ec6 100644 --- a/.config/yazi/plugins/smart-enter.yazi/main.lua +++ b/.config/yazi/plugins/smart-enter.yazi/main.lua @@ -1,10 +1,11 @@ +--- @since 25.5.31 --- @sync entry local function setup(self, opts) self.open_multi = opts.open_multi end local function entry(self) local h = cx.active.current.hovered - ya.manager_emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi }) + ya.emit(h and h.cha.is_dir and "enter" or "open", { hovered = not self.open_multi }) end return { entry = entry, setup = setup } diff --git a/.config/yazi/yazi.toml b/.config/yazi/yazi.toml index 465b12c..1931861 100644 --- a/.config/yazi/yazi.toml +++ b/.config/yazi/yazi.toml @@ -1,2 +1,6 @@ [opener] edit = [{ run = 'nvim "$@"', block = true }] + +[mgr] +ratio = [2, 5, 5] +scrolloff = 4 |
