From a4bd82a2d98cd15ba6a6ae2d9fc92eced578fb43 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Sun, 23 Jan 2022 03:20:41 -0800 Subject: [PATCH] ned: automatically activate ZenMode, and assume editor is nvim --- .config/shell/bin/ned | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.config/shell/bin/ned b/.config/shell/bin/ned index 3f75f22..d2f2af1 100755 --- a/.config/shell/bin/ned +++ b/.config/shell/bin/ned @@ -7,7 +7,8 @@ # set default values if things are unset NOTES_DIR="${NOTES_DIR:-"$HOME/Documents/college/current"}" -EDITOR="${EDITOR:-"nvim"}" +EDITOR="nvim" +EDITOR_CMD="nvim -c :ZenMode" usage() { cat <<-EOF @@ -20,6 +21,7 @@ usage() { Notes: Right now, only the first letter of each option is considered, so \`ned n\` and \`ned neww\` do the same thing Folder and file names are globbed + Will automatically activate the ZenMode nvim extension Current repository path: $NOTES_DIR EOF } @@ -34,8 +36,9 @@ edit() { exit 1 fi + # TODO: change fzf for `fd`, `fzy`, and ($3) to allow for more ergonomic use NOTE_NAME="$(cd "$NOTE_PATH" && fzf --height=10 --layout=reverse)" || exit - "$EDITOR" "$NOTES_DIR/$NOTE_NAME" + $EDITOR_CMD "$NOTE_PATH/$NOTE_NAME" } new() { @@ -53,7 +56,7 @@ new() { exit 1 fi - "$EDITOR" "$NOTE_PATH/$NOTE_NAME" + $EDITOR_CMD "$NOTE_PATH/$NOTE_NAME" } subshell() { @@ -78,7 +81,7 @@ case "${1:0:1}" in # edit an existing document or file 'e') edit $@;; # me: edit ned (the file you are looking at) - 'm') "$EDITOR" "$(realpath "$0")";; + 'm') $EDITOR "$(realpath "$0")";; *) echo "no such option";; esac