ned: automatically activate ZenMode, and assume editor is nvim
This commit is contained in:
parent
470741071d
commit
a4bd82a2d9
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue