commit 15e757478ea43d4fda68b755f349ef3fc115dbfa
parent 38738e0c9635f2e7f0599c4107a11bd5bc5bf11e
Author: awy <awy@awy.one>
Date: Sat, 14 Jun 2025 21:24:34 +0300
shorcuts script update: generate shortcuts for yazi file manager
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts
@@ -12,9 +12,10 @@ vim_shortcuts="/dev/null"
qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null"
vifm_shortcuts="/dev/null"
+yazi_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/yazi/keymap.toml"
# Remove, prepare files
-rm -f "$lf_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" 2>/dev/null
+rm -f "$lf_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" "$vim_shortcuts" "$yazi_shortcuts" 2>/dev/null
printf "# vim: filetype=sh\\n" > "$fish_shortcuts"
printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "# vim: filetype=sh\\n" > "$shell_env_shortcuts"
@@ -30,7 +31,14 @@ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ;
printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ;
printf(\"map C%s cd \42%s\42 \n\",\$1,\$2) >> \"$lf_shortcuts\" ;
- printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" }"
+ printf(\"cmap ;%s %s\n\",\$1,\$2) >> \"$vim_shortcuts\" ;
+ split(\$1, a, \"\")
+ chars = \"\"
+ for (i = 1; i <= length(a); i++) {
+ chars = chars sprintf(\"\\\"%s\\\"\", a[i])
+ if (i < length(a)) chars = chars \", \"
+ }
+ printf(\"[[mgr.prepend_keymap]]\\non = [\\\"g\\\", %s]\\nrun = \\\"cd %s\\\"\\n\\n\", chars, \$2) >> \"$yazi_shortcuts\" }"
# Format the `files` file in the correct syntax and sent it to both configs.
eval "echo \"$(cat "$bmfiles")\"" | \