From da5d2d9597d1a74b60fbc726165bb27bc7171067 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Sun, 6 Feb 2022 22:13:57 -0800 Subject: [PATCH] ned: change directories to the file for editor --- .config/shell/bin/ned | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.config/shell/bin/ned b/.config/shell/bin/ned index eac9c8a..03d1c4a 100755 --- a/.config/shell/bin/ned +++ b/.config/shell/bin/ned @@ -17,15 +17,15 @@ usage() { cat <<-EOF Usage: ned - new [note name] create a new note in the matched class folder - [edit|ed] [note name] search for and edit a text document in a folder - ned edit ned - help print this message + new [note name] Create a new note in the matched folder + [edit|ed] [note name] Search for and edit a text document in a folder + ned Edit ned + help Print this message 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 + Folder and file names are searched with fuzzy search + Ned will automatically activate the ZenMode nvim extension Current repository path: $NOTES_DIR EOF } @@ -44,6 +44,7 @@ edit() { NOTE_PATH="$NOTES_DIR/$(cd "$NOTES_DIR" && fzf -1 -q "$SEARCH_TERM" --layout=reverse --info=inline --height=10%)" || exit + cd "$(dirname "$NOTE_PATH")" $EDITOR_CMD "$NOTE_PATH" } @@ -121,7 +122,7 @@ check_setup() { # Parse arguments (first character only) case "${1}" in # help - '--help'|'-h'|'help') usage;; + '--help'|'-h'|'help'|'h') usage;; # create and edit new note 'new') new $@;; # edit an existing document or file