ned: change directories to the file for editor
This commit is contained in:
parent
9a04036778
commit
da5d2d9597
1 changed files with 8 additions and 7 deletions
|
@ -17,15 +17,15 @@ usage() {
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
Usage:
|
Usage:
|
||||||
ned <verb>
|
ned <verb>
|
||||||
new <folder> [note name] create a new note in the matched class folder
|
new <folder> [note name] Create a new note in the matched folder
|
||||||
[edit|ed] <folder> [note name] search for and edit a text document in a folder
|
[edit|ed] <folder> [note name] Search for and edit a text document in a folder
|
||||||
ned edit ned
|
ned Edit ned
|
||||||
help print this message
|
help Print this message
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
Right now, only the first letter of each option is considered, so \`ned n\` and \`ned neww\` do the same thing
|
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
|
Folder and file names are searched with fuzzy search
|
||||||
Will automatically activate the ZenMode nvim extension
|
Ned will automatically activate the ZenMode nvim extension
|
||||||
Current repository path: $NOTES_DIR
|
Current repository path: $NOTES_DIR
|
||||||
EOF
|
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
|
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"
|
$EDITOR_CMD "$NOTE_PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ check_setup() {
|
||||||
# Parse arguments (first character only)
|
# Parse arguments (first character only)
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
# help
|
# help
|
||||||
'--help'|'-h'|'help') usage;;
|
'--help'|'-h'|'help'|'h') usage;;
|
||||||
# create and edit new note
|
# create and edit new note
|
||||||
'new') new $@;;
|
'new') new $@;;
|
||||||
# edit an existing document or file
|
# edit an existing document or file
|
||||||
|
|
Loading…
Add table
Reference in a new issue