From c10b15767ad49a97814547ef2afb646f1f29a230 Mon Sep 17 00:00:00 2001 From: z3rOR0ne Date: Thu, 8 Dec 2022 13:24:52 -0800 Subject: [PATCH] :memo: Many updates --- aliases | 8 +++++--- nvim_custom_keys.txt | 3 +++ scripts/listargs | 44 ++++++++++++++++++++++++++++++++++++++++++++ scripts/rdir | 9 ++++++--- scripts/sdir | 23 +++++++++++------------ scripts/testman | 3 +++ updates.txt | 4 ++++ 7 files changed, 76 insertions(+), 18 deletions(-) create mode 100755 scripts/listargs create mode 100755 scripts/testman diff --git a/aliases b/aliases index 9e138ca5..68f68ca8 100644 --- a/aliases +++ b/aliases @@ -145,7 +145,6 @@ alias wifi-down="doas ifconfig wlan0 down" alias letitsnow="doas docker start snowflake-proxy" alias snowfall="doas docker stop snowflake-proxy" alias snowlogs="doas docker logs -f snowflake-proxy" -alias {lsc,lscommits}="tig" alias lxapp="lxappearance" alias hd="ncdu" # one of our most usful aliases (useful in conjunction with yank, awk, etc.): @@ -207,7 +206,7 @@ alias hwclock="doas hwclock" alias kill9="killall -9" # kills process by name, e.g. kill9 cmus alias npm_upgrade="doas npm install --location=global npm@latest" alias {pacquery,pacgrep,pacq}="pacman -Q | grep $1" -alias npm_list="find /usr/lib/node_modules -maxdepth 1 | sed -r 's/^\/usr\/lib\/node_modules\///g" +alias npm_list="find /usr/lib/node_modules -maxdepth 1 | sed -r 's/^\/usr\/lib\/node_modules\///g'" # useful alias for recursively testing .test.js files on save alias jester="jest --watchAll" alias pip_upgrade="python -m pip install --upgrade pip" @@ -272,7 +271,6 @@ alias cc="cc -Wall -Werror -Wextra" alias cprogrammingtags="ctags" alias vgrind="valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s" #create programming licences -alias license="legit" # game shortcuts # alias {cbpunk,cyberpunk}="steam steam://rungameid/1091500 &" @@ -315,6 +313,10 @@ alias morningmark="librewolf https://twitter.com/MoringmarkMark &" alias nothingnew="librewolf https://nothingnew.com &" alias wamaundies="librewolf https://wamaunderwear.com &" +# Linux related +alias elixir="librewolf https://exlir.bootlin.com/ &" +alias lwn="librewolf https://lwn.net/ &" + # Podcasts (downloadable using yt-dlp or wget, and playable using mpv) alias {1up,1upsmanship}="librewolf https://www.iheart.com/podcast/1119-1upsmanship-97574019/ &" alias smallbeans="librewolf https://soundcloud.com/user-682532119 &" diff --git a/nvim_custom_keys.txt b/nvim_custom_keys.txt index 3a4259fd..f29404d3 100644 --- a/nvim_custom_keys.txt +++ b/nvim_custom_keys.txt @@ -35,10 +35,13 @@ gg - go to top of the page shift + g - go to the bottom of the page ctrl u -page up ctrl d - page down + / - forwards slash searches for the word/term you wish to jump to, just press enter once it is highlighted ? - question mark searches for the word/term you wish to jump to, just press enter once it is highlighted n - jump to the next occurence of search term entered from / or ? (/ goes forwards in document, ? goes backwards in document) N - jump to the previous occurence of search term entered from / or ? (/ goes backwards in document, ? goes forwards in document) +* - search for all occurences of the word under current cursor + :w - writes (my nneovim setup as autosave, but it's still a good feature to have) :q - quits neovim (first neovim command to learn) u - undoes last change (can be used with prepended numbers depending on how many steps you want to undo) diff --git a/scripts/listargs b/scripts/listargs new file mode 100755 index 00000000..f8598270 --- /dev/null +++ b/scripts/listargs @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# interesting things found on stack overflow regarding listing arguments and +# grabbing values of other arguments + +# while getopts h x; do + # echo "has -h"; +# done; OPTIND=0 + +# for ((i = 0; i < $#; i++)) ; do + # case "$*" in + # (-u) echo "Has -u"; + # break + # esac +# done + +list=( agpl-3.0 bsd-2-clause bsd-3-clause mit ) +# echo "list of arguments ${list[0]}" +for (( i = 0; i < ${#list[@]}; i++)) ; do + if [[ "agpl-3.0" == "${list[$i]}" ]] ; then + echo "yep" + exit 0 + else + echo "nope" + fi +done +# +# args=("$@") +# for (( i=0; i < $#; i++)) ; do + # j=$((i+1)) + # if [[ "${args[$i]}" == '-u' ]] ; then + # echo "$i is equal -u" + # echo "the following argument to -u is ${args[$j]}" + # fi + # echo "${!i} ${!j}" +# done + +# case "$*" in + # (-u) echo "Has -u";; +# esac + +# for arg in "$@" +# do + # echo "argument is: $arg" +# done diff --git a/scripts/rdir b/scripts/rdir index 0c22a1c8..df1093ff 100755 --- a/scripts/rdir +++ b/scripts/rdir @@ -2,7 +2,10 @@ # A simple bookmarking alias used in conjunction with sdir and our $HOME/.aliases file to bookmark our current directory to be returned to later using rdir. -# grabs the current $sdir environment variable -source $HOME/.zshrc +# grabs the rc file of preferred shell (only works with bash and zsh currently) +shellrc=.$(echo "$SHELL" | awk -F '/' '{ print $NF }')rc -cd $sdir && ls +# grabs the current $sdir environment variable +source "$HOME"/"$shellrc" + +cd "$sdir" && ls diff --git a/scripts/sdir b/scripts/sdir index 47f26e87..ac253bb1 100755 --- a/scripts/sdir +++ b/scripts/sdir @@ -1,23 +1,22 @@ #!/bin/bash - # A simple bookmarking alias used in conjunction with rdir and our $HOME/.aliases file to bookmark our current directory to be returned to later using rdir. +# make sure we don't overwrite our .shrc +set -o noclobber +# save our current working directory +sdir=$(pwd) +# grabs the rc file of preferred shell (only works with bash and zsh currently) +shellrc=.$(echo "$SHELL" | awk -F '/' '{ print $NF }')rc # grabs the last line of our .zshrc, and grabs the first word -last_line_first_word=$(awk '{w=$1} END{print w}' $HOME/.zshrc) +last_line_first_word=$(awk '{w=$1} END{print w}' "$HOME"/"$shellrc") # if the last line of our rc file begins with "export"... # remove the last line of our rc file if [[ $last_line_first_word == "export" ]] ; then - sed -i '$ d' $HOME/.zshrc + sed -i '$ d' "$HOME"/"$shellrc" fi -# save our current working directory -sdir=$(pwd) - -# make sure we don't overwrite our .zshrc -set -o noclobber - -# and write that directory temporarily, appending it onto the end of our .zshrc -echo 'export sdir='$sdir >> $HOME/.zshrc +# and write that directory temporarily, appending it onto the end of our rc +echo 'export sdir='"$sdir" >> "$HOME"/"$shellrc" # immediately source it to use it in this shell session -source $HOME/.zshrc +source "$HOME"/"$shellrc" diff --git a/scripts/testman b/scripts/testman new file mode 100755 index 00000000..ad7377b1 --- /dev/null +++ b/scripts/testman @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +groff -Tascii -man "$1" | less diff --git a/updates.txt b/updates.txt index f6839cbc..b85a684e 100644 --- a/updates.txt +++ b/updates.txt @@ -192,3 +192,7 @@ doas pacman -S slop gifsicle libimage-exiftool-perl rebuild-detector keynav dvtm lowdown inotify-tools lynis socat diffstat paru dtach sherlock-git + +Install moreutils package (pretty awesome) + +doas pacman -S moreutils