mirror of
https://github.com/rywng/dotfiles.git
synced 2024-11-28 13:51:49 +08:00
d51563c8f9
lf: added custom open method .zshrc: added fuck implementation and caching ncmpcpp: change tab behaviour
70 lines
1.4 KiB
Plaintext
70 lines
1.4 KiB
Plaintext
set shell sh
|
|
set ifs "\n"
|
|
set hidden true
|
|
set drawbox true
|
|
set icons true
|
|
set ignorecase true
|
|
set info size
|
|
# set previewer ~/.config/lf/preview.sh
|
|
# set preview true
|
|
|
|
map D push %rm<space>-rf<space>$fs
|
|
map a push %mkdir<space>
|
|
map x $$f
|
|
|
|
# xdg-open
|
|
cmd open ${{
|
|
case $(file --mime-type "$f" -bL) in
|
|
text/*|application/json) $EDITOR "$f";;
|
|
*) xdg-open "$f" ;;
|
|
esac
|
|
}}
|
|
|
|
# bulk-rename
|
|
cmd bulk-rename ${{
|
|
old="$(mktemp)"
|
|
new="$(mktemp)"
|
|
[ -n "$fs" ] && fs="$(ls)"
|
|
printf '%s\n' "$fs" >"$old"
|
|
printf '%s\n' "$fs" >"$new"
|
|
$EDITOR "$new"
|
|
[ "$(wc -l "$new")" -ne "$(wc -l "$old")" ] && exit
|
|
paste "$old" "$new" | while IFS= read -r names; do
|
|
src="$(printf '%s' "$names" | cut -f1)"
|
|
dst="$(printf '%s' "$names" | cut -f2)"
|
|
if [ "$src" = "$dst" ] || [ -e "$dst" ]; then
|
|
continue
|
|
fi
|
|
mv -- "$src" "$dst"
|
|
done
|
|
rm -- "$old" "$new"
|
|
lf -remote "send $id unselect"
|
|
}}
|
|
|
|
# new folder
|
|
cmd newfold ${{
|
|
set -f
|
|
read newd
|
|
mkdir -- "$newd"
|
|
mv -- $fx "$newd"
|
|
}}
|
|
|
|
#save file name selected
|
|
cmd savesel ${{
|
|
echo $fs > args-selected-`pwgen -1`.txt
|
|
}}
|
|
|
|
cmd extract ${{
|
|
set -f
|
|
case $f in
|
|
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
|
|
*.tar.gz|*.tgz) tar xzvf $f;;
|
|
*.tar.xz|*.txz) tar xJvf $f;;
|
|
*.zip) unzip $f;;
|
|
*.rar) unrar x $f;;
|
|
*.7z) 7z x $f;;
|
|
esac
|
|
}}
|
|
|
|
#vim:set noet sts=0 sw=2 ts=8:
|