diff --git a/functions.sh b/functions.sh index 77bfeaf..6035310 100644 --- a/functions.sh +++ b/functions.sh @@ -36,6 +36,19 @@ notesSync() { fi } +function editFile() { + notesSync + + # Open in editor + if [ "$typora" = "t" ]; then + typora "$1" + else + vim + "$1" + fi + + clear + notesSync +} yes_or_no() { while true; do diff --git a/journal.sh b/journal.sh index c78bb8f..b1b63a9 100755 --- a/journal.sh +++ b/journal.sh @@ -42,7 +42,7 @@ function createEntry() { if [ "$typora_flag" = true ]; then typora "$full_path" > /dev/null 2>/dev/null else - vim "$full_path" + editFile "$full_path" fi } || { # Report; TODO: write log diff --git a/notes.sh b/notes.sh index 684be83..79cb898 100755 --- a/notes.sh +++ b/notes.sh @@ -6,20 +6,6 @@ getopts "t" typora; #check if -t flag is given -function editFile() { - notesSync - - # Open in editor - if [ "$typora" = "t" ]; then - typora "$1" - else - vim "$1" - fi - - clear - notesSync -} - function createNote() { { if [ "$1" = "" ]; then