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 use { -- cheat.sh integration
'dbeniamine/cheat.sh-vim', 'dbeniamine/cheat.sh-vim',
} }
use { -- Comments (gb and gc) use { -- Comments (gb and gc)
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
config = function() config = function()
require('Comment').setup { require('Comment').setup {

View file

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