104 lines
4.6 KiB
Text
104 lines
4.6 KiB
Text
# ───────────────────────────────────< set some options >───────────────────────────────────
|
|
# ─< interpreter for shell commands >─────────────────────────────────────────────────────
|
|
set shell zsh
|
|
set hidden!
|
|
# ─< set '-eu' options for shell commands >───────────────────────────────────────────────
|
|
set shellopts '-eu'
|
|
|
|
# ─< set internal field separator (IFS) to "\n" for shell commands >──────────────────────
|
|
set ifs "\n"
|
|
|
|
# ─< leave some space at the top and the bottom of the screen >───────────────────────────
|
|
set scrolloff 6
|
|
|
|
# ─< Use the `dim` attribute instead of underline for the cursor in the preview pane >────
|
|
set cursorpreviewfmt "\033[7;2m"
|
|
set drawbox
|
|
set icons true
|
|
|
|
|
|
# ───────────────────────────────────────< keymaps >─────────────────────────────────────
|
|
map t shell
|
|
map c :cut
|
|
|
|
map H set hidden!
|
|
map <esc> quit
|
|
|
|
# show the result of execution of previous commands
|
|
map <c-t> !true
|
|
map gd :cd
|
|
|
|
# execute current file (must be executable)
|
|
map x $$f
|
|
map X !$f
|
|
|
|
# dedicated keys for file opener actions
|
|
map o &mimeopen $f
|
|
map O $mimeopen --ask $f
|
|
map N &nvim $f
|
|
|
|
# ─< open everything in neovim >──────────────────────────────────────────────────────────
|
|
# map l $if [ -d "$f" ]; then lf -remote "send $id cd \"$f\""; elif [[ "$f" == *.php || "$f" == *.txt || "$f" == *.sh || "$f" == *.html ]]; then nvim "$f"; else $OPENER "$f" > /dev/null 2> /dev/null & fi
|
|
|
|
# ─< define a custom 'open' command >─────────────────────────────────────────────────────
|
|
cmd open &{{
|
|
case $(file --mime-type -Lb $f) in
|
|
text/*) lf -remote "send $id \$$EDITOR \$fx";;
|
|
*) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
|
|
esac
|
|
}}
|
|
|
|
# ─< Create a new file and open it in the editor >────────────────────────────────────────
|
|
map a :push %touch<space>
|
|
# ─< mkdir command >──────────────────────────────────────────────────────────────────────
|
|
map A :push %mkdir<space>
|
|
|
|
# ─< make sure trash folder exists >──────────────────────────────────────────────────────
|
|
%mkdir -p ~/.local/share/Trash
|
|
|
|
# move current file or selected files to trash folder
|
|
cmd trash %set; mv $fx ~/.local/share/Trash
|
|
|
|
# ─< use '<delete>' key for 'trash' command >─────────────────────────────────────────────
|
|
# map <c-d> trash
|
|
map <c-d> trash
|
|
|
|
# ─< extract the current file with the right command >────────────────────────────────────
|
|
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
|
|
}}
|
|
|
|
# ─< compress current file or selected files with tar and gunzip >────────────────────────
|
|
cmd tar ${{
|
|
set -f
|
|
mkdir $1
|
|
cp -r $fx $1
|
|
tar czf $1.tar.gz $1
|
|
rm -rf $1
|
|
}}
|
|
|
|
# ─< compress current file or selected files with zip >───────────────────────────────────
|
|
cmd zip ${{
|
|
set -f
|
|
mkdir $1
|
|
cp -r $fx $1
|
|
zip -r $1.zip $1
|
|
rm -rf $1
|
|
}}
|
|
|
|
# ─< Show file size, last modification time, and permissions in columns >─────────────────
|
|
set info 'size:time'
|
|
|
|
# ─< Enable icons for directories, executables, and symlinks (requires patched font) >────
|
|
set icons true
|
|
|
|
map d :
|
|
map v :
|