dotfiles

dotfiles
git clone git://git.wimdupont.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 87973144f417d50eb12e9983774ecd384b4489f3
parent bc28e59ca9111e8d8d02ed477fb17e0252b739f2
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sat, 13 Jul 2024 13:37:51 +0200

removed lfrc - switched to cex

Diffstat:
M.bashrc | 20+++++++++++++-------
Dlfrc | 152-------------------------------------------------------------------------------
2 files changed, 13 insertions(+), 159 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -73,28 +73,34 @@ function nkill(){ } function leak(){ - name="./$1" + name="$1" [[ ! -f "$name" ]] && echo "$1 not found in current directory" >&2 && return 1; base="${name%.*}" case "${name##*.}" in "c") - compiler=gcc + gcc -g "$name" -o "$base" ;; "cpp") - compiler=g++ + g++ -g "$name" -o "$base" ;; *) - echo "Compiler not found: invalid program extension." >&2 - return 1; + base="$name" + ;; esac - $compiler -g "$name" -o "$base" && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s "$base" + valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s "$base" +} + +function cex() { + txt=$(mktemp) || exit 1 + command cex -f "$txt" && cd $(cat "$txt") + rm "$txt" } alias ls='ls --color=auto' alias ll='ls -l' alias weather='curl wttr.in' alias bt='bluetoothctl' -alias r='lf' +alias e='cex' alias wifi='nmcli radio wifi' alias todo='vim ~/authored/.todo.adoc' alias signal-cli='sh ~/Downloads/signal-cli/signal-cli.sh' diff --git a/lfrc b/lfrc @@ -1,152 +0,0 @@ -set shell sh -set shellopts '-eu' - -#set drawbox -set cursorpreviewfmt "\033[7m" - -# 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" - -# Basic Settings -set ignorecase true - -cmd make_mod ${{ - perm=$1 - assu=$(test -w $f && echo 0 || echo 1) - if [ $perm != "a" ]; then - mod=$(test -$perm $f && echo "-$perm" || echo "+$perm") - else - mod="+rwx" - fi - - test $assu -eq 1 && sudo chmod $mod $f || chmod $mod $f - lf -remote "send $id :reload" -}} - -cmd mkfile ${{ - printf "File Name: " - read ans - $EDITOR $ans -}} - -cmd setwallpaper ${{ - feh --bg-max "$f" -}} - -cmd set_mime_default ${{ - mime_type=$(xdg-mime query filetype $f) - colour=$(tput setaf 6) - normal=$(tput sgr0) - apps=($(ls /usr/share/applications | sed 's/.desktop//g')) - - echo "" - printf "${colour}%s\t${normal}" "${apps[@]}" - printf "\nDefault application for $mime_type: " - read app - - xdg-mime default $app.desktop $mime_type -}} - -# extract the current file with the right command -# (xkcd link: https://xkcd.com/1168/) -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";; - *.tar) tar -xvf "$f";; - *.zip) unzip "$f";; - *.rar) unrar x "$f";; - *.7z) 7z x "$f";; - *.gz) gzip -dk "$f";; - *.gpg) gpg --decrypt-files "$f";; - esac -}} - -# compress current file or selected files with tar and gunzip -cmd tar ${{ - tar czf $(basename $fx).tar.gz $(basename $fx) -}} - -# 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 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";; - *) lf -remote "send $id \$xdg-open \$fx";; - esac -}} - -cmd edit-config ${{ - $EDITOR ~/.config/lf/lfrc - lf -remote "send $id source ~/.config/lf/lfrc" -}} - -cmd move-parent &{{ - dironly="setlocal '$(dirname "$PWD")' dironly" - lf -remote "send $id :updir; $dironly true; $1; $dironly false; open" -}} - -cmd create_access ${{ - mkdir -p $HOME/access - ln -s $fx $HOME/access/ -}} - -# Bindings -map m - -map . set hidden! - -map J move-parent down -map K move-parent up - -map md push %mkdir<space> -map mf mkfile -map mx make_mod "x" -map mr make_mod "r" -map mw make_mod "w" -map ma make_mod "a" -map mo $TYPE=$(xdg-mime query filetype $f); notify-send $(xdg-mime query default $TYPE) $TYPE -map mO set_mime_default - -map bg setwallpaper - -# use enter for shell commands -map <enter> shell - -map D delete -map C edit-config - -# execute current file (must be executable) -map x $$f -map X !$f - -map aa create_access -map ax extract -map at tar -map ae $encr "$(basename $f)" -map ad $decr "$f" - -map ow $wine "$f" -map os $sh "$f" -map oa $mpv --no-video "$f" - -# dedicated keys for file opener actions -map O $xdg-open "$f" -map oo $xdg-open "$f" - -# Movement -map ga cd ~/access -map gc cd ~/.config -map gD cd ~/desktop -map gd cd ~/downloads -map gp cd ~/pictures -map gr cd ~/repositories -map gb cd /usr/local/bin