diff options
| -rwxr-xr-x | bin/common/ytlink | 20 | ||||
| -rwxr-xr-x | bin/extra/curszip | 12 | ||||
| -rw-r--r-- | bin/extra/keyboards.txt | 2 | ||||
| -rwxr-xr-x | bin/extra/qrclip | 12 | ||||
| -rwxr-xr-x | bin/extra/udict | 12 | ||||
| -rwxr-xr-x | bin/guiscripts/clipo | 4 | ||||
| -rwxr-xr-x | bin/guiscripts/clipp | 6 | ||||
| -rwxr-xr-x | bin/guiscripts/swclip (renamed from bin/guiscripts/cps) | 0 | ||||
| -rwxr-xr-x | bin/menuscripts/mmedia | 2 | ||||
| -rwxr-xr-x | bin/menuscripts/mpass | 4 | ||||
| -rwxr-xr-x | bin/menuscripts/tsh | 29 | ||||
| -rwxr-xr-x | config/common/tmux/tmux.conf | 15 | ||||
| -rw-r--r-- | config/essentials/git/config | 2 | ||||
| -rw-r--r-- | config/essentials/shell/aliases.sh | 6 | ||||
| -rw-r--r-- | config/essentials/shell/functions.sh | 2 | ||||
| -rw-r--r-- | config/essentials/zsh/.zshrc | 5 | ||||
| -rw-r--r-- | config/essentials/zsh/comp.zsh | 6 | ||||
| -rwxr-xr-x | config/extra/qrclip | 29 | ||||
| -rw-r--r-- | config/home/.zshenv | 3 | 
19 files changed, 94 insertions, 77 deletions
diff --git a/bin/common/ytlink b/bin/common/ytlink index 48be9cf..215c164 100755 --- a/bin/common/ytlink +++ b/bin/common/ytlink @@ -2,15 +2,21 @@  # convert to youtube.com/path url  # works for: -# - 'youtu.be/watch?v=xxxxxx' +# - 'youtu.be/xxxxxx'  # - 'https://piped.video/watch?v=xxxxx' +# - https://youtube.com/watch?v=xxxx -inp="$1" -[ "${inp:=$(clipo)}" ] || inp="$(cat /dev/stdin)" +# get from $1 or clipboard if empty +vid="${1:-$(clipo)}" +# The following subsitutions will try to grab the video id  # if link is http://127.0.0.1:9010/https://www.youtube.com/watch?v=7KpxsqwNF0o -inp="${inp#*/https://}" +vid="${vid#*/https://}"  # remove util scheme -inp="${inp#*//}" -inp="https://youtube.com/${inp#*/}" -printf "%s" "$inp" +vid="${vid#*//}" +# remove domain +vid="${vid#*/}" +# remove query string +vid="${vid#watch?v=}" + +printf "https://youtube.com/watch?v=%s\n" "$vid" diff --git a/bin/extra/curszip b/bin/extra/curszip index 64abdb6..0de772f 100755 --- a/bin/extra/curszip +++ b/bin/extra/curszip @@ -1,13 +1,17 @@  #!/bin/sh -list1() { find "$1" -mindepth 1 -maxdepth 1 -type "${2:-d}" -printf '%f\n'; } +# $1: dir  +# $2: type +list1() { find "$1" -mindepth 1 -maxdepth 1 -type "$2" -printf '%f\n'; } -curs="$(list1 ~/docs/school/Vakken | commander -c)" +curs="$(list1 ~/docs/school/Vakken d | dmenu -c)"  [ "$curs" ] || exit 1 -zip="$(list1 ~/dl f | fzf -f "$curs" | grep '\.zip$')"  >&2 printf "curs: %s\n" "$curs" -[ "$zip" ] || exit 1 +dldir="$(which xdg-user-dir > /dev/null 2>&1 && xdg-user-dir 'DOWNLOAD' || echo '~/dl')" + +zip="$(list1 "$dldir" f | fzf -f "$curs" | grep '\.zip$')" +[ "$zip" ] || exit 1  >&2 printf "zip: %s\n" "$zip"  cd -- ~/docs/school/Vakken/"$curs" || exit 1 diff --git a/bin/extra/keyboards.txt b/bin/extra/keyboards.txt index db004ce..d6e9b8a 100644 --- a/bin/extra/keyboards.txt +++ b/bin/extra/keyboards.txt @@ -1,2 +1,2 @@  us -us -option ctrl:swapcaps,altwin:menu_win -variant colemak +colemak -option ctrl:swapcaps,altwin:menu_win diff --git a/bin/extra/qrclip b/bin/extra/qrclip new file mode 100755 index 0000000..f9dc92e --- /dev/null +++ b/bin/extra/qrclip @@ -0,0 +1,12 @@ +#!/bin/sh +case $1 in +	'-o') +		qrencode -s 16 "$(clipo)" -o - | +			imv -w "imv - $(clipo)" - ;; +	'-s') +		qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | +			imv -w "imv - search $(clipo)" - ;; +    *) +        >&2 printf 'qrclip [-s | -o]\n' +        exit 1 +esac diff --git a/bin/extra/udict b/bin/extra/udict new file mode 100755 index 0000000..77f9747 --- /dev/null +++ b/bin/extra/udict @@ -0,0 +1,12 @@ +#!/bin/sh + +[ $# -eq 0 ] && printf '%s\n' "Usage: +    udict some term" && exit 1 + +term="$@" + +term="$(printf '%s\n' "${term}" | sed 's/ /\\/g' )" + +curl -s "https://api.urbandictionary.com/v0/define?term=${term}" | +	jq -r '.list[0] | .word, .definition' | +	sed -e 's/\[/\o033[1m/g' -e 's/\]/\o033[0m/g' -e '1s/^.*$/\o033[1;4;34m&\o033[0m/' diff --git a/bin/guiscripts/clipo b/bin/guiscripts/clipo index 078cc13..e554c24 100755 --- a/bin/guiscripts/clipo +++ b/bin/guiscripts/clipo @@ -1,6 +1,6 @@  #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j="-p"  if [ "$WAYLAND_DISPLAY" ]  then wl-paste -n "$1" -else xclip -o -selection "${arg:-clipboard}" -r +else xsel -o ${j:--b}  fi diff --git a/bin/guiscripts/clipp b/bin/guiscripts/clipp index c9e4f51..c3ee8f2 100755 --- a/bin/guiscripts/clipp +++ b/bin/guiscripts/clipp @@ -1,6 +1,6 @@  #!/bin/sh -[ "$1" = "-p" ] && arg='primary' +[ "$1" = "-p" ] && i='primary' j='-p'  if [ "$WAYLAND_DISPLAY" ] -then wl-copy -n $1 -else xclip -selection "${arg:-clipboard}" -r +then wl-copy -n $i +else xsel ${j:--b}  fi diff --git a/bin/guiscripts/cps b/bin/guiscripts/swclip index 1cae135..1cae135 100755 --- a/bin/guiscripts/cps +++ b/bin/guiscripts/swclip diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia index 63d3f7b..3141c3b 100755 --- a/bin/menuscripts/mmedia +++ b/bin/menuscripts/mmedia @@ -51,7 +51,7 @@ choice="$(  	grep "$regex" |  	sort | tee "$tmp" |  	concat_path | -	dmenu -px -c -n -x -l 10 -g 1 -F)" +	dmenu -px -c -i -l 10 -g 1 -x)"  file="$(sed -n "${choice}p" "$tmp")"  [ -r "$file" ] || exit 1 diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index 7029ffe..7348321 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -14,14 +14,14 @@ list_pswds()  while [ -d "$store/$file" ]  do -	choice="$(list_pswds "$store/$file" | commander -c)" +	choice="$(list_pswds "$store/$file" | dmenu -c -g 4 -l 4)"  	[ "$choice" ] || exit 1  	[ -z "$file" ] && file="$choice" || file="$file/$choice"  done  [ "$file" ] || exit 1  pass show -c "$file" || exit 1 -notify-send -t 1000 "mpass" "copied <b>$file</b>" +notify-send -t 1000 "mpass" "copied: $file"  [ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running  	cliphist list | head -n 1 | cliphist delete diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh index eac0c3e..aac27ee 100755 --- a/bin/menuscripts/tsh +++ b/bin/menuscripts/tsh @@ -19,7 +19,7 @@ done  export results="$tmp/results"  export links="$tmp/links" -types="music anime movies shows other software games isos books" +categories="music anime movies shows other software games isos books"  if [ "$WAYLAND_DISPLAY" ]  then @@ -42,6 +42,9 @@ help ()  	                 Available options: seeds, size, name  	    -m MODULE    Select a module, if MODULE is 'list',  	                 lists out available modules +            -c CATEGORY  Select category +            -f           Do not list files +            -d		 Download without confirming  	EOF  } @@ -121,7 +124,7 @@ show_files()  # Select a type after having displayed them with 'show_types'  select_type()  { -	for type in $types +	for type in $categories  	do printf "%s\n" "$type"  	done | fzf  } @@ -131,10 +134,17 @@ trap "cleanup" EXIT  ## OPTIONS  skip=0 -while getopts ":hm:rs:" opt +while getopts ":hm:rs:c:fd" opt  do  	case $opt in  		h) help && exit ;; +		c) +			[ "$OPTARG" = "list" ] && >&2 printf '%s\n' "$categories" && exit +			category="$(printf '%s\n' "$categories" | tr ' ' '\n' | grep -m 1 "^$OPTARG")" +			[ -z "$category" ] && die "No valid category for '$OPTARG'" +			logn "category: $category" ;; +		f) noaskfiles="1" ;; +		d) noaskdownload="1" ;;  		m)  			[ "$OPTARG" = "list" ] && list_modules && exit  			module="$(list_modules | grep -m 1 "^$OPTARG")" @@ -185,17 +195,18 @@ getfunctions=1 . "$LIBPFX/$module"  # select result from "$results"  for choice in $(select_result | xargs)  do -    printf 'choice: %s\n' "$choice" +    printf 'choice: %s\n' "$(sed -n "${choice}p" "$results" | cut -f 3-)"      magnet="$(get_magnet "$choice")"      [ "$magnet" ] || exit 1 -    confirm 'files?' && show_files "$magnet" +    if [ -z "$noaskfiles" ] && confirm 'files?'; then +	    show_files "$magnet" +    fi -    if confirm 'download?' +    if [ "$noaskdownload" ] || confirm 'download?'      then -	    type="$(select_type)" -	    [ "$type" ] || exit 1 -	    transmission-remote debuc.com -a "$magnet" -w "/downloads/$type" +    	    [ "${category:-$(select_type)}" ] || exit 1 +	    transmission-remote debuc.com -a "$magnet" -w "/downloads/$category"      elif confirm "copy?"      then  	    echo "$magnet" | clipp diff --git a/config/common/tmux/tmux.conf b/config/common/tmux/tmux.conf index d8a4969..9300c97 100755 --- a/config/common/tmux/tmux.conf +++ b/config/common/tmux/tmux.conf @@ -43,11 +43,11 @@ bind  X     confirm -p "Kill Window?"   kill-window  bind  M-x   confirm -p "Kill Session?"  kill-session  bind  M-X   confirm -p "Kill Server?"   kill-server  # Restart pane -bind k run -C "respawn-pane -k; send-keys !! 'C-j'" -bind K respawn-pane -k +bind C-r run -C "respawn-pane -k; send-keys !! 'C-j'" +bind C-R respawn-pane -k  # Splitting  bind v split-window -h -c "#{pane_current_path}" -bind h split-window -v -c "#{pane_current_path}" +bind s split-window -v -c "#{pane_current_path}"  # Swapping left and right a la vim  bind -n M-H swap-pane -U  bind -n M-L swap-pane -D @@ -64,8 +64,10 @@ bind b break-pane -t :  # Reset length and shit  bind z select-layout main-vertical - - +bind-key h select-pane -L +bind-key j select-pane -D +bind-key k select-pane -U +bind-key l select-pane -R  # Pane navigating with h|j|k|l a la vim  # Smart pane switching with awareness of Vim splits. @@ -88,9 +90,6 @@ bind-key -T copy-mode-vi 'M-k' select-pane -U  bind-key -T copy-mode-vi 'M-l' select-pane -R  bind-key -T copy-mode-vi 'M-\' select-pane -l - - -  bind -n M-u previous-window  bind -n M-i next-window  # Session navigeting with S-M-u|i diff --git a/config/essentials/git/config b/config/essentials/git/config index ba81b18..99cf21e 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -12,3 +12,5 @@  	ff = false  [alias]  	change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR  $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch  --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;};  f " +[commit] +	gpgsign = true diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index 77c7684..a8b9036 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -2,7 +2,7 @@  # s/alias \([^-]\)/alias -g \1  # The most important one -alias vi='nvim' +alias vi='vis'  alias cd='z'  # Zsh specific aliases @@ -81,7 +81,7 @@ alias lst2='ls --tree -L2'  alias lst3='ls --tree -L3'  alias ls.='ls -dl .*'  which eza >/dev/null 2>&1 && -	alias ls='eza --sort extension --group-directories-first --no-time --git' || +	alias ls='eza --sort extension --group-directories-first --git' ||  	alias ls='ls --color --group-directories-first --sort=extension'  # pacman aliases @@ -195,7 +195,7 @@ alias gdate='date +%y_%m_%d-%T'  alias tpid='tail -f /dev/null --pid'  alias pwdcp='pwd | clipp'  alias gw="grep -ri" -alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} ~/proj/suckless/*/ ~/proj/personal/scripts/*/ ~/.config/emacs ~/.config/nvim | supd' +alias srcsupd='echo ~/src/{installdrier,dotfiles,password-store} ~/proj/suckless/*/ ~/.config/emacs ~/.config/nvim | supd'  # systemctl aliases  alias smc='systemctl' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 9f7f4ce..b69b775 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -109,7 +109,7 @@ clip() {  	then  		echo -n "$@" | wl-copy  	else -		echo -n "$@" | xclip -selection clipboard -rmlastnl +		echo -n "$@" | xsel -b  	fi  } diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc index 91a1618..545f9cc 100644 --- a/config/essentials/zsh/.zshrc +++ b/config/essentials/zsh/.zshrc @@ -31,17 +31,12 @@ eval "$(zoxide init zsh)"  ### Plugins  [ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh" -plug "MichaelAquilina/zsh-you-should-use"  plug "chivalryq/git-alias" -plug "kutsan/zsh-system-clipboard"  # plug "marlonrichert/zsh-autocomplete" -plug "xPMo/zsh-toggle-command-prefix"  plug "zap-zsh/fzf" -plug "zap-zsh/vim"  plug "zdharma-continuum/fast-syntax-highlighting"  plug "zsh-users/zsh-autosuggestions"  plug "zsh-users/zsh-completions" -plug "zsh-users/zsh-history-substring-search"  plug "MichaelAquilina/zsh-auto-notify"  export AUTO_NOTIFY_TITLE="zsh" diff --git a/config/essentials/zsh/comp.zsh b/config/essentials/zsh/comp.zsh index 4836111..076882d 100644 --- a/config/essentials/zsh/comp.zsh +++ b/config/essentials/zsh/comp.zsh @@ -2,11 +2,10 @@  # Find most of the stuff at https://github.com/zap-zsh/completions  zmodload zsh/complist -autoload -Uz compinit; compinit  zstyle ':compinstall' filename '/home/aluc/.zshrc'  # cache -zstyle ':completion:*' use-cache on  zstyle ':completion:*' cache-path "$ZDOTDIR/zcompcache" +zstyle ':completion:*' use-cache on  # completers  zstyle ':completion:*' completer _extensions _complete @@ -37,6 +36,9 @@ zstyle ':completion:*' keep-prefix true  # ui  zstyle ':completion:*' menu select +ZSH_COMPDUMP="$ZDOTDIR"/zcompcache +autoload -Uz compinit; compinit -d "$ZSH_COMPDUMP" +  _dotnet_zsh_complete()  {    local completions=("$(dotnet complete "$words")") diff --git a/config/extra/qrclip b/config/extra/qrclip deleted file mode 100755 index 2f5da5c..0000000 --- a/config/extra/qrclip +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -if [ "$WAYLAND_DISPLAY" ] -then -	which wl-copy > /dev/null || exit 1 -	clipp () {  -		wl-copy -	} -	clipo () {  -		wl-paste -	} -else -	which xclip > /dev/null || exit 1 -	clipp () {  -		xclip -selection clipboard -r -	} -	clipo () {  -		xclip -o -selection clipboard -r -	} -fi - -case $1 in -	'-o') -		qrencode -s 16 "$(clipo)" -o - | -			imv -w "imv - $(clipo)" - ;; -	'-s') -		qrencode -s 16 "https://duckduckgo.com/$(clipo)" -o - | -			imv -w "imv - search $(clipo)" - ;; -esac diff --git a/config/home/.zshenv b/config/home/.zshenv index 46cc3e3..1d732ab 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -93,3 +93,6 @@ export PATH="$XDG_CONFIG_HOME/cargo/bin:$PATH"  export PATH="$PATH:./node_modules/.bin"  export PATH="$PATH:$HOME/.dotnet/tools"  export PATH="$PATH:$GOPATH/bin" + +export PLAN9=/usr/lib/plan9 +export PATH="$PATH:$PLAN9/bin"  | 
