···11+# This is `bat`s configuration file. Each line either contains a comment or
22+# a command-line option that you want to pass to `bat` by default. You can
33+# run `bat --help` to get a list of all possible configuration options.
44+55+# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
66+# for a list of all available themes
77+--theme="TwoDark"
88+99+# Enable this to use italic text on the terminal. This is not supported on all
1010+# terminal emulators (like tmux, by default):
1111+#--italic-text=always
1212+1313+# Uncomment the following line to disable automatic paging:
1414+#--paging=never
1515+1616+# Uncomment the following line if you are using less version >= 551 and want to
1717+# enable mouse scrolling support in `bat` when running inside tmux. This might
1818+# disable text selection, unless you press shift.
1919+#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
2020+2121+# Syntax mappings: map a certain filename pattern to a language.
2222+# Example 1: use the C++ syntax for Arduino .ino files
2323+# Example 2: Use ".gitignore"-style highlighting for ".ignore" files
2424+--map-syntax "*.ino:C++"
2525+#--map-syntax ".ignore:Git Ignore"
···11+complete --command nvm --exclusive --long version --description "Print version"
22+complete --command nvm --exclusive --long help --description "Print help"
33+44+complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version"
55+complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate a version in the current shell"
66+complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed versions"
77+complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List versions available to install matching optional regex"
88+complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active version"
99+complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "(
1010+ test -e $nvm_data && string split ' ' <$nvm_data/.index
1111+)"
1212+complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')"
1313+complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall a version"
1414+complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "(
1515+ _nvm_list | string split ' ' | string replace system ''
1616+)"
1717+complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use uninstall" --arguments "(
1818+ set --query nvm_default_version && echo default
1919+)"
+28
fish/conf.d/nvm.fish
···11+function _nvm_install --on-event nvm_install
22+ set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
33+ set --universal nvm_data $XDG_DATA_HOME/nvm
44+ set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
55+66+ test ! -d $nvm_data && command mkdir -p $nvm_data
77+ echo "Downloading the Node distribution index..." 2>/dev/null
88+ _nvm_index_update $nvm_mirror $nvm_data/.index
99+end
1010+1111+function _nvm_update --on-event nvm_update
1212+ set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
1313+ set --universal nvm_data $XDG_DATA_HOME/nvm
1414+ set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
1515+end
1616+1717+function _nvm_uninstall --on-event nvm_uninstall
1818+ command rm -rf $nvm_data
1919+2020+ set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
2121+2222+ set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source
2323+ functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
2424+end
2525+2626+if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
2727+ nvm use $nvm_default_version >/dev/null
2828+end
+23
fish/config.fish
···11+if status is-interactive
22+ # Commands to run in interactive sessions can go here
33+ starship init fish | source
44+ zoxide init fish | source
55+66+ # Aliases
77+ alias ls="exa"
88+ alias lt="exa -T"
99+ alias lT="exa -Tlh --no-user --no-time"
1010+ alias ll="exa -lh --no-user"
1111+ alias la="exa -lha --git --no-user"
1212+1313+ # Global Variables
1414+1515+ # Languages
1616+ ## Go
1717+ set -x GOROOT "$(brew --prefix golang)/libexec"
1818+ set -x GOPATH $HOME/go
1919+ set -x PATH $PATH $GOROOT/bin $GOPATH/bin
2020+2121+ ## Flutter
2222+ set -x PATH $PATH "/opt/homebrew/Caskroom/flutter/2.10.4/flutter/bin"
2323+end
···11+function _nvm_list
22+ set --local versions $nvm_data/*
33+ set --query versions[1] &&
44+ string match --entire --regex -- (string match --regex -- "v\d.+" $versions |
55+ string escape --style=regex |
66+ string join "|"
77+ ) <$nvm_data/.index
88+99+ command --all node |
1010+ string match --quiet --invert --regex -- "^$nvm_data" && echo system
1111+end
+4
fish/functions/_nvm_version_activate.fish
···11+function _nvm_version_activate --argument-names v
22+ set --global --export nvm_current_version $v
33+ set --prepend PATH $nvm_data/$v/bin
44+end
+5
fish/functions/_nvm_version_deactivate.fish
···11+function _nvm_version_deactivate --argument-names v
22+ test "$nvm_current_version" = "$v" && set --erase nvm_current_version
33+ set --local index (contains --index -- $nvm_data/$v/bin $PATH) &&
44+ set --erase PATH[$index]
55+end
+212
fish/functions/fisher.fish
···11+function fisher --argument-names cmd --description "A plugin manager for Fish"
22+ set --query fisher_path || set --local fisher_path $__fish_config_dir
33+ set --local fisher_version 4.3.1
44+ set --local fish_plugins $__fish_config_dir/fish_plugins
55+66+ switch "$cmd"
77+ case -v --version
88+ echo "fisher, version $fisher_version"
99+ case "" -h --help
1010+ echo "Usage: fisher install <plugins...> Install plugins"
1111+ echo " fisher remove <plugins...> Remove installed plugins"
1212+ echo " fisher update <plugins...> Update installed plugins"
1313+ echo " fisher update Update all installed plugins"
1414+ echo " fisher list [<regex>] List installed plugins matching regex"
1515+ echo "Options:"
1616+ echo " -v or --version Print version"
1717+ echo " -h or --help Print this help message"
1818+ echo "Variables:"
1919+ echo " \$fisher_path Plugin installation path. Default: ~/.config/fish"
2020+ case ls list
2121+ string match --entire --regex -- "$argv[2]" $_fisher_plugins
2222+ case install update remove
2323+ isatty || read --local --null --array stdin && set --append argv $stdin
2424+2525+ set --local install_plugins
2626+ set --local update_plugins
2727+ set --local remove_plugins
2828+ set --local arg_plugins $argv[2..-1]
2929+ set --local old_plugins $_fisher_plugins
3030+ set --local new_plugins
3131+3232+ if ! set --query argv[2]
3333+ if test "$cmd" != update
3434+ echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
3535+ else if test ! -e $fish_plugins
3636+ echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
3737+ end
3838+ set arg_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
3939+ end
4040+4141+ for plugin in $arg_plugins
4242+ test -e "$plugin" && set plugin (realpath $plugin)
4343+ contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
4444+ end
4545+4646+ if set --query argv[2]
4747+ for plugin in $new_plugins
4848+ if contains -- "$plugin" $old_plugins
4949+ test "$cmd" = remove &&
5050+ set --append remove_plugins $plugin ||
5151+ set --append update_plugins $plugin
5252+ else if test "$cmd" = install
5353+ set --append install_plugins $plugin
5454+ else
5555+ echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
5656+ end
5757+ end
5858+ else
5959+ for plugin in $new_plugins
6060+ contains -- "$plugin" $old_plugins &&
6161+ set --append update_plugins $plugin ||
6262+ set --append install_plugins $plugin
6363+ end
6464+6565+ for plugin in $old_plugins
6666+ contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
6767+ end
6868+ end
6969+7070+ set --local pid_list
7171+ set --local source_plugins
7272+ set --local fetch_plugins $update_plugins $install_plugins
7373+ echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
7474+7575+ for plugin in $fetch_plugins
7676+ set --local source (command mktemp -d)
7777+ set --append source_plugins $source
7878+7979+ command mkdir -p $source/{completions,conf.d,functions}
8080+8181+ fish --command "
8282+ if test -e $plugin
8383+ command cp -Rf $plugin/* $source
8484+ else
8585+ set temp (command mktemp -d)
8686+ set name (string split \@ $plugin) || set name[2] HEAD
8787+ set url https://api.github.com/repos/\$name[1]/tarball/\$name[2]
8888+ set header 'Accept: application/vnd.github.v3+json'
8989+9090+ echo Fetching (set_color --underline)\$url(set_color normal)
9191+9292+ if curl --silent -L -H \$header \$url | tar -xzC \$temp -f - 2>/dev/null
9393+ command cp -Rf \$temp/*/* $source
9494+ else
9595+ echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
9696+ command rm -rf $source
9797+ end
9898+ command rm -rf \$temp
9999+ end
100100+101101+ set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
102102+ " &
103103+104104+ set --append pid_list (jobs --last --pid)
105105+ end
106106+107107+ wait $pid_list 2>/dev/null
108108+109109+ for plugin in $fetch_plugins
110110+ if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
111111+ if set --local index (contains --index -- "$plugin" $install_plugins)
112112+ set --erase install_plugins[$index]
113113+ else
114114+ set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
115115+ end
116116+ end
117117+ end
118118+119119+ for plugin in $update_plugins $remove_plugins
120120+ if set --local index (contains --index -- "$plugin" $_fisher_plugins)
121121+ set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
122122+123123+ if contains -- "$plugin" $remove_plugins
124124+ for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
125125+ emit {$name}_uninstall
126126+ end
127127+ printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var
128128+ end
129129+130130+ command rm -rf $$plugin_files_var
131131+ functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
132132+133133+ for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
134134+ complete --erase --command $name
135135+ end
136136+137137+ set --erase _fisher_plugins[$index]
138138+ set --erase $plugin_files_var
139139+ end
140140+ end
141141+142142+ if set --query update_plugins[1] || set --query install_plugins[1]
143143+ command mkdir -p $fisher_path/{functions,conf.d,completions}
144144+ end
145145+146146+ for plugin in $update_plugins $install_plugins
147147+ set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
148148+ set --local files $source/{functions,conf.d,completions}/*
149149+150150+ if set --local index (contains --index -- $plugin $install_plugins)
151151+ set --local user_files $fisher_path/{functions,conf.d,completions}/*
152152+ set --local conflict_files
153153+154154+ for file in (string replace -- $source/ $fisher_path/ $files)
155155+ contains -- $file $user_files && set --append conflict_files $file
156156+ end
157157+158158+ if set --query conflict_files[1] && set --erase install_plugins[$index]
159159+ echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
160160+ continue
161161+ end
162162+ end
163163+164164+ for file in (string replace -- $source/ "" $files)
165165+ command cp -Rf $source/$file $fisher_path/$file
166166+ end
167167+168168+ set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
169169+ set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files)
170170+171171+ contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
172172+ contains -- $plugin $install_plugins && set --local event install || set --local event update
173173+174174+ printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var
175175+176176+ for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var)
177177+ source $file
178178+ if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
179179+ emit {$name}_$event
180180+ end
181181+ end
182182+ end
183183+184184+ command rm -rf $source_plugins
185185+186186+ set --query _fisher_plugins[1] || set --erase _fisher_plugins
187187+ set --query _fisher_plugins &&
188188+ printf "%s\n" $_fisher_plugins >$fish_plugins ||
189189+ command rm -f $fish_plugins
190190+191191+ set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
192192+ test "$total" != "0 0 0" && echo (string join ", " (
193193+ test $total[1] = 0 || echo "Installed $total[1]") (
194194+ test $total[2] = 0 || echo "Updated $total[2]") (
195195+ test $total[3] = 0 || echo "Removed $total[3]")
196196+ ) plugin/s
197197+ case \*
198198+ echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
199199+ end
200200+end
201201+202202+## Migrations ##
203203+function _fisher_fish_postexec --on-event fish_postexec
204204+ if functions --query _fisher_list
205205+ fisher update >/dev/null 2>/dev/null
206206+ set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
207207+ test -e $XDG_DATA_HOME/fisher && command rm -rf $XDG_DATA_HOME/fisher
208208+ functions --erase _fisher_list _fisher_plugin_parse
209209+ set --erase fisher_data
210210+ end
211211+ functions --erase _fisher_fish_postexec
212212+end
+208
fish/functions/nvm.fish
···11+function nvm --argument-names cmd v --description "Node version manager"
22+ if test -z "$v" && contains -- "$cmd" install use
33+ for file in .nvmrc .node-version
44+ set file (_nvm_find_up $PWD $file) && read v <$file && break
55+ end
66+ if test -z "$v"
77+ echo "nvm: Invalid version or missing \".nvmrc\" file" >&2
88+ return 1
99+ end
1010+ end
1111+1212+ set --local their_version $v
1313+1414+ switch "$cmd"
1515+ case -v --version
1616+ echo "nvm, version 2.2.7"
1717+ case "" -h --help
1818+ echo "Usage: nvm install <version> Download and activate the specified Node version"
1919+ echo " nvm install Install version from nearest .nvmrc file"
2020+ echo " nvm use <version> Activate a version in the current shell"
2121+ echo " nvm use Activate version from nearest .nvmrc file"
2222+ echo " nvm list List installed versions"
2323+ echo " nvm list-remote List versions available to install"
2424+ echo " nvm list-remote <regex> List versions matching a given regular expression"
2525+ echo " nvm current Print the currently-active version"
2626+ echo " nvm uninstall <version> Uninstall a version"
2727+ echo "Options:"
2828+ echo " -v or --version Print version"
2929+ echo " -h or --help Print this help message"
3030+ echo "Variables:"
3131+ echo " nvm_arch Override architecture, e.g. x64-musl"
3232+ echo " nvm_mirror Set the Node download mirror"
3333+ echo " nvm_default_version Set the default version for new shells"
3434+ case install
3535+ _nvm_index_update $nvm_mirror $nvm_data/.index || return
3636+3737+ string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias
3838+3939+ if ! set --query v[1]
4040+ echo "nvm: Invalid version number or alias: \"$their_version\"" >&2
4141+ return 1
4242+ end
4343+4444+ if test ! -e $nvm_data/$v
4545+ set --local os (command uname -s | string lower)
4646+ set --local ext tar.gz
4747+ set --local arch (command uname -m)
4848+4949+ switch $os
5050+ case aix
5151+ set arch ppc64
5252+ case sunos
5353+ case linux
5454+ case darwin
5555+ case {MSYS_NT,MINGW\*_NT}\*
5656+ set os win
5757+ set ext zip
5858+ case \*
5959+ echo "nvm: Unsupported operating system: \"$os\"" >&2
6060+ return 1
6161+ end
6262+6363+ switch $arch
6464+ case i\*86
6565+ set arch x86
6666+ case x86_64
6767+ set arch x64
6868+ case arm64
6969+ string match --regex --quiet "v(?<major>\d+)" $v
7070+ if test "$os" = darwin -a $major -lt 16
7171+ set arch x64
7272+ end
7373+ case armv6 armv6l
7474+ set arch armv6l
7575+ case armv7 armv7l
7676+ set arch armv7l
7777+ case armv8 armv8l aarch64
7878+ set arch arm64
7979+ end
8080+8181+ set --query nvm_arch && set arch $nvm_arch
8282+8383+ set --local dir "node-$v-$os-$arch"
8484+ set --local url $nvm_mirror/$v/$dir.$ext
8585+8686+ command mkdir -p $nvm_data/$v
8787+8888+ echo -e "Installing Node \x1b[1m$v\x1b[22m $alias"
8989+ echo -e "Fetching \x1b[4m$url\x1b[24m\x1b[7m"
9090+9191+ if ! command curl --progress-bar --location $url \
9292+ | command tar --extract --gzip --directory $nvm_data/$v 2>/dev/null
9393+ command rm -rf $nvm_data/$v
9494+ echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2
9595+ return 1
9696+ end
9797+9898+ echo -en "\033[F\33[2K\x1b[0m"
9999+100100+ if test "$os" = win
101101+ command mv $nvm_data/$v/$dir $nvm_data/$v/bin
102102+ else
103103+ command mv $nvm_data/$v/$dir/* $nvm_data/$v
104104+ command rm -rf $nvm_data/$v/$dir
105105+ end
106106+ end
107107+108108+ if test $v != "$nvm_current_version"
109109+ set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
110110+ _nvm_version_activate $v
111111+ end
112112+113113+ printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
114114+ case use
115115+ test $v = default && set v $nvm_default_version
116116+ _nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
117117+118118+ if ! set --query v[1]
119119+ echo "nvm: Can't use Node \"$their_version\", version must be installed first" >&2
120120+ return 1
121121+ end
122122+123123+ if test $v != "$nvm_current_version"
124124+ set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
125125+ test $v != system && _nvm_version_activate $v
126126+ end
127127+128128+ printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
129129+ case uninstall
130130+ if test -z "$v"
131131+ echo "nvm: Not enough arguments for command: \"$cmd\"" >&2
132132+ return 1
133133+ end
134134+135135+ test $v = default && test ! -z "$nvm_default_version" && set v $nvm_default_version
136136+137137+ _nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
138138+139139+ if ! set -q v[1]
140140+ echo "nvm: Node version not installed or invalid: \"$their_version\"" >&2
141141+ return 1
142142+ end
143143+144144+ printf "Uninstalling Node %s %s\n" $v (string replace ~ \~ "$nvm_data/$v/bin/node")
145145+146146+ _nvm_version_deactivate $v
147147+148148+ command rm -rf $nvm_data/$v
149149+ case current
150150+ _nvm_current
151151+ case ls list
152152+ _nvm_list | _nvm_list_format (_nvm_current) $argv[2]
153153+ case lsr {ls,list}-remote
154154+ _nvm_index_update $nvm_mirror $nvm_data/.index || return
155155+ _nvm_list | command awk '
156156+ FILENAME == "-" && (is_local[$1] = FNR == NR) { next } {
157157+ print $0 (is_local[$1] ? " ✓" : "")
158158+ }
159159+ ' - $nvm_data/.index | _nvm_list_format (_nvm_current) $argv[2]
160160+ case \*
161161+ echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h)" >&2
162162+ return 1
163163+ end
164164+end
165165+166166+function _nvm_find_up --argument-names path file
167167+ test -e "$path/$file" && echo $path/$file || begin
168168+ test "$path" != / || return
169169+ _nvm_find_up (command dirname $path) $file
170170+ end
171171+end
172172+173173+function _nvm_version_match --argument-names v
174174+ string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $v |
175175+ string replace --filter --regex -- '^v?(\d+)' 'v$1' |
176176+ string escape --style=regex ||
177177+ string lower '\b'$v'(?:/\w+)?$'
178178+end
179179+180180+function _nvm_list_format --argument-names current regex
181181+ command awk -v current="$current" -v regex="$regex" '
182182+ $0 ~ regex {
183183+ aliases[versions[i++] = $1] = $2 " " $3
184184+ pad = (n = length($1)) > pad ? n : pad
185185+ }
186186+ END {
187187+ if (!i) exit 1
188188+ while (i--)
189189+ printf((current == versions[i] ? " ▶ " : " ") "%"pad"s %s\n",
190190+ versions[i], aliases[versions[i]])
191191+ }
192192+ '
193193+end
194194+195195+function _nvm_current
196196+ command --search --quiet node || return
197197+ set --query nvm_current_version && echo $nvm_current_version || echo system
198198+end
199199+200200+function _nvm_node_info
201201+ set --local npm_path (string replace bin/npm-cli.js "" (realpath (command --search npm)))
202202+ test -f $npm_path/package.json || set --local npm_version_default (command npm --version)
203203+ command node --eval "
204204+ console.log(process.version)
205205+ console.log('$npm_version_default' ? '$npm_version_default': require('$npm_path/package.json').version)
206206+ console.log(process.execPath.replace(require('os').homedir(), '~'))
207207+ "
208208+end
+103
lf/lfrc
···11+# interpreter for shell commands
22+set shell sh
33+44+# set '-eu' options for shell commands
55+# These options are used to have safer shell commands. Option '-e' is used to
66+# exit on error and option '-u' is used to give error for unset variables.
77+# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
88+# $fx variables contain names with '*' or '?' characters. However, this option
99+# is used selectively within individual commands as it can be limiting at
1010+# times.
1111+set shellopts '-eu'
1212+1313+# set internal field separator (IFS) to "\n" for shell commands
1414+# This is useful to automatically split file names in $fs and $fx properly
1515+# since default file separator used in these variables (i.e. 'filesep' option)
1616+# is newline. You need to consider the values of these options and create your
1717+# commands accordingly.
1818+set ifs "\n"
1919+2020+# leave some space at the top and the bottom of the screen
2121+set scrolloff 10
2222+2323+# == previewer ==
2424+set previewer ~/.config/lf/previewer.sh
2525+2626+# use enter for shell commands
2727+map <enter> shell
2828+2929+# execute current file (must be executable)
3030+map x $$f
3131+map X !$f
3232+3333+# dedicated keys for file opener actions
3434+map o &mimeopen $f
3535+map O $mimeopen --ask $f
3636+3737+# define a custom 'open' command
3838+# This command is called when current file is not a directory. You may want to
3939+# use either file extensions and/or mime types here. Below uses an editor for
4040+# text files and a file opener for the rest.
4141+cmd open ${{
4242+ test -L $f && f=$(readlink -f $f)
4343+ case $(file --mime-type $f -b) in
4444+ text/*) $EDITOR $fx;;
4545+ *) for f in $fx; do setsid $OPENER $f > /dev/null 2> /dev/null & done;;
4646+ esac
4747+}}
4848+4949+# define a custom 'rename' command without prompt for overwrite
5050+# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
5151+# map r push :rename<space>
5252+5353+# make sure trash folder exists
5454+# %mkdir -p ~/.trash
5555+5656+# move current file or selected files to trash folder
5757+# (also see 'man mv' for backup/overwrite options)
5858+cmd trash %set -f; mv $fx ~/.trash
5959+6060+# define a custom 'delete' command
6161+# cmd delete ${{
6262+# set -f
6363+# printf "$fx\n"
6464+# printf "delete?[y/n]"
6565+# read ans
6666+# [ "$ans" = "y" ] && rm -rf $fx
6767+# }}
6868+6969+# use '<delete>' key for either 'trash' or 'delete' command
7070+# map <delete> trash
7171+# map <delete> delete
7272+7373+# extract the current file with the right command
7474+# (xkcd link: https://xkcd.com/1168/)
7575+cmd extract ${{
7676+ set -f
7777+ case $f in
7878+ *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
7979+ *.tar.gz|*.tgz) tar xzvf $f;;
8080+ *.tar.xz|*.txz) tar xJvf $f;;
8181+ *.zip) unzip $f;;
8282+ *.rar) unrar x $f;;
8383+ *.7z) 7z x $f;;
8484+ esac
8585+}}
8686+8787+# compress current file or selected files with tar and gunzip
8888+cmd tar ${{
8989+ set -f
9090+ mkdir $1
9191+ cp -r $fx $1
9292+ tar czf $1.tar.gz $1
9393+ rm -rf $1
9494+}}
9595+9696+# compress current file or selected files with zip
9797+cmd zip ${{
9898+ set -f
9999+ mkdir $1
100100+ cp -r $fx $1
101101+ zip -r $1.zip $1
102102+ rm -rf $1
103103+}}
+9
lf/previewer.sh
···11+#!/bin/sh
22+33+# check here : https://www.youtube.com/watch?v=50BMBT05Wk0
44+55+case ${1##*.} in
66+ 7z|zip) 7z l -p -- "$1" && exit 1;;
77+ jpeg|jpg|png|gif) chafa --clear --animate=off --symbols space -s "$2x$3" "$1" && exit 1;;
88+ *) bat --style=plain --color=always "$1" || cat "$1" && exit 1;;
99+esac