diff options
Diffstat (limited to 'modules/home.legacy/conf/lf')
30 files changed, 1742 insertions, 0 deletions
diff --git a/modules/home.legacy/conf/lf/colors b/modules/home.legacy/conf/lf/colors new file mode 100644 index 00000000..1c2853ec --- /dev/null +++ b/modules/home.legacy/conf/lf/colors @@ -0,0 +1,184 @@ +# vim:ft=dircolors +# (This is not a dircolors file but it helps to highlight colors and comments) + +# default values from dircolors +# (entries with a leading # are not implemented in lf) +# #no 00 # NORMAL +# fi 00 # FILE +# #rs 0 # RESET +# di 01;34 # DIR +# ln 01;36 # LINK +# #mh 00 # MULTIHARDLINK +# pi 40;33 # FIFO +# so 01;35 # SOCK +# #do 01;35 # DOOR +# bd 40;33;01 # BLK +# cd 40;33;01 # CHR +# or 40;31;01 # ORPHAN +# #mi 00 # MISSING +# su 37;41 # SETUID +# sg 30;43 # SETGID +# #ca 30;41 # CAPABILITY +# tw 30;42 # STICKY_OTHER_WRITABLE +# ow 34;42 # OTHER_WRITABLE +# st 37;44 # STICKY +# ex 01;32 # EXEC + +# default values from lf (with matching order) +# ln 01;36 # LINK +# or 31;01 # ORPHAN +# tw 01;34 # STICKY_OTHER_WRITABLE +# ow 01;34 # OTHER_WRITABLE +# st 01;34 # STICKY +# di 01;34 # DIR +# pi 33 # FIFO +# so 01;35 # SOCK +# bd 33;01 # BLK +# cd 33;01 # CHR +# su 01;32 # SETUID +# sg 01;32 # SETGID +# ex 01;32 # EXEC +# fi 00 # FILE + + +# file types (with matching order) +ln 01;93 # LINK +or 01;93;106 # ORPHAN +tw 35 # STICKY_OTHER_WRITABLE +ow 35 # OTHER_WRITABLE +st 01;96 # STICKY +di 01;36 # DIR +pi 33 # FIFO +so 01;35 # SOCK +bd 33;01 # BLK +cd 33;01 # CHR +su 01;32 # SETUID +sg 01;32 # SETGID +ex 03;01;95 # EXEC +fi 00 # FILE + +# links to hide +~/.mozilla 01;08;30 +~/.ssh 01;08;30 +~/.zshenv 01;08;30 + +~/.steampid 01;08;30 +~/.steam 01;08;30 +~/.steampath 01;08;30 + +# archives or compressed (dircolors defaults) +*.tar 01;31 +*.tgz 01;31 +*.arc 01;31 +*.arj 01;31 +*.taz 01;31 +*.lha 01;31 +*.lz4 01;31 +*.lzh 01;31 +*.lzma 01;31 +*.tlz 01;31 +*.txz 01;31 +*.tzo 01;31 +*.t7z 01;31 +*.zip 01;31 +*.z 01;31 +*.dz 01;31 +*.gz 01;31 +*.lrz 01;31 +*.lz 01;31 +*.lzo 01;31 +*.xz 01;31 +*.zst 01;31 +*.tzst 01;31 +*.bz2 01;31 +*.bz 01;31 +*.tbz 01;31 +*.tbz2 01;31 +*.tz 01;31 +*.deb 01;31 +*.rpm 01;31 +*.jar 01;31 +*.war 01;31 +*.ear 01;31 +*.sar 01;31 +*.rar 01;31 +*.alz 01;31 +*.ace 01;31 +*.zoo 01;31 +*.cpio 01;31 +*.7z 01;31 +*.rz 01;31 +*.cab 01;31 +*.wim 01;31 +*.swm 01;31 +*.dwm 01;31 +*.esd 01;31 + +# image formats (dircolors defaults) +*.jpg 01;35 +*.jpeg 01;35 +*.mjpg 01;35 +*.mjpeg 01;35 +*.gif 01;35 +*.bmp 01;35 +*.pbm 01;35 +*.pgm 01;35 +*.ppm 01;35 +*.tga 01;35 +*.xbm 01;35 +*.xpm 01;35 +*.tif 01;35 +*.tiff 01;35 +*.png 01;35 +*.svg 01;35 +*.svgz 01;35 +*.mng 01;35 +*.pcx 01;35 +*.mov 01;35 +*.mpg 01;35 +*.mpeg 01;35 +*.m2v 01;35 +*.mkv 01;35 +*.webm 01;35 +*.ogm 01;35 +*.mp4 01;35 +*.m4v 01;35 +*.mp4v 01;35 +*.vob 01;35 +*.qt 01;35 +*.nuv 01;35 +*.wmv 01;35 +*.asf 01;35 +*.rm 01;35 +*.rmvb 01;35 +*.flc 01;35 +*.avi 01;35 +*.fli 01;35 +*.flv 01;35 +*.gl 01;35 +*.dl 01;35 +*.xcf 01;35 +*.xwd 01;35 +*.yuv 01;35 +*.cgm 01;35 +*.emf 01;35 +*.ogv 01;35 +*.ogx 01;35 + +# audio formats (dircolors defaults) +*.aac 00;36 +*.au 00;36 +*.flac 00;36 +*.m4a 00;36 +*.mid 00;36 +*.midi 00;36 +*.mka 00;36 +*.mp3 00;36 +*.mpc 00;36 +*.ogg 00;36 +*.ra 00;36 +*.wav 00;36 +*.oga 00;36 +*.opus 00;36 +*.spx 00;36 +*.xspf 00;36 diff --git a/modules/home.legacy/conf/lf/commands/default.nix b/modules/home.legacy/conf/lf/commands/default.nix new file mode 100644 index 00000000..933769ac --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/default.nix @@ -0,0 +1,227 @@ +{ + pkgs, + sysLib, + shell_library, + system, + ... +}: let + functionCall = { + name, + dependencies, + replacementStrings, + ... + }: + sysLib.writeShellScript { + inherit name; + src = ./scripts/${name}.sh; + keepPath = true; + dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;}); + inherit replacementStrings; + } + + "/bin/${name}"; + + shell = { + name, + dependencies, + replacementStrings ? null, + ... + }: '' + ''${{ + ${functionCall {inherit name dependencies replacementStrings;}} + }} + ''; # closes the lf tui + pipe = { + name, + dependencies, + replacementStrings ? null, + ... + }: '' + %{{ + ${functionCall {inherit name dependencies replacementStrings;}} + }} + ''; # runs the command in the ui/term bar + async = { + name, + dependencies, + replacementStrings ? null, + ... + }: '' + &{{ + ${functionCall {inherit name dependencies replacementStrings;}} + }} + ''; # runs the command in the background + wait = { + name, + dependencies, + replacementStrings ? null, + ... + }: '' + !{{ + ${functionCall {inherit name dependencies replacementStrings;}} + }} + ''; # adds a prompt after the command has run +in { + archive = shell { + name = "archive"; + dependencies = builtins.attrValues { + inherit + (pkgs) + fzf + gnutar + xz + p7zip + zip + ; + }; + }; + broot_jump = shell { + name = "broot_jump"; + dependencies = builtins.attrValues { + inherit (pkgs) broot; + }; + }; + chmod = pipe { + name = "chmod"; + dependencies = []; + }; + clear_trash = shell { + name = "clear_trash"; + dependencies = builtins.attrValues { + inherit + (pkgs) + fzf + trashy + ; + }; + }; + dl_file = pipe { + name = "dl_file"; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + curl + ; + }; + }; + dragon = pipe { + name = "dragon"; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + ; + }; + }; + dragon_individual = pipe { + name = "dragon_individual"; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + ; + }; + }; + dragon_stay = pipe { + name = "dragon_stay"; + dependencies = builtins.attrValues { + inherit + (pkgs) + xdragon + ; + }; + }; + execute = shell { + name = "execute"; + dependencies = []; + }; + follow_link = pipe { + name = "follow_link"; + dependencies = with pkgs; [lf]; + }; + fzf_jump = shell { + name = "fzf_jump"; + dependencies = builtins.attrValues { + inherit (pkgs) fzf lf gnused; + }; + }; + mk_dir = pipe { + name = "mk_dir"; + dependencies = []; + }; + mk_file = shell { + name = "mk_file"; + dependencies = []; + }; + mk_file_and_edit = shell { + name = "mk_file_and_edit"; + dependencies = []; + }; + mk_ln = pipe { + name = "mk_ln"; + dependencies = []; + }; + mk_scr_default = shell { + name = "mk_scr_default"; + dependencies = builtins.attrValues {}; + replacementStrings = { + SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; + }; + }; + mk_scr_temp = shell { + name = "mk_scr_temp"; + dependencies = builtins.attrValues {}; + replacementStrings = { + SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; + TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive + }; + }; + view_file = async { + name = "view_file"; + dependencies = builtins.attrValues {inherit (pkgs) file;}; + }; + go_project_base_directory = async { + name = "go_project_root"; + dependencies = []; + }; + restore_trash = shell { + name = "restore_trash"; + dependencies = builtins.attrValues { + inherit + (pkgs) + fzf + trashy + ; + }; + }; + set_wall_paper = pipe { + name = "set_wall_paper"; + dependencies = []; + }; + stripspace = pipe { + name = "stripspace"; + dependencies = []; + }; + trash = pipe { + name = "trash"; + dependencies = builtins.attrValues { + inherit + (pkgs) + trashy + trash-cli + findutils + ; + }; + }; + unarchive = pipe { + name = "unarchive"; + dependencies = builtins.attrValues { + inherit + (pkgs) + gnutar + unzip + p7zip + ; + }; + }; +} diff --git a/modules/home.legacy/conf/lf/commands/scripts/archive.sh b/modules/home.legacy/conf/lf/commands/scripts/archive.sh new file mode 100755 index 00000000..25f40534 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/archive.sh @@ -0,0 +1,77 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# Option '-f' disables pathname expansion which can be useful when $f, $fs, and +# $fx variables contain names with '*' or '?' characters. However, this option +# is used selectively within individual commands as it can be limiting at +# times. +set -f + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" + +archivers="$(tmp echo gzip xz 7z zip)" +archiver="$(awk '{for (i=1; i<=NF; i++) print $i}' "$archivers" | fzf)" + +case "$archiver" in +"gzip") + ext=tar.gz + ;; +"xz") + ext=tar.xz + ;; +"7z") + ext=7z + ;; +"zip") + ext=zip + ;; +esac + +prompt "Archive name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name_base + name="$name_base.$ext" + if [ -e "$name" ]; then + prompt "Archive already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Archive name: " + fi + fi +done + +root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/"; fi)" + +# fx contains all selected file name separated by a newline +while read -r raw_file; do + file="$(echo "$raw_file" | sed "s|$root||")" + set -- "$@" "$file" +done <"$(tmp echo "$fx")" + +case "$archiver" in +"gzip") + tar --create --gzip -file="$name" "$@" + ;; +"xz") + tar --create --file="$name" "$@" + xz --compress -9 --extreme --threads=0 "$name" + ;; +"7z") + 7z a "$name" "$@" + ;; +"zip") + zip --symlinks -9 -r "$name" "$@" + ;; +esac +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/broot_jump.sh b/modules/home.legacy/conf/lf/commands/scripts/broot_jump.sh new file mode 100755 index 00000000..8f40ba01 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/broot_jump.sh @@ -0,0 +1,25 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +tmp=$(mktmp) +res="$(broot --outcmd "$tmp" && sed 's/cd //' "$tmp")" + +if [ -f "$res" ]; then + cmd="select" +elif [ -d "$res" ]; then + cmd="cd" +fi + +lf -remote "send '$id' '$cmd' '$res'" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/chmod.sh b/modules/home.legacy/conf/lf/commands/scripts/chmod.sh new file mode 100755 index 00000000..9859127b --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/chmod.sh @@ -0,0 +1,24 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +readp "Mode bits: " bits +# shellcheck disable=SC2269 +bits="$bits" + +while read -r file; do + chmod "$bits" "$file" +done <"$(tmp echo "$fx")" + +lf -remote 'send reload' +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/clear_trash.sh b/modules/home.legacy/conf/lf/commands/scripts/clear_trash.sh new file mode 100755 index 00000000..9052bb5f --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/clear_trash.sh @@ -0,0 +1,8 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# could also use --force, for instand removal +trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/cow_cp.sh b/modules/home.legacy/conf/lf/commands/scripts/cow_cp.sh new file mode 100755 index 00000000..98675b9e --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/cow_cp.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +# source: https://github.com/gokcehan/lf/wiki/Tips#use-copy-on-write-when-possible +# +# # FIXME: Add this. The hardest part is in checking, if a file can be reflinked, as fuse and bind mount are hard to +# backtrack <2023-08-29> + +# # This was very helpful for debugging: +# log_file="$HOME/lf-reflink-log-$(date +'%Y-%m-%d_%H-%M-%S')" +# [ -f "$log_file" ] || touch "$log_file" +# exec 1>> $log_file 2>&1 +# set -x + +# In theory, this may fail, +# but I tested it on selection with 10k files - everything worked (bash) +# FIXME: This will very likely fail on dash, when the file number > 255 <2023-08-29> +set -- "$(cat ~/.local/share/lf/files)" + +mode="$1" +shift + +if [ "$mode" = 'copy' ]; then + # Reflink if all items of selection and the destination are on the + # same mount point and it is CoW fs. + # (to make sure reflink never fails in first place, so we don't have to + # clean up) + + src_targets="$(df --output=target -- "$@" | sed '1d' | sort -u)" + + if [ "$(df --output=target -- "$PWD" | tail -n 1)" = \ + "$(echo "$src_targets" | tail -n 1)" ] && + (("$(echo "$src_targets" | wc -l)" == 1)) && + [[ "$(df --output=fstype -- "$PWD" | tail -n 1)" =~ ^(btrfs|xfs|zfs)$ ]]; then + + echo 'selected copy and cp reflink paste' + + start=$(date '+%s') + + # Handle same names in dst + # TODO parallelism, idk - but exit/return/break won't stop the loop from subshell... + for i in "$@"; do + name="${i##*/}" + original="$name" + + count=0 + while [ -w "$PWD/$name" ]; do + count=$((count + 1)) + name="$original.~$count~" + done + + set +e + cp_out="$(cp -rn --reflink=always -- "$i" "$PWD/$name" 2>&1)" + set -e + + if [ -n "$cp_out" ]; then + lf -remote "send $id echoerr $cp_out" + exit 0 + fi + done + + finish=$(($(date '+%s') - start)) + t='' + if ((finish > 2)); then + t="${finish}s" + fi + + # Or just skip a file when names are the same. + # (A LOT faster if you e.g. pasting selection of 10k files) + # cp -rn --reflink=always -- "$@" . + + lf -remote "send clear" + + green=$'\u001b[32m' + reset=$'\u001b[0m' + lf -remote "send $id echo ${green}reflinked!${reset} $t" + else + echo 'selected copy and lf native paste' + lf -remote "send $id paste" + lf -remote "send clear" + fi + +elif [ "$mode" = 'move' ]; then + echo 'selected move and lf native paste' + lf -remote "send $id paste" + lf -remote "send clear" +fi + +# # for debug +# set +x + +lf -remote "send load" + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/dl_file.sh b/modules/home.legacy/conf/lf/commands/scripts/dl_file.sh new file mode 100755 index 00000000..c7e3d8b2 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/dl_file.sh @@ -0,0 +1,43 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +# Provides the ability to download a file by dropping it into a window + +url="$(dragon -t -x)" + +if [ -n "$url" ]; then + prompt "File Name: " + name="" + while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "File Name: " + fi + fi + done + + # Download the file with curl + if [ -n "$name" ]; then + curl -o "$name" "$url" || die "curl failed" + fi +else + die "URL is null!" +fi +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/dragon.sh b/modules/home.legacy/conf/lf/commands/scripts/dragon.sh new file mode 100755 index 00000000..cf3c3176 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/dragon.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +while read -r file; do + set -- "$@" "$file" +done <"$(tmp echo "$fx")" + +dragon -a -x "$@" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/dragon_individual.sh b/modules/home.legacy/conf/lf/commands/scripts/dragon_individual.sh new file mode 100755 index 00000000..2465cdfa --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/dragon_individual.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +while read -r file; do + set -- "$@" "$file" +done <"$(tmp echo "$fx")" + +dragon "$@" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/dragon_stay.sh b/modules/home.legacy/conf/lf/commands/scripts/dragon_stay.sh new file mode 100755 index 00000000..066b4c75 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/dragon_stay.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +while read -r file; do + set -- "$@" "$file" +done <"$(tmp echo "$fx")" + +dragon -a "$@" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/execute.sh b/modules/home.legacy/conf/lf/commands/scripts/execute.sh new file mode 100755 index 00000000..aa97fd7f --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/execute.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +dir="$(realpath "$f")" + +"$dir" + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/follow_link.sh b/modules/home.legacy/conf/lf/commands/scripts/follow_link.sh new file mode 100755 index 00000000..80413990 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/follow_link.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +dir="$(realpath "$f")" + +lf -remote "send $id cd \"$dir\"" + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/fzf_jump.sh b/modules/home.legacy/conf/lf/commands/scripts/fzf_jump.sh new file mode 100755 index 00000000..ad1633fb --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/fzf_jump.sh @@ -0,0 +1,24 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +res="$(fd . --maxdepth 3 | fzf --header='Jump to location')" + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +if [ -f "$res" ]; then + cmd="select" +elif [ -d "$res" ]; then + cmd="cd" +fi + +lf -remote "send $id $cmd \"$res\"" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/go_project_root.sh b/modules/home.legacy/conf/lf/commands/scripts/go_project_root.sh new file mode 100755 index 00000000..5f7746d3 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/go_project_root.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +flake_base_dir="$(search_flake_base_dir)" +if [ "$flake_base_dir" ]; then + lf -remote "send $id cd $flake_base_dir" || die "Bug: No base dir ($flake_base_dir)" +else + die "Unable to locate base dir" +fi + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/mk_dir.sh b/modules/home.legacy/conf/lf/commands/scripts/mk_dir.sh new file mode 100755 index 00000000..150f7eed --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/mk_dir.sh @@ -0,0 +1,32 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +prompt "Directory Name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "Directory already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Directory Name: " + fi + fi +done + +mkdir "$name" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/mk_file.sh b/modules/home.legacy/conf/lf/commands/scripts/mk_file.sh new file mode 100755 index 00000000..41d5cf1a --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/mk_file.sh @@ -0,0 +1,32 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +prompt "File name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "File name: " + fi + fi +done + +touch "$name" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/mk_file_and_edit.sh b/modules/home.legacy/conf/lf/commands/scripts/mk_file_and_edit.sh new file mode 100755 index 00000000..19fc51db --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/mk_file_and_edit.sh @@ -0,0 +1,33 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +prompt "File name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "File already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "File name: " + fi + fi +done + +touch "$name" +"$EDITOR" "$name" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/mk_ln.sh b/modules/home.legacy/conf/lf/commands/scripts/mk_ln.sh new file mode 100755 index 00000000..7fab8e22 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/mk_ln.sh @@ -0,0 +1,45 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +while IFS= read -r i; do + set -- "$@" "$i" +done <"$HOME"/.local/share/lf/files + +mode="$1" +shift + +if [ "$#" -eq 0 ]; then + msg "no files to link" + exit 0 +fi + +case "$mode" in +copy) + while [ "$#" -gt 0 ]; do + file="$1" + ans="$(basename "$file")" + + while [ -e "$ans" ]; do + prompt "$ans already exists, new name for link: " + read -r ans + done + + ln --symbolic --relative "$file" "$(pwd)/$ans" + shift + done + ;; +esac +rm ~/.local/share/lf/files +# lf -remote "send clear" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/mk_scr_default.sh b/modules/home.legacy/conf/lf/commands/scripts/mk_scr_default.sh new file mode 100755 index 00000000..47d05080 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/mk_scr_default.sh @@ -0,0 +1,38 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +prompt "Script name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name_base + name="$name_base.sh" + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi + fi +done + +script="$(pwd)"/"$name" + +cat "%SHELL_LIBRARY_TEMPLATE" >"$script" +chmod +x "$script" +"$VISUAL" "$script" + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/mk_scr_temp.sh b/modules/home.legacy/conf/lf/commands/scripts/mk_scr_temp.sh new file mode 100755 index 00000000..512b5d0b --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/mk_scr_temp.sh @@ -0,0 +1,38 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +prompt "Script name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name + if [ -e "$name" ]; then + prompt "Script already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "Script Name: " + fi + fi +done + +script="$(pwd)"/"$name" + +sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" >"$script" +sed -i 's|dash|sh|' "$script" +chmod +x "$script" +"$VISUAL" "$script" + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/restore_trash.sh b/modules/home.legacy/conf/lf/commands/scripts/restore_trash.sh new file mode 100755 index 00000000..b4ef492f --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/restore_trash.sh @@ -0,0 +1,16 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/set_wall_paper.sh b/modules/home.legacy/conf/lf/commands/scripts/set_wall_paper.sh new file mode 100755 index 00000000..2e607d33 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/set_wall_paper.sh @@ -0,0 +1,19 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +die "No yet implemented" # TODO: do what the 'die' says +#sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv +#nohub swaybg -i "$f" +#feh --bg-max --no-fehbg "$f" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/stripspace.sh b/modules/home.legacy/conf/lf/commands/scripts/stripspace.sh new file mode 100755 index 00000000..33b1cbcf --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/stripspace.sh @@ -0,0 +1,40 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +files=$(mktmp) +echo "$fx" >"$files" + +awk_source=$(mktmp) +cat <<OFT >"$awk_source" +BEGIN {FS=" "} +{for (i=1; i != NF + 1; i++) + if (i == NF) { + parts[i]=tolower(\$i); + } else { + parts[i]=tolower(\$i"_"); + } +} +END {for (i in parts) printf parts[i]} +OFT + +while read -r file; do + dirty_name=$(mktmp) + basename "$file" >"$dirty_name" + clean_name=$(awk -f "$awk_source" "$dirty_name") + + [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!" + mv "$(cat "$dirty_name")" "$clean_name" || die "Move failed" + lf -remote 'send reload' +done <"$files" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/trash.sh b/modules/home.legacy/conf/lf/commands/scripts/trash.sh new file mode 100755 index 00000000..f4878c49 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/trash.sh @@ -0,0 +1,37 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +trash_output=$(mktmp) +expected_error_output=$(mktmp) + +while read -r file; do + set -- "$@" "$file" +done <"$(tmp echo "$fx")" + +# TODO: why are we using trashy at all, when trash-cli can do everything? +# +# try trashy first, through nix because both trashy and trash-cli provide a trash command, which conflicts +nix run nixpkgs#trashy -- put "$@" 2>"$trash_output" + +# FIXME: Find a way, that does not depend on parsing an error message <2023-08-29> +cat <<EOF >"$expected_error_output" +[1;31merror:[0m Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" } +EOF + +if [ "$(cat "$expected_error_output")" = "$(cat "$trash_output")" ]; then + warning "Deleting with trash-cli to the /.Trash folder" + # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this + trash-put "$@" +fi +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/unarchive.sh b/modules/home.legacy/conf/lf/commands/scripts/unarchive.sh new file mode 100755 index 00000000..d4835f6b --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/unarchive.sh @@ -0,0 +1,36 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +# extract the current file with the right command +# (xkcd link: https://xkcd.com/1168/) +set -f + +unarchive() { + case "$1" in + *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar xjvf "$1" ;; + *.tar.gz | *.tgz) tar xzvf "$1" ;; + *.tar.xz | *.txz) tar xJvf "$1" ;; + *.zip) unzip "$1" ;; + *.rar) + die "rar is a unfree format!" + ;; + *.7z) 7z x "$1" ;; + *) die "Unsupported format" ;; + esac +} + +while read -r file; do + unarchive "$file" +done <"$fx" +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/commands/scripts/view_file.sh b/modules/home.legacy/conf/lf/commands/scripts/view_file.sh new file mode 100755 index 00000000..6258d755 --- /dev/null +++ b/modules/home.legacy/conf/lf/commands/scripts/view_file.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" + +mime_type="$(file --mime-type --brief --dereference "$f")" +case "$mime_type" in +application/pdf) + "$READER" "$f" + ;; +image/*) + "$IVIEWER" "$f" + ;; +*) + die "Mime-Type: '$mime_type' not supported" + ;; +esac + +# vim: ft=sh diff --git a/modules/home.legacy/conf/lf/default.nix b/modules/home.legacy/conf/lf/default.nix new file mode 100644 index 00000000..7b604ed0 --- /dev/null +++ b/modules/home.legacy/conf/lf/default.nix @@ -0,0 +1,59 @@ +{ + pkgs, + sysLib, + nixosConfig, + shell_library, + system, + ... +}: let + commands = import ./commands {inherit pkgs sysLib shell_library system;}; + keybindings = import ./keybindings {inherit nixosConfig;}; +in { + xdg.configFile."lf/icons".source = ./icons; + xdg.configFile."lf/colors".source = ./colors; + + # TODO: add the systemd tempfile option here + + programs.lf = { + enable = true; + + inherit commands keybindings; + + previewer = { + keybinding = "i"; + source = "${pkgs.ctpv}/bin/ctpv"; + }; + settings = { + # close the server, after the last client exits + autoquit = true; + + # disable the cusor in the preview pane + cursorpreviewfmt = ""; + + # preview for directories + # dirpreviews = true; + + # count things in directories + dircounts = true; + + drawbox = true; + + # errorfmt = "\\033[1;91m==> ERROR:\\033[0m\\033[1;93m%s\\033[0m"; + errorfmt = "\\033[1;91m%s\\033[0m"; + hidden = true; # show hidden files + icons = true; + ifs = "\\n"; # internal field separator for shell commands + #info = "size"; # show the size of a directory + shell = "sh"; + shellopts = "-eu"; # e: exit on error; u: error for unset variables + }; + # TODO: remove auto quit, if it has been added + extraConfig = '' + &${pkgs.ctpv}/bin/ctpv -s $id + cmd on-quit %${pkgs.ctpv}/bin/ctpv -e $id + set cleaner ${pkgs.ctpv}/bin/ctpvclear + + source ${nixosConfig.age.secrets.lf_cd_paths.path} + ''; + }; +} diff --git a/modules/home.legacy/conf/lf/icons b/modules/home.legacy/conf/lf/icons new file mode 100644 index 00000000..9047fbfb --- /dev/null +++ b/modules/home.legacy/conf/lf/icons @@ -0,0 +1,360 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# default values from lf (with matching order) +# ln l # LINK +# or l # ORPHAN +# tw t # STICKY_OTHER_WRITABLE +# ow d # OTHER_WRITABLE +# st t # STICKY +# di d # DIR +# pi p # FIFO +# so s # SOCK +# bd b # BLK +# cd c # CHR +# su u # SETUID +# sg g # SETGID +# ex x # EXEC +# fi - # FILE + +# file types (with matching order) +ln # LINK +or # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow # OTHER_WRITABLE +st t # STICKY +di # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex # EXEC +fi # FILE + +# file extensions (vim-devicons) +*.styl +*.sass +*.scss +*.htm +*.html +*.slim +*.haml +*.ejs +*.css +*.less +*.md +*.mdx +*.markdown +*.rmd +*.json +*.webmanifest +*.js +*.mjs +*.jsx +*.rb +*.gemspec +*.rake +*.php +*.py +*.pyc +*.pyo +*.pyd +*.coffee +*.mustache +*.hbs +*.conf +*.ini +*.yml +*.yaml +*.toml +*.bat +*.mk +*.jpg +*.jpeg +*.bmp +*.png +*.webp +*.gif +*.ico +*.twig +*.cpp +*.c++ +*.cxx +*.cc +*.cp +*.c +*.cs +*.h +*.hh +*.hpp +*.hxx +*.hs +*.lhs +*.nix +*.lua +*.java +*.sh +*.fish +*.bash +*.zsh +*.ksh +*.csh +*.awk +*.ps1 +*.ml λ +*.mli λ +*.diff +*.db +*.sql +*.sqlite +*.dump +*.clj +*.cljc +*.cljs +*.edn +*.scala +*.go +*.dart +*.xul +*.sln +*.suo +*.pl +*.pm +*.t +*.rss +'*.f#' +*.fsscript +*.fsx +*.fs +*.fsi +*.rs +*.rlib +*.d +*.erl +*.hrl +*.ex +*.exs +*.eex +*.leex +*.heex +*.vim +*.ai +*.psd +*.psb +*.ts +*.tsx +*.jl +*.pp +*.vue +*.elm +*.swift +*.xcplayground +*.tex +*.r +*.rproj +*.sol +*.pem + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee +*gruntfile.js +*gruntfile.ls +*gulpfile.coffee +*gulpfile.js +*gulpfile.ls +*mix.lock +*dropbox +*.ds_store +*.gitconfig +*.gitignore +*.gitattributes +*.gitlab-ci.yml +*.bashrc +*.zshrc +*.zshenv +*.zprofile +*.vimrc +*.gvimrc +*_vimrc +*_gvimrc +*.bashprofile +*favicon.ico +*license +*node_modules +*react.jsx +*procfile +*dockerfile +*docker-compose.yml +*rakefile +*config.ru +*gemfile +*makefile +*cmakelists.txt +*robots.txt + +# file names (case-sensitive adaptations) +*Gruntfile.coffee +*Gruntfile.js +*Gruntfile.ls +*Gulpfile.coffee +*Gulpfile.js +*Gulpfile.ls +*Dropbox +*.DS_Store +*LICENSE +*COPYING +*COPYING.LESSER +*React.jsx +*Procfile +*Dockerfile +*Docker-compose.yml +*Rakefile +*Gemfile +*Makefile +*CMakeLists.txt + +# file patterns (vim-devicons) (patterns not supported in lf) +# .*jquery.*\.js$ +# .*angular.*\.js$ +# .*backbone.*\.js$ +# .*require.*\.js$ +# .*materialize.*\.js$ +# .*materialize.*\.css$ +# .*mootools.*\.js$ +# .*vimrc.* +# Vagrantfile$ + +# file patterns (file name adaptations) +*jquery.min.js +*angular.min.js +*backbone.min.js +*require.min.js +*materialize.min.js +*materialize.min.css +*mootools.min.js +*vimrc +Vagrantfile + +# archives or compressed (extensions from dircolors defaults) +*.tar +*.tgz +*.arc +*.arj +*.taz +*.lha +*.lz4 +*.lzh +*.lzma +*.tlz +*.txz +*.tzo +*.t7z +*.zip +*.z +*.dz +*.gz +*.lrz +*.lz +*.lzo +*.xz +*.zst +*.tzst +*.bz2 +*.bz +*.tbz +*.tbz2 +*.tz +*.deb +*.rpm +*.jar +*.war +*.ear +*.sar +*.rar +*.alz +*.ace +*.zoo +*.cpio +*.7z +*.rz +*.cab +*.wim +*.swm +*.dwm +*.esd + +# image formats (extensions from dircolors defaults) +*.jpg +*.jpeg +*.mjpg +*.mjpeg +*.gif +*.bmp +*.pbm +*.pgm +*.ppm +*.tga +*.xbm +*.xpm +*.tif +*.tiff +*.png +*.svg +*.svgz +*.mng +*.pcx +*.mov +*.mpg +*.mpeg +*.m2v +*.mkv +*.webm +*.ogm +*.mp4 +*.m4v +*.mp4v +*.vob +*.qt +*.nuv +*.wmv +*.asf +*.rm +*.rmvb +*.flc +*.avi +*.fli +*.flv +*.gl +*.dl +*.xcf +*.xwd +*.yuv +*.cgm +*.emf +*.ogv +*.ogx + +# audio formats (extensions from dircolors defaults) +*.aac +*.au +*.flac +*.m4a +*.mid +*.midi +*.mka +*.mp3 +*.mpc +*.ogg +*.ra +*.wav +*.oga +*.opus +*.spx +*.xspf + +# other formats +*.pdf diff --git a/modules/home.legacy/conf/lf/keybindings/default.nix b/modules/home.legacy/conf/lf/keybindings/default.nix new file mode 100644 index 00000000..b41004dc --- /dev/null +++ b/modules/home.legacy/conf/lf/keybindings/default.nix @@ -0,0 +1,94 @@ +{nixosConfig, ...}: { + # Remove some defaults + "'\"'" = null; + ";" = null; + "\"'\"" = null; + c = null; + d = null; + e = null; + j = null; + k = null; + m = null; + f = null; + + # Sorting + kn = ":set sortby natural; set info"; + ks = ":set sortby size; set info size"; + kt = ":set sortby time; set info time"; + ka = ":set sortby atime; set info atime"; + kc = ":set sortby ctime; set info ctime"; + ke = ":set sortby ext; set info"; + + # Searching + l = "search-next"; + L = "search-prev"; + + # File Openers + ee = "\$\$EDITOR \"$f\""; + es = "\$ nvim -S \"$f\""; + u = "view_file"; + cc = "\$sudo -e \"$f\""; + fe = "execute"; + fl = "follow_link"; + + # Archive Mappings + au = "unarchive"; + aa = "archive"; + + # Trash Mappings + dd = "trash"; + jc = "clear_trash"; + jr = "restore_trash"; + + # Dragon Mapping + dr = "dragon"; + ds = "dragon-stay"; + di = "dragon-individual"; + #dm = "mvdragon"; + #dc = "cpdragon"; + dl = "dlfile"; + + cs = "stripspace"; + + # Vim keys + h = "updir"; + t = "down"; + n = "up"; + s = "open"; + + # Basic Functions + "." = "set hidden!"; + DD = "delete"; + p = "paste"; + x = "cut"; + y = "copy"; + "<enter>" = "open"; + + mk = "mk_ln"; + mf = "mk_file"; + me = "mk_file_and_edit"; + md = "mk_dir"; + ms = "mk_scr_default"; + mt = "mk_scr_temp"; + + ch = "chmod"; + bg = "set_wall_paper"; + r = ":rename; cmd-end"; + H = "go_project_base_directory"; + R = "reload"; + C = "clear"; + U = "unselect"; + + # Movement + gjr = "cd ~/.local/share/Trash/files"; + gus = "cd /run/user/${builtins.toString nixosConfig.users.users.soispha.uid}"; + + gc = "cd ~/.config"; + gl = "cd ~/.local"; + gE = "cd /etc"; + + "gU." = "cd /usr"; + gUs = " cd /usr/share"; + + gt = "cd /tmp"; +} |