diff options
| -rw-r--r-- | ar/.config/lf/lfrc | 79 | ||||
| -rw-r--r-- | ar/.config/shell/aliasrc | 2 | ||||
| -rw-r--r-- | ar/.config/vim/plugins.vim | 5 | ||||
| -rw-r--r-- | ar/.config/zsh/keymaps.zsh | 4 | ||||
| -rwxr-xr-x | ar/.local/bin/statusbar/sb-ylog | 23 | ||||
| -rw-r--r-- | fedora/.inputrc | 31 | ||||
| -rwxr-xr-x | fedora/.local/bin/lazysql | bin | 0 -> 16863416 bytes |
7 files changed, 112 insertions, 32 deletions
diff --git a/ar/.config/lf/lfrc b/ar/.config/lf/lfrc index 87b1858..a69d578 100644 --- a/ar/.config/lf/lfrc +++ b/ar/.config/lf/lfrc @@ -235,23 +235,70 @@ cmd extract ${{ printf "%s\n\t" "$fx" printf "extract?[y/N]" read ans - [ $ans = "y" ] && { - case $fx in - *.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjf $fx;; - *.tar.gz|*.tgz) tar xzf $fx ;; - *.tar.xz|*.txz) tar xf $fx ;; - *.bz2) bunzip2 $fx ;; - *.lzma) unlzma $fx ;; - *.rar) unrar e $fx ;; - *.gz) gunzip $fx ;; - *.tar) tar xf $fx ;; - *.xz) unxz $fx ;; - *.zip|*.jar|*.war|*.7z) 7z x $fx ;; - *.Z) uncompress $fx ;; - *.exe) cabextract $fx ;; - *.ace) unace x $fx ;; + [ "$ans" != "y" ] && exit + + for archive in $fx; do + [ -e "$archive" ] || continue + case "$archive" in + /*) archive_abs="$archive";; + *) archive_abs="$PWD/$archive";; esac - } + base="${archive##*/}" + tar_flag="" + type="" + name="" + case "$base" in + *.tar.bz2) name="${base%.tar.bz2}"; type=tar; tar_flag=j;; + *.tar.bz) name="${base%.tar.bz}"; type=tar; tar_flag=j;; + *.tbz2) name="${base%.tbz2}"; type=tar; tar_flag=j;; + *.tbz) name="${base%.tbz}"; type=tar; tar_flag=j;; + *.tar.gz) name="${base%.tar.gz}"; type=tar; tar_flag=z;; + *.tgz) name="${base%.tgz}"; type=tar; tar_flag=z;; + *.tar.xz) name="${base%.tar.xz}"; type=tar; tar_flag=J;; + *.txz) name="${base%.txz}"; type=tar; tar_flag=J;; + *.tar) name="${base%.tar}"; type=tar;; + *.zip|*.jar|*.war|*.7z) name="${base%.*}"; type=7z;; + *.rar) name="${base%.rar}"; type=rar;; + *.exe) name="${base%.exe}"; type=cab;; + *.ace) name="${base%.ace}"; type=ace;; + *.bz2) bunzip2 "$archive"; continue;; + *.gz) gunzip "$archive"; continue;; + *.xz) unxz "$archive"; continue;; + *.lzma) unlzma "$archive"; continue;; + *.Z) uncompress "$archive"; continue;; + *) printf "Unknown archive type: %s\n" "$archive"; continue;; + esac + + case "$type" in + tar) toplevel=$(tar tf "$archive" 2>/dev/null | awk -F/ 'NF{print $1}' | sort -u);; + 7z) toplevel=$(7z l -slt -ba "$archive" 2>/dev/null | awk -F'= ' '/^Path = /{print $2}' | awk -F/ 'NF{print $1}' | sort -u);; + rar) toplevel=$(unrar lb "$archive" 2>/dev/null | awk -F/ 'NF{print $1}' | sort -u);; + *) toplevel="";; + esac + if [ -z "$toplevel" ]; then + count=0 + else + count=$(printf '%s\n' "$toplevel" | wc -l) + fi + + target="." + if [ "$count" != "1" ]; then + printf "\n'%s' has %s top-level entries.\nExtract into folder '%s'? [Y/n] " "$base" "$count" "$name" + read folder_ans + if [ "$folder_ans" != "n" ] && [ "$folder_ans" != "N" ]; then + mkdir -p -- "$name" + target="$name" + fi + fi + + case "$type" in + tar) tar x${tar_flag}f "$archive" -C "$target";; + 7z) 7z x "$archive" -o"$target";; + rar) (cd "$target" && unrar x "$archive_abs");; + cab) (cd "$target" && cabextract "$archive_abs");; + ace) (cd "$target" && unace x "$archive_abs");; + esac + done }} # Git diff --git a/ar/.config/shell/aliasrc b/ar/.config/shell/aliasrc index fe1a363..bd648d7 100644 --- a/ar/.config/shell/aliasrc +++ b/ar/.config/shell/aliasrc @@ -311,7 +311,7 @@ alias open='xdg-open' # pacman command -v pacman > /dev/null 2>&1 && { alias -g pcy='pacman -Syu' - alias -g pcyr='pacman -Syu && remaps' + alias -g pcyr='pacman -Syu; remaps' alias -g pcs='pacman -S' alias -g pcss='pacman -Ss' alias -g pcqs='pacman -Qs' diff --git a/ar/.config/vim/plugins.vim b/ar/.config/vim/plugins.vim index 072c4c2..1f2b23b 100644 --- a/ar/.config/vim/plugins.vim +++ b/ar/.config/vim/plugins.vim @@ -1,8 +1,7 @@ -if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim"')) +if getfsize(expand("${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim")) <= 0 echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/ silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/vim/plugged/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim + silent !curl -fLo ${XDG_CONFIG_HOME:-$HOME/.config}/vim/autoload/plug.vim --create-dirs "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" autocmd VimEnter * PlugInstall endif diff --git a/ar/.config/zsh/keymaps.zsh b/ar/.config/zsh/keymaps.zsh index 7f0f9b0..33a16d6 100644 --- a/ar/.config/zsh/keymaps.zsh +++ b/ar/.config/zsh/keymaps.zsh @@ -194,7 +194,7 @@ if [[ -f "${ZPLUGINDIR:-${HOME}/.local/share/zsh}/zsh-vi-mode/zsh-vi-mode.plugin zvm_bind_script viins '^X^X^P' 'pcyr' zvm_bind_script viins '^X^X^R' 'rbackup -r' zvm_bind_script viins '^X^X^S' 'sshadd' - zvm_bind_script viins '^X^X^Y' 'pacman -Syyu && yay -Syu && remaps' + zvm_bind_script viins '^X^X^Y' 'pacman -Syyu && yay -Syu; remaps' # widgets zvm_define_widget sudo-command-line @@ -339,6 +339,6 @@ else bindkey -s '^X^X^P' '^upcyr\n' bindkey -s '^X^X^R' '^urbackup -r\n' bindkey -s '^X^X^S' '^usshadd\n' - bindkey -s '^X^X^Y' '^upacman -Syyu && yay -Syu && remaps\n' + bindkey -s '^X^X^Y' '^upacman -Syyu && yay -Syu; remaps\n' bindkey -s '^X^X^]' '^uylogd\n' fi diff --git a/ar/.local/bin/statusbar/sb-ylog b/ar/.local/bin/statusbar/sb-ylog index b763c34..4326765 100755 --- a/ar/.local/bin/statusbar/sb-ylog +++ b/ar/.local/bin/statusbar/sb-ylog @@ -2,8 +2,8 @@ # Displays new nginx log entries from ylog. # Updates every 30 minutes via dwmblocks. -# Left click: show new entries and mark as seen -# Middle click: force refresh +# Left click: show all current entries +# Middle click: show new entries and mark as seen # Right click: help CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/ylog_sb" @@ -54,6 +54,14 @@ mark_seen() { case $BLOCK_BUTTON in 1) + if [ -s "$CURR" ]; then + count=$(wc -l <"$CURR") + notify-send "🌐 Current log entries ($count)" "$(sed 's/^[^ ]* //' "$CURR" | cut -c1-120 | tail -20)" + else + notify-send "🌐 Ylog" "No entries in cache." + fi + ;; +2) if [ -s "$NEW" ]; then notify-send "🌐 New log entries" "$(cat "$NEW" | sed 's/^[^ ]* //' | cut -c1-120 | tail -20)" mark_seen @@ -62,16 +70,11 @@ case $BLOCK_BUTTON in notify-send "🌐 Ylog" "No new entries." fi ;; -2) - notify-send "🌐 Ylog" "Refreshing..." - update - pkill -RTMIN+21 "${STATUSBAR:-dwmblocks}" - ;; 3) - notify-send "🌐 Ylog module" "- Shows new nginx log entries (diary/recordings/peertube/videos US) + notify-send "🌐 Ylog module" "\- Shows new nginx log entries (diary/recordings/peertube/videos US) - Updates every 30 minutes -- Left click: show new entries & mark seen -- Middle click: force refresh" +- Left click: show all current entries +- Middle click: show new entries & mark seen" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; *) diff --git a/fedora/.inputrc b/fedora/.inputrc new file mode 100644 index 0000000..81cdf85 --- /dev/null +++ b/fedora/.inputrc @@ -0,0 +1,31 @@ +$include /etc/inputrc + +set completion-display-width 0 +set completion-query-items 1000 + +# Prettyfi +set colored-stats on +set colored-completion-prefix on + +# ^C no longer shows on C-c keypress +set echo-control-characters off + +# Map tab to cycle through all the possible completions. +TAB: menu-complete + +# vi mode +set editing-mode vi + +$if mode=vi +set show-mode-in-prompt on +set vi-ins-mode-string \1\e[6 q\2 +set vi-cmd-mode-string \1\e[2 q\2 +set keymap vi-command + +# these are for vi-command mode +Control-l: clear-screen + +set keymap vi-insert +# these are for vi-insert mode +Control-l: clear-screen +$endif diff --git a/fedora/.local/bin/lazysql b/fedora/.local/bin/lazysql Binary files differnew file mode 100755 index 0000000..1fe6af4 --- /dev/null +++ b/fedora/.local/bin/lazysql |
