ned: syntax improvements

This commit is contained in:
PowerUser64 2022-02-03 15:04:38 -08:00
parent 4fd65d90a8
commit 126de5591d
2 changed files with 6 additions and 8 deletions

View file

@ -277,7 +277,7 @@ return require('packer').startup({function()
use { -- cheat.sh integration
'dbeniamine/cheat.sh-vim',
}
use { -- Comments (gb and gc)
use { -- Comments (gb and gc)
'numToStr/Comment.nvim',
config = function()
require('Comment').setup {

View file

@ -18,9 +18,9 @@ usage() {
Usage:
ned <verb>
new <folder> [note name] create a new note in the matched class folder
edit [folder] 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
help print this message
ned edit ned (the thing you just ran)
Notes:
Right now, only the first letter of each option is considered, so \`ned n\` and \`ned neww\` do the same thing
@ -53,10 +53,8 @@ new() {
# Find out note name
if [ -n "$3" ]; then
NOTE_NAME="$3.md"
elif [ -n "$2" ]; then
NOTE_NAME="$2.md"
else
NOTE_NAME="$(date +'%F').md"
NOTE_NAME="$(date +'%m-%d').md"
fi
# TODO: use fzf instead of fd + fzf for picking the directory
@ -123,13 +121,13 @@ check_setup() {
# Parse arguments (first character only)
case "${1}" in
# help
'help') usage;;
'--help'|'-h'|'help') usage;;
# create and edit new note
'new') new $@;;
# edit an existing document or file
'edit'|'ed') edit $@;;
# run a shell (cd to) in the directory
'cd'|'shell') shell;;
'x'|'cd'|'shell') shell;;
# edit ned (the file you are looking at right now)
'ned') $EDITOR "$(realpath "$0")";;
*) echo "no such option";;