From 244939b28c48de66ac71580dd1160475ea89631d Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 8 Apr 2022 13:49:06 -0700 Subject: [PATCH 1/7] minor update to dotfiles-install.sh --- .local/bin/dotfiles-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/dotfiles-install.sh b/.local/bin/dotfiles-install.sh index f548f75..0028d69 100755 --- a/.local/bin/dotfiles-install.sh +++ b/.local/bin/dotfiles-install.sh @@ -2,7 +2,7 @@ # this script will install the dotfiles from the target git repository, and back up any conflicting files # credit for this idea and basic script outline goes to https://www.atlassian.com/git/tutorials/dotfiles -# TODO: make it so like 31 (DOTFILES_BACKUP_LIST) can handle spaces +# TODO: make it so line 31 (DOTFILES_BACKUP_LIST) can handle spaces (do it in a for loop) DOTFILES_REPO_DIR="$HOME/git/dotfiles" DOTFILES_REPO_URL="https://git.blakenorth.net/dotfiles" @@ -31,7 +31,7 @@ else DOTFILES_BACKUP_LIST=($(dot checkout 2>&1 | grep -Po "(?<=\t)(.*)$")) # create directories for everything that needs one mkdir -p "$DOTFILES_BACKUP_DIR" $(printf '%s\n' "${DOTFILES_BACKUP_LIST[@]}" | grep -Po '.*/' | sed "s#.*#$DOTFILES_BACKUP_DIR/&#g") - # backup the files to avoid them being overwritten + # backup existing files to avoid them being overwritten printf '%s\n' "${DOTFILES_BACKUP_LIST[@]}" | xargs -I{} mv "$HOME"/{} "$DOTFILES_BACKUP_DIR"/{} fi From 1aac39b45379b1099a77e3eb7aa853f085c7ca29 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 8 Apr 2022 14:53:09 -0700 Subject: [PATCH 2/7] ned: `ned cd` works good now No, I do not mean "it works well." I meant what I said. --- .config/shell/bin/ned | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.config/shell/bin/ned b/.config/shell/bin/ned index 448d05a..634b3ab 100755 --- a/.config/shell/bin/ned +++ b/.config/shell/bin/ned @@ -12,7 +12,8 @@ BASE_DIR="${NOTES_DIR:-"$HOME/Documents/college/current"}" EDITOR="nvim" EDITOR_CMD="nvim -c :ZenMode" -DEFAULT_NEW_NOTE_NAME="$(date +'%m-%d').md" +DEFAULT_NEW_NOTE_EXT=.md +DEFAULT_NEW_NOTE_NAME="$(date +'%m-%d')$DEFAULT_NEW_NOTE_EXT" # Some fzf commands FZF="fzf -1 --layout=reverse --info=inline --height=10%" @@ -26,9 +27,10 @@ usage() { [edit|ed] [folder] Search for and edit a text document in a folder ned Edit ned help Print this message + cd [folder] Open a shell in a directory or the default directory Notes: - Edit 'T' to get today's note + Edit 'T' to get today's note Folder and file names are searched with fuzzy search ned will automatically activate the ZenMode neovim extension Current repository path: '$BASE_DIR' @@ -69,7 +71,7 @@ new() { # Note name if [ -n "$3" ]; then - NEW_NOTE_NAME="$3.md" + NEW_NOTE_NAME="$3" else NEW_NOTE_NAME="$DEFAULT_NEW_NOTE_NAME" fi @@ -83,7 +85,7 @@ new() { cd "$NEW_NOTE_DIR" || exit # apply a template for notes cat <<-EOF >> "$NEW_NOTE_DIR/$NEW_NOTE_NAME" - # $NEW_NOTE_NAME + # ${NEW_NOTE_NAME%%$DEFAULT_NEW_NOTE_EXT} @@ -104,10 +106,14 @@ subshell() { } shell() { - if [ -n "${1+foo}" ]; then - DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 -t d | sed 's-\./--g' | $FZF_SEARCH "$1")" || exit + if [ -n "${2+foo}" ]; then + DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 -t d | sed 's-\./--g' | $FZF_SEARCH "$2")" || exit + fi + if cd "$DIR"; then + subshell + else + exit fi - cd "$DIR" || exit } check_setup() { From fa57b1f69bac4e7118d16b6df12c50185f63bbfe Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Sun, 10 Apr 2022 03:15:07 -0700 Subject: [PATCH 3/7] shell: source env in profile --- .config/shell/profile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.config/shell/profile b/.config/shell/profile index 0e3a7fd..5d7a1dd 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -1,15 +1,15 @@ #!/bin/sh # shellcheck disable=SC2155 -export PROFILE_LOADED=false +export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}" + +. "$SHELL_CONFIG_DIR/env" # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi -export SHELL_CONFIG_DIR="${SHELL_CONFIG_DIR:-"${XDG_CONFIG_HOME:-"$HOME/.config"}/shell"}" - # Locales export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 @@ -50,6 +50,8 @@ export VDPAU_DRIVER=va_gl # Fix steam remote play black screen # shellcheck disable=SC2046 export $(dbus-launch) + + # If running in a TTY… if [ "$(tty | sed 's-[0-9]$--g')" = /dev/tty ]; then export IS_TTY=true From 83acbc6ad97e59d5003a2299a03615a703c9c12f Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Mon, 11 Apr 2022 05:41:50 -0700 Subject: [PATCH 4/7] nvim: oh cool, I don't need the '\\ ' --- .config/nvim/lua/blake/settings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/nvim/lua/blake/settings.lua b/.config/nvim/lua/blake/settings.lua index 4904d03..0d6aa20 100644 --- a/.config/nvim/lua/blake/settings.lua +++ b/.config/nvim/lua/blake/settings.lua @@ -104,7 +104,7 @@ vim.cmd 'let g:markdown_fenced_languages = [ "bash=sh", "javascript", "cpp=cpp", --- autocmd's --- -- Set comment strings -vim.cmd 'autocmd FileType crontab set commentstring=#\\ %s' +vim.cmd 'autocmd FileType crontab set commentstring=#%s' -- vim.cmd 'autocmd FileType rmd set commentstring=' -- Automatically jump to the last position in a file when opening From ce104e4922fbfd0df430ba525d6d5e550b067945 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 13 Apr 2022 01:36:06 -0700 Subject: [PATCH 5/7] ned: fixed notes not being put in the notes dir --- .config/shell/bin/ned | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/shell/bin/ned b/.config/shell/bin/ned index 634b3ab..2a5798b 100755 --- a/.config/shell/bin/ned +++ b/.config/shell/bin/ned @@ -77,7 +77,9 @@ new() { fi # Note dir - NEW_NOTE_DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 | sed 's-\./--g' | $FZF_SEARCH "$2")" || exit + NEW_NOTE_DIR="$BASE_DIR/$(cd "$BASE_DIR" && fd -d 1 | sed 's-\./--g' | $FZF_SEARCH "$2")/notes" || exit + + [ -d "${NEW_NOTE_DIR%/*}" ] || mkdir "${NEW_NOTE_DIR%/*}" if [ -f "$NEW_NOTE_DIR/$NEW_NOTE_NAME" ]; then open_file "$NEW_NOTE_DIR/$NEW_NOTE_NAME" @@ -85,7 +87,7 @@ new() { cd "$NEW_NOTE_DIR" || exit # apply a template for notes cat <<-EOF >> "$NEW_NOTE_DIR/$NEW_NOTE_NAME" - # ${NEW_NOTE_NAME%%$DEFAULT_NEW_NOTE_EXT} + # ${NEW_NOTE_NAME%%"$DEFAULT_NEW_NOTE_EXT"} From c7623a05bd3dede6cafde3dbe9e835402ba75fde Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 13 Apr 2022 01:37:22 -0700 Subject: [PATCH 6/7] pandoc-make: allow for pandoc arguments --- .config/shell/bin/pandoc-make | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.config/shell/bin/pandoc-make b/.config/shell/bin/pandoc-make index 6f056ba..c77adb9 100755 --- a/.config/shell/bin/pandoc-make +++ b/.config/shell/bin/pandoc-make @@ -7,11 +7,16 @@ usage() { cat <<-EOF Usage: - $0 [output_type] [input_files] + $0 [output_type] [pandoc_args for file 1] [pandoc_args for file 1] [input_files] Examples: - $0 pdf *.md - $0 .docx *.md # leading .'s are automatically removed from the output name + $0 pdf *.md + $0 .docx *.md # leading .'s are automatically removed from the output format + + Note: + To put a file in pandoc arguments without having it be compiled to its own document, put a './' at the start of the path to it + You can have as many arg/file combinations you want + The argument array is cleared between input files EOF } @@ -27,13 +32,17 @@ if [[ -z "$2" ]]; then echo "error: no files specified" usage && exit 1 fi -FORMAT="$1" -SKIP_FIRST=true + +OUTPUT_FORMAT="$1" +SKIP_FIRST=true # don't process the first argument, it is the output format for FILE in "$@";do $SKIP_FIRST && SKIP_FIRST=false && continue - if [[ -f "$FILE" ]]; then - pandoc -s "$FILE" -o "${FILE%.*}.${FORMAT##.}" + if [[ -f "$FILE" ]] && [[ "${FILE:0:2}" != "./" ]]; then + pandoc -s "$FILE" "${PANDOC_ARGS[@]}" -o "${FILE%.*}.${OUTPUT_FORMAT##.}" + PANDOC_ARGS=() + else + PANDOC_ARGS+=("$FILE") fi done From 3cc0516351182472a8db5100ed3dcac9adeb1d39 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 13 Apr 2022 01:37:49 -0700 Subject: [PATCH 7/7] env: new directory shortcut --- .config/shell/env | 1 + 1 file changed, 1 insertion(+) diff --git a/.config/shell/env b/.config/shell/env index 64da3fe..04da922 100644 --- a/.config/shell/env +++ b/.config/shell/env @@ -71,5 +71,6 @@ export P10K_CONFIG_LOCATION="${P10K_CONFIG_LOCATION:-"$SHELL_CONFIG_DIR/p10k/cur ########################################### S="$SHELL_CONFIG_DIR" DD="$DOCS_DIR" +C=~/code/spu/ds2/src # vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3:ts=3