mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 13:14:35 +00:00
Merge branch 'arch' into gentoo
This commit is contained in:
commit
cad67644ba
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -7,9 +7,9 @@
|
||||||
[submodule "root/usr/share/zsh/site-functions/zsh-syntax-highlighting"]
|
[submodule "root/usr/share/zsh/site-functions/zsh-syntax-highlighting"]
|
||||||
path = "root/usr/share/zsh/site-functions/zsh-syntax-highlighting"
|
path = "root/usr/share/zsh/site-functions/zsh-syntax-highlighting"
|
||||||
url = "https://github.com/zsh-users/zsh-syntax-highlighting"
|
url = "https://github.com/zsh-users/zsh-syntax-highlighting"
|
||||||
[submodule "root/usr/share/zsh/site-functions/zsh-you-should-use"]
|
#[submodule "root/usr/share/zsh/site-functions/zsh-you-should-use"]
|
||||||
path = "root/usr/share/zsh/site-functions/zsh-you-should-use"
|
# path = "root/usr/share/zsh/site-functions/zsh-you-should-use"
|
||||||
url = "https://github.com/MichaelAquilina/zsh-you-should-use"
|
# url = "https://github.com/MichaelAquilina/zsh-you-should-use"
|
||||||
[submodule "root/usr/local/src/z.lua"]
|
[submodule "root/usr/local/src/z.lua"]
|
||||||
path = "root/usr/local/src/z.lua"
|
path = "root/usr/local/src/z.lua"
|
||||||
url = "https://github.com/skywind3000/z.lua"
|
url = "https://github.com/skywind3000/z.lua"
|
||||||
|
|
143
home/.config/lf/lfrc
Normal file
143
home/.config/lf/lfrc
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
# Basic settings
|
||||||
|
set previewer ~/.config/lf/previewer
|
||||||
|
set preview true
|
||||||
|
set hidden true
|
||||||
|
set drawbox true
|
||||||
|
set icons true
|
||||||
|
set ignorecase true
|
||||||
|
set scrolloff 5
|
||||||
|
|
||||||
|
# Use $EDITOR for text
|
||||||
|
cmd open ${{
|
||||||
|
case $(file --mime-type "$f" -bL) in
|
||||||
|
text/*|application/json) $EDITOR "$f";;
|
||||||
|
*) xdg-open "$f" ;;
|
||||||
|
esac
|
||||||
|
}}
|
||||||
|
|
||||||
|
# File/Directory control functions
|
||||||
|
cmd mkdir %{{
|
||||||
|
printf "Directory Name: "
|
||||||
|
read ans
|
||||||
|
mkdir $ans
|
||||||
|
}}
|
||||||
|
|
||||||
|
cmd mkfile %{{
|
||||||
|
printf "File Name: "
|
||||||
|
read ans
|
||||||
|
touch $ans
|
||||||
|
}}
|
||||||
|
|
||||||
|
cmd chmod %{{
|
||||||
|
printf "Mode Bits: "
|
||||||
|
read ans
|
||||||
|
|
||||||
|
for file in "$fx"; do
|
||||||
|
chmod $ans $file
|
||||||
|
done
|
||||||
|
|
||||||
|
lf -remote 'send reload'
|
||||||
|
}}
|
||||||
|
|
||||||
|
# Add z.lua functionality for easy autojumps
|
||||||
|
cmd zlua %{{
|
||||||
|
printf "z.lua input: "
|
||||||
|
read ans
|
||||||
|
|
||||||
|
/usr/local/src/z.lua/z.lua $ans
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
# Archive bindings
|
||||||
|
cmd unarchive ${{
|
||||||
|
case "$f" in
|
||||||
|
*.zip) unzip "$f" ;;
|
||||||
|
*.tar.gz) tar -xzvf "$f" ;;
|
||||||
|
*.tar.bz2) tar -xjvf "$f" ;;
|
||||||
|
*.tar) tar -xvf "$f" ;;
|
||||||
|
*) echo "Unsuported format" ;;
|
||||||
|
esac
|
||||||
|
}}
|
||||||
|
|
||||||
|
cmd zip %zip -r "$f" "$f"
|
||||||
|
cmd tar %tar cvf "$f.tar" "$f"
|
||||||
|
cmd targz %tar cvzf "%f.tar.gz" "$f"
|
||||||
|
cmd tarbz2 %tar cjvf "$f.tar.bz2" "$f"
|
||||||
|
|
||||||
|
# Trash-cli bindings
|
||||||
|
cmd trash ${{
|
||||||
|
files=$(printf "$fx" | tr '\n' ':')
|
||||||
|
while [ "$files" ]; do
|
||||||
|
# extract the substring from start of string up to delimeter.
|
||||||
|
# this is the first "element" of the string
|
||||||
|
file=${files%%:*}
|
||||||
|
|
||||||
|
trash-put "$(basename "$file")"
|
||||||
|
# if there's only one element left, set `files` to an empty string.
|
||||||
|
# this causes us to exit this `while` loop.
|
||||||
|
# else, we delete the first "element" of the string from files, and
|
||||||
|
# move onto the next.
|
||||||
|
if [ "$files" = "$file" ]; then
|
||||||
|
files=''
|
||||||
|
else
|
||||||
|
files="${files#*;}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}}
|
||||||
|
|
||||||
|
cmd clear_trash %trash-empty
|
||||||
|
|
||||||
|
cmd restore_trash ${{
|
||||||
|
trash-restore
|
||||||
|
}}
|
||||||
|
|
||||||
|
# Bindings
|
||||||
|
# Remove some defaults
|
||||||
|
map m
|
||||||
|
map n
|
||||||
|
map "'"
|
||||||
|
map '"'
|
||||||
|
map d
|
||||||
|
map c
|
||||||
|
|
||||||
|
# Archive mappings
|
||||||
|
map az zip
|
||||||
|
map at tar
|
||||||
|
map ag targz
|
||||||
|
map au unarchive
|
||||||
|
|
||||||
|
# Trash mappings
|
||||||
|
map dd trash
|
||||||
|
map tc clear_trash
|
||||||
|
map tr restore_trash
|
||||||
|
|
||||||
|
# Basic functions
|
||||||
|
map . set hidden!
|
||||||
|
map DD delete
|
||||||
|
map p paste
|
||||||
|
map x cut
|
||||||
|
map y copy
|
||||||
|
map <enter> open
|
||||||
|
map md mkdir
|
||||||
|
map mf mkfile
|
||||||
|
map ch chmod
|
||||||
|
map r rename
|
||||||
|
map H top
|
||||||
|
map L bottom
|
||||||
|
map R reload
|
||||||
|
map C clear
|
||||||
|
map z zlua
|
||||||
|
|
||||||
|
# Movement
|
||||||
|
map gh cd ~
|
||||||
|
map gc cd ~/.config
|
||||||
|
map gl cd ~/.local
|
||||||
|
map gs cd ~/.local/bin/scripts
|
||||||
|
map gtr cd ~/.local/share/Trash/files
|
||||||
|
map gE. cd /etc
|
||||||
|
map gEp cd /etc/portage
|
||||||
|
map gU. cd /usr
|
||||||
|
map gUs cd /usr/share
|
||||||
|
map gUl cd /usr/local
|
||||||
|
map gM cd /mnt
|
||||||
|
|
62
home/.config/lf/previewer
Executable file
62
home/.config/lf/previewer
Executable file
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
text_handle() {
|
||||||
|
# Handle all other formats as text and cat them
|
||||||
|
# if highlighting tools are aviable, try to use them
|
||||||
|
if command -v bat > /dev/null; then
|
||||||
|
bat -pp --color=always "$1"
|
||||||
|
elif command -v highlight > /dev/null; then
|
||||||
|
highlight "$1" --out-format ansi --force
|
||||||
|
else
|
||||||
|
cat "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_cmd() {
|
||||||
|
cmd="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if command -v "$cmd" > /dev/null; then
|
||||||
|
$cmd $@
|
||||||
|
else
|
||||||
|
# If we didn't found the requested command, check if
|
||||||
|
# the file is text-like and try to use the text_handle
|
||||||
|
# to show the preview, this may not be ideal for given
|
||||||
|
# file-format, but at least we won't fail.
|
||||||
|
case $(file --mime-type "$file" -bL) in
|
||||||
|
text/*|application/json)
|
||||||
|
echo "@@PREVIEW FALLBACK: Using text handle, $cmd command not found!"
|
||||||
|
text_handle "$file"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "@@PREVIEW ERROR: Preview failed, $cmd command not found!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Capture all directories at first, since they could
|
||||||
|
# potentionally match one of the file case statements
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
tree "$1" -La 1
|
||||||
|
elif [ -f "$1" ]; then
|
||||||
|
case "$1" in
|
||||||
|
*.png|*.jpg|*.jpeg|*.mkv|*.mp4|*.m4v) run_cmd mediainfo "$1";;
|
||||||
|
*.pdf) run_cmd pdftotext "$1";;
|
||||||
|
*.tgz|*.tar.gz) run_cmd tar tzf "$1";;
|
||||||
|
*.tar.bz2|*.tbz2) run_cmd tar tjf "$1";;
|
||||||
|
*.tar.txz|*.txz) run_cmd xz --list "$1";;
|
||||||
|
*.tar) run_cmd tar tf "$1";;
|
||||||
|
*.zip|*.jar|*.war|*.ear|*.oxt) run_cmd unzip -l "$1";;
|
||||||
|
*.rar) run_cmd unrar l "$1";;
|
||||||
|
*.7z) run_cmd 7z l "$1";;
|
||||||
|
*.iso) run_cmd iso-info --no-header -l "$1";;
|
||||||
|
*.o) run_cmd nm "$1" | less ;;
|
||||||
|
*.csv) cat "$1" | sed s/,/\\n/g ;;
|
||||||
|
*odt,*.ods,*.odp,*.sxw) run_cmd odt2txt "$1";;
|
||||||
|
*.doc) run_cmd catdoc "$1" ;;
|
||||||
|
*.docx) run_cmd docx2txt "$1" - ;;
|
||||||
|
*.torrent) run_cmd transmission-show "$1";;
|
||||||
|
*) text_handle "$1" ;;
|
||||||
|
esac
|
||||||
|
fi
|
|
@ -62,6 +62,5 @@ zstyle ':completion:::::' completer _expand _complete _ignored _approximate #ena
|
||||||
# Load extensions (should be last)
|
# Load extensions (should be last)
|
||||||
. /usr/share/zsh/site-functions/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
|
. /usr/share/zsh/site-functions/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
|
||||||
. /usr/share/zsh/site-functions/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
|
. /usr/share/zsh/site-functions/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
|
||||||
. /usr/share/zsh/site-functions/zsh-you-should-use/you-should-use.plugin.zsh 2>/dev/null
|
|
||||||
eval "$(lua /usr/local/src/z.lua/z.lua --init zsh enhanced)"
|
eval "$(lua /usr/local/src/z.lua/z.lua --init zsh enhanced)"
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit b4aec740f23d195116d1fddec91d67b5e9c2c5c7
|
|
Loading…
Reference in a new issue