From f94c1202afce479d61ff833d8cd05fe417c98288 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Thu, 8 Apr 2021 16:38:30 +0530 Subject: enabled golang and other modules in starship, trying to push to this repo after messing everything up --- .config/lf/draw_img | 67 -------------------- .config/lf/image | 17 ----- .config/lf/lfrc | 178 ---------------------------------------------------- .config/lf/preview | 48 -------------- .config/lf/pv | 9 --- 5 files changed, 319 deletions(-) delete mode 100755 .config/lf/draw_img delete mode 100755 .config/lf/image delete mode 100755 .config/lf/lfrc delete mode 100755 .config/lf/preview delete mode 100644 .config/lf/pv (limited to '.config/lf') diff --git a/.config/lf/draw_img b/.config/lf/draw_img deleted file mode 100755 index 5a70d5e..0000000 --- a/.config/lf/draw_img +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -clear_screen() { - printf '\e[%sH\e[9999C\e[1J%b\e[1;%sr' \ - "$((LINES-2))" "${TMUX:+\e[2J}" "$max_items" -} - -# Get a file's mime_type. -mime_type=$(file -bi "$1") - -# File isn't an image file, give warning. -if [[ $mime_type != image/* ]]; then - lf -remote "send $id echoerr 'Not an image'" - exit -fi - -w3m_paths=(/usr/{local/,}{lib,libexec,lib64,libexec64}/w3m/w3mi*) -read -r w3m _ < <(type -p w3mimgdisplay "${w3m_paths[@]}") -read -r LINES COLUMNS < <(stty size) - -# Get terminal window size in pixels and set it to WIDTH and HEIGHT. -export $(xdotool getactivewindow getwindowgeometry --shell) - -# Get the image size in pixels. -read -r img_width img_height < <("$w3m" <<< "5;${CACHE:-$1}") - -((img_width > WIDTH)) && { - ((img_height=img_height*WIDTH/img_width)) - ((img_width=WIDTH)) -} - -((img_height > HEIGHT)) && { - ((img_width=img_width*HEIGHT/img_height)) - ((img_height=HEIGHT)) -} - -# Variable needed for centering image. -HALF_HEIGHT=$(expr $HEIGHT / 2) -HALF_WIDTH=$(expr $WIDTH / 2) -HALF_IMG_HEIGHT=$(expr $img_height / 2) -HALF_IMG_WIDTH=$(expr $img_width / 2) -X_POS=$(expr $HALF_WIDTH - $HALF_IMG_WIDTH) -Y_POS=$(expr $HALF_HEIGHT - $HALF_IMG_HEIGHT) - -clear_screen -# Hide the cursor. -printf '\e[?25l' - -# Display the image. -printf '0;1;%s;%s;%s;%s;;;;;%s\n3;\n4\n' \ - ${X_POS:-0} \ - ${Y_POS:-0} \ - "$img_width" \ - "$img_height" \ - "${CACHE:-$1}" | "$w3m" &>/dev/null - -# Wait for user input. -read -ern 1 - -# Clear the image. -printf '6;%s;%s;%s;%s\n3;' \ - "${X_POS:-0}" \ - "${Y_POS:-0}" \ - "$WIDTH" \ - "$HEIGHT" | "$w3m" &>/dev/null - -clear_screen diff --git a/.config/lf/image b/.config/lf/image deleted file mode 100755 index db64bf2..0000000 --- a/.config/lf/image +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -readonly ID_PREVIEW="preview" -main() { - case "$1" in - "clear") - declare -p -A cmd=([action]=remove [identifier]="$ID_PREVIEW") \ - > "$FIFO_UEBERZUG" - ;; - "draw") - declare -p -A cmd=([action]=add [identifier]="$ID_PREVIEW" \ - [x]="$3" [y]="$4" [max_width]="$5" [max_height]="$6" \ - [path]="$2") > "$FIFO_UEBERZUG" - ;; - "*") echo "Unknown command: '$1', '$2'" ;; - esac -} -main "$@" diff --git a/.config/lf/lfrc b/.config/lf/lfrc deleted file mode 100755 index 029cc8f..0000000 --- a/.config/lf/lfrc +++ /dev/null @@ -1,178 +0,0 @@ -# Basic Settings -set previewer ~/.config/lf/preview -set preview true -# set drawbox true -# set icons true -set ignorecase true -set scrolloff 1 -set shell zsh - -# unmap keys -map y -map d -map m - -# keymappings -# rename -map C rename # at the end -map c push C -map push C # new rename -map B bulk-rename # fix this - -# lf commands -map H set hidden! -map reload - -# cut/copy/paste -map p paste -map yy copy -map dd cut -map D delete - -# new files/directories -map md push :mkdir -map mf push :mkfile -map mF push :touch - -# opening files -map o push :open-with -map L open_ext -map P share - -# selecting files/globs -map t toggle - -# custom commands -cmd open ${{ - case $(file --mime-type "$f" -bL) in - text/*|application/json) $EDITOR "$f";; - *) xdg-open "$f" ;; - esac -}} - -# open in another terminal -cmd open_ext ${{ - case $(file --mime-type "$f" -bL) in - text/*|application/json) $TERMINAL "-e" $EDITOR "$f";; - *) xdg-open "$f" ;; - esac -}} - -# cmd mkdir ${{ -# set -f -# printf "Directory Name: " -# read ans -# mkdir $ans -# }} - -# cmd mkfile ${{ -# printf "File Name: " -# read ans -# $EDITOR $ans -# }} - -# cmd mkdir %mkdir "$@" -cmd mkdir %{{ - IFS=" " - mkdir -p -- "$*" - lf -remote "send $id select \"$*\"" -}} -cmd mkfile %nvim "$@" -# cmd touch %touch "$@" -cmd touch %{{ - IFS=" " - touch "$*" - lf -remote "send $id select \"$*\"" -}} - -cmd chmod ${{ - printf "Mode Bits: " - read ans - - for file in "$fx" - do - chmod $ans $file - done - - lf -remote 'send reload' -}} - -cmd open-with %"$@" $fx -cmd share $curl -F"file=@$fx" https://0x0.st | xclip -selection c - -# bulk rename non-hidden or selected files -# cmd bulk-rename ${{ -# old="$(mktemp)" -# new="$(mktemp)" -# [ -n "$fs" ] && fs="$(ls)" -# printf '%s\n' "$fs" >"$old" -# printf '%s\n' "$fs" >"$new" -# $EDITOR "$new" -# [ "$(wc -l "$new")" -ne "$(wc -l "$old")" ] && exit -# paste "$old" "$new" | while IFS= read -r names; do -# src="$(printf '%s' "$names" | cut -f1)" -# dst="$(printf '%s' "$names" | cut -f2)" -# if [ "$src" = "$dst" ] || [ -e "$dst" ]; then -# continue -# fi -# mv -- "$src" "$dst" -# done -# rm -- "$old" "$new" -# lf -remote "send $id unselect" -# }} - -# override paste with cp-p -cmd paste $cp-p --lf-paste $id - -# 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 "Unsupported 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" - -# archive mappings -map az zip -map at tar -map ag targz -map ab targz -map au unarchive - -# this runs on each directory change -cmd on-cd &{{ - # display git repository status in your prompt - source /usr/share/git/completion/git-prompt.sh - GIT_PS1_SHOWDIRTYSTATE=auto - GIT_PS1_SHOWSTASHSTATE=auto - GIT_PS1_SHOWUNTRACKEDFILES=auto - GIT_PS1_SHOWUPSTREAM=auto - GIT_PS1_COMPRESSSPARSESTATE=auto - git=$(__git_ps1 " [GIT BRANCH:> %s]") || true - fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m" - lf -remote "send $id set promptfmt \"$fmt\"" - - # update window title - printf "\033]0; $PWD\007" > /dev/tty -}} - -# set number of columns depending -# on window size on startup -# %{{ -# w=$(tput cols) -# if [ $w -le 80 ]; then -# lf -remote "send $id set ratios 1:2" -# elif [ $w -le 160 ]; then -# lf -remote "send $id set ratios 1:2:3" -# else -# lf -remote "send $id set ratios 1:2:3:5" -# fi -# }} diff --git a/.config/lf/preview b/.config/lf/preview deleted file mode 100755 index 3069a06..0000000 --- a/.config/lf/preview +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -# Clear the last preview (if any) -$HOME/.config/lf/image clear - -# Calculate where the image should be placed on the screen. -num=$(printf "%0.f\n" "`echo "$(tput cols) / 2" | bc`") -numb=$(printf "%0.f\n" "`echo "$(tput cols) - $num - 1" | bc`") -numc=$(printf "%0.f\n" "`echo "$(tput lines) - 2" | bc`") - -case "$1" in - *.tgz|*.tar.gz) tar tzf "$1";; - *.tar.bz2|*.tbz2) tar tjf "$1";; - *.tar.txz|*.txz) xz --list "$1";; - *.tar) tar tf "$1";; - *.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1";; - *.rar) unrar l "$1";; - *.7z) 7z l "$1";; - *.[1-8]) man "$1" | col -b ;; - *.o) nm "$1" | less ;; - *.torrent) transmission-show "$1";; - *.iso) iso-info --no-header -l "$1";; - *odt,*.ods,*.odp,*.sxw) odt2txt "$1";; - *.doc) catdoc "$1" ;; - *.docx) docx2txt "$1" - ;; - *.csv) cat "$1" | sed s/,/\\n/g ;; - *.pdf) - CACHE=$(mktemp /tmp/thumbcache.XXXXX) - pdftoppm -png -f 1 -singlefile "$1" "$CACHE" - $HOME/.config/lf/image draw "$CACHE.png" $num 1 $numb $numc - ;; - *.epub) - CACHE=$(mktemp /tmp/thumbcache.XXXXX) - epub-thumbnailer "$1" "$CACHE" 1024 - $HOME/.config/lf/image draw "$CACHE" $num 1 $numb $numc - ;; - *.bmp|*.jpg|*.jpeg|*.png|*.xpm) - $HOME/.config/lf/image draw "$1" $num 1 $numb $numc - ;; - *.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.flac) exiftool "$1";; - *.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx) - CACHE=$(mktemp /tmp/thumbcache.XXXXX) - ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 - $HOME/.config/lf/image draw "$CACHE" $num 1 $numb $numc - ;; - *) highlight --out-format ansi "$1" || cat "$1";; -esac - diff --git a/.config/lf/pv b/.config/lf/pv deleted file mode 100644 index 9330eed..0000000 --- a/.config/lf/pv +++ /dev/null @@ -1,9 +0,0 @@ -#!bin/sh -case "$1" in - *.tar*) tar tf "$1";; - *.zip) unzip -l "$1";; - *.rar) unrar l "$1";; - *.7z) 7z l "$1";; - *.pdf) pdftotext "$1" -;; - *) highlight -O ansi "$1";; -esac -- cgit v1.2.3