diff --git a/README.md b/README.md index 0559065..7b45e86 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,17 @@ ## requirements -`$TODOTXTPATH` needs to be set to your todo.txt path +`$TODOTXTPATH` needs to be set to your todo.txt path. : `export TODOTXTPATH=~/todo.txt` -`$VIMWIKIPATH` needs to be set to your vim wiki path +`$VIMWIKIPATH` needs to be set to your vim wiki path. : `export VIMWIKIPATH=~/wiki` +`$MYVIMRC` needs to be set to your vimrc path. +: `export MYVIMRC=~/.vimrc` + ## usage - ./dev-env.sh xn -> extract notes - ./dev-env.sh sn -> store notes +- ./dev-env.sh tmux -> open default tmux env diff --git a/dev-env.sh b/dev-env.sh index 55844d4..9864e53 100755 --- a/dev-env.sh +++ b/dev-env.sh @@ -1,15 +1,23 @@ #!/bin/sh +_notes_locations_print() +{ + echo "\t\ttodo.txt:\t$TODOTXTPATH" + echo "\t\twiki:\t\t$VIMWIKIPATH" + echo "\t\tvimrc\t\t$MYVIMRC" +} _help() { echo "dev-env.sh usage: $0 [mode]" - echo "\txn: Extract notes to $TODOTXTPATH and $VIMWIKIPATH." - echo "\tsn: Store notes from $TODOTXTPATH and $VIMWIKIPATH." + echo "\txn: Extract notes to:" + _notes_locations_print + echo "\tsn: Store notes:" + _notes_locations_print + echo "\ttmux: Launch standard tmux session." exit 1 } - _extract_notes() { if [ ! -e "./archive.tar.gz" ]; @@ -39,6 +47,16 @@ _storage_notes() exit 0 } +_launch_tmux() +{ + tmux new-session -d 'vim $TODOTXTPATH $VIMWIKIPATH/index.md' + tmux new-window 'bash' + tmux -2 attach-session -d +} + +# main + +# check for the neccessary variables if [ -z "$VIMWIKIPATH" ]; then @@ -52,10 +70,18 @@ then exit 1 fi +if [ -z "$MYVIMRC" ]; +then + echo "MYVIMRC not set." + exit 1 +fi + +# run the user's command case "$1" in sn ) _storage_notes ;; xn ) _extract_notes ;; + tmux ) _launch_tmux ;; * ) _help ;; esac