+ reintroducing lf

This commit is contained in:
committer@tuxwarrior
2026-02-27 13:15:58 -05:00
parent 56731f159c
commit 28ef2fea43
6 changed files with 107 additions and 4 deletions

View File

@@ -97,7 +97,6 @@ aur:yt-dlp-git # cli downloader - youtube-dl fork
#httpie # human-friendly cli http client for the api era
#inetutils # network programs (telnet++)
#j4-dmenu-desktop # find .desktop files and offer you a menu to start an application using dmenu
#lf # file manager
#libcaca # colour ascii art lib (inc. cacfire)
#lxappearance # gtk+ theme switcher
#lxsession # lightweight X11 session manager | needed for polkit / tuxedo-control-center
@@ -147,6 +146,7 @@ htop # view processes
keepassxc # password manager
kitty # terminal
less # cli text viewer
lf # file manager
lm_sensors # tools for general smbus access and hardware monitoring
nextcloud-client # nextcloud sync client
noto-fonts # google noto ttf fonts

View File

@@ -43,7 +43,6 @@ alias ip='ip -br a'
alias ipcam="ffplay rtsp://192.168.31.220:554/1"
alias ipify='http https://api.ipify.org?format=json'
alias journal='journalctl --since "1 hour ago"'
alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll"
alias keyringreset="trash-put /home/poq/.local/share/keyrings/*.keyrings"
alias ls='ls --color=auto'
alias myip="echo $(wget http://ipinfo.io/ip -qO -)"

View File

@@ -356,3 +356,7 @@
# }
# alias iso-unmount="sudo umount /media/iso"
#
---
#alias keymap="setxkbmap -model pc105 -layout us,no -option grp:caps_toggle,grp_led:scroll"

181
dots/lf/lfrc Normal file
View File

@@ -0,0 +1,181 @@
# klevstul
# --------------------
# set
# --------------------
# set '-eu' options for shell commands
# These options are used to have safer shell commands. Option '-e' is used to
# exit on error and option '-u' is used to give error for unset variables.
# 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 shellopts '-eu'
# set internal field separator (IFS) to "\n" for shell commands
# This is useful to automatically split file names in $fs and $fx properly
# since default file separator used in these variables (i.e. 'filesep' option)
# is newline. You need to consider the values of these options and create your
# commands accordingly.
set ifs "\n"
# leave some space at the top and the bottom of the screen
set scrolloff 10
# Use the `dim` attribute instead of underline for the cursor in the preview pane
set cursorpreviewfmt "\033[7;2m"
# ctpv
# https://github.com/NikitaIvanovV/ctpv
set sixel true
#set preview true
set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
&ctpvquit $id
# --------------------
# map
# --------------------
map <delete> trash-confirm # use '<delete>' key for 'trash'
map <c-delete> trash # control + delete - for no confirm - you have control
map <enter> shell # use enter for shell commands
map <esc> :unselect; clear # clear all selected
map ` !true # show the result of execution of previous commands
map a :push %mkdir<space> # mkdir command. See wiki if you want it to select created dir | :push is used to keybind these commands to avoid typing (e.g. map a :push %mkdir<space>) | https://github.com/gokcehan/lf/wiki/FAQ
map b multi-dragon
map e edit
map o &xdg-open $f # dedicated keys for file opener actions
map <a-r> recol
map w :push %touch<space> # write (create) new file
map x $$f # execute current file (must be executable)
map X !$f
# --------------------
# cmd
# --------------------
# define a custom 'open' command
# This command is called when current file is not a directory. You may want to
# use either file extensions and/or mime types here. Below example uses an
# editor for text files and a file opener for the rest:
#
# 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
# }}
cmd open ${{
case "$f" in
*.[Cc][Ss][Vv]*) onlyoffice-desktopeditors $fx &;;
*.[Dd][Oo][Cc][Xx]*) onlyoffice-desktopeditors $fx &;;
*.[Gg][Ii][Ff]*) feh $fx &;;
*.[Jj][Pp][Gg]*) feh $fx &;;
*.[Jj][Pp][Ee][Gg]*) feh $fx &;;
*.[Mm][Pp][4]*) mpv $fx &;;
*.[Pp][Dd][Ff]*) mupdf $fx &;;
*.[Pp][Nn][Gg]*) feh $fx &;;
*.[Rr][Pp][Pp]*) reaper $fx &;;
*.[Xx][Ll][Ss][Xx]*) onlyoffice-desktopeditors $fx &;;
*) case $(file --mime-type -Lb $f) in
text/*) nano $fx;;
*) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;;
esac
esac
}}
# reconfigure columns, based on with | https://github.com/gokcehan/lf/blob/master/doc.md
cmd recol %{{
if [ $lf_width -le 80 ]; then
lf -remote "send $id set ratios 1:2"
elif [ $lf_width -le 160 ]; then
lf -remote "send $id set ratios 1:2:3"
else
lf -remote "send $id set ratios 1:2:3:5"
fi
}}
#cmd open ${{
# test -L $f && f=$(readlink -f $f)
# case $(file --mime-type $f -b) in
# text/*) geany $fx;;
# *) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;;
# esac
# }}
# define a custom 'rename' command without prompt for overwrite
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
# map r push :rename<space>
# move current file or selected files to trash folder
# (also see 'man mv' for backup/overwrite options)
#cmd trash %set -f; mv $fx ~/.trash
# $f: single file, $fx: multiple files
cmd trash %tp.sh "$fx"
# https://github.com/gokcehan/lf/issues/45#issuecomment-260347057
# https://unix.stackexchange.com/questions/617576/read-from-terminal-without-waiting-for-enter
cmd trash-confirm ${{
echo 'file(s) selected:'
echo $fx
echo 'delete? [y/n]'
read -n1 ans
[ $ans = 'y' ] && (echo 'deleting files…' && tp.sh "$fx") || echo 'cancelled…'
}}
# extract the current file with the right command (https://xkcd.com/1168/)
cmd extract %extract.sh "$f"
# 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
}}
# dragon
cmd dragon %dragon-drop --all --and-exit "$fx"
cmd dragon-stay %dragon-drop --all "$fx"
cmd dragon-individual %dragon-drop "$fx"
cmd dragin %dragin.sh
cmd multi-dragon %lfMultiSelectHandler.sh "dragon-drop --and-exit" "$fx"
cmd md :multi-dragon
# change dir
cmd cda :cd /home/poq/syncDir/antijantepodden
cmd cdd :cd /home/poq/syncDir/0_downloads
cmd cdg :cd /home/poq/syncDir/gitRepos
cmd cdh :cd /home/poq
cmd cdi :cd /home/poq/syncDir/0_inProgress
cmd cdm :cd /home/poq/mega
cmd cdn :cd /mnt/nas
cmd cdp :cd /home/poq/pCloudDrive
cmd cds :cd /home/poq/syncDir
# yanks
cmd yank-dirname $dirname -- "$f" | head -c-1 | xclip -i -selection clipboard
cmd yank-path $printf '%s' "$fx" | xclip -i -selection clipboard
cmd yank-basename $basename -a -- $fx | head -c-1 | xclip -i -selection clipboard
cmd yd :yank-dirname
cmd yp :yank-path
cmd yb :yank-basename
# misc
cmd edit $nano "$fx"

View File

@@ -0,0 +1,95 @@
##############################################
# #
# Superfile Configuration #
# #
##############################################
# This contains the hotkey config file for superfile! More details can be found at
# https://superfile.dev/configure/custom-hotkeys/.
###############################################################################
# Global hotkeys #
###############################################################################
# Note: These hotkeys should be unique.
#-- Basic Actions
confirm = ['enter', 'right', 'l']
cd_quit = ['Q', '']
quit = ['q', 'esc']
#-- Navigation
list_down = ['down', 'j']
list_up = ['up', 'k']
page_down = ['pgdown','']
page_up = ['pgup','']
#-- File Panel Controls
close_file_panel = ['w', '']
create_new_file_panel = ['n', '']
next_file_panel = ['tab', 'L']
open_sort_options_menu = ['o', '']
pinned_directory = ['P', '']
previous_file_panel = ['shift+left', 'H']
toggle_file_preview_panel = ['f', '']
toggle_reverse_sort = ['R', '']
#-- Focus Manipulation
focus_on_metadata = ['m', '']
focus_on_process_bar = ['p', '']
focus_on_sidebar = ['s', '']
#-- File/Dir Creation/Renaming
file_panel_item_create = ['ctrl+n', '']
file_panel_item_rename = ['ctrl+r', '']
#-- Main File Operations
copy_items = ['ctrl+c', '']
cut_items = ['ctrl+x', '']
delete_items = ['ctrl+d', 'delete', '']
paste_items = ['ctrl+v', 'ctrl+w', '']
permanently_delete_items = ['D', '']
#-- Archive Manipulation
compress_file = ['ctrl+a', '']
extract_file = ['ctrl+e', '']
#-- Editor Actions
open_current_directory_with_editor = ['E', '']
open_file_with_editor = ['e', '']
#-- Other Actions
change_panel_mode = ['v', '']
copy_path = ['ctrl+p', '']
copy_present_working_directory = ['c', '']
open_command_line = [':', '']
open_help_menu = ['?', '']
open_spf_prompt = ['>', '']
open_zoxide = ['z', '']
toggle_dot_file = ['.', '']
toggle_footer = ['F', '']
###############################################################################
# Typing hotkeys #
###############################################################################
# Note: These hotkeys can override all hotkeys.
confirm_typing = ['enter', '']
cancel_typing = ['ctrl+c', 'esc']
###############################################################################
# Mode-Specific Hotkeys #
###############################################################################
# Note: These hotkeys can conflict with other modes, but not with global
# hotkeys.
#-- Normal Mode Actions
parent_directory = ['h', 'left', 'backspace']
search_bar = ['/', '']
#-- Selection Mode Actions
file_panel_select_mode_items_select_down = ['shift+down', 'J']
file_panel_select_mode_items_select_up = ['shift+up', 'K']
file_panel_select_all_items = ['A', '']