Magpie is a shell script which displays small snippets of text in your shell prompt. It's useful for reminders or for keeping brief notes while you work. Magpie is compatible with bash/zsh.
Add or delete notes from the command line while you work, or open the notes file in a text editor to perform more complex editing. Your notes will refresh every time your prompt does.
To use Magpie, download the script file (magpie-notes.sh
) and the text file in which your notes will be kept (magpie-notes.txt
) and place them in your preferred directory. They do not have to be kept in the same place. You may want to put the .txt
file somewhere easy to access. Magpie lets you add/delete notes from the command line, but sometimes it's also handy to open the text file directly in an editor.
Open your copy of magpie-notes.sh
. On line 12, add the path to the location where you saved magpie-notes.txt
:
# Location of text file
file='/Users/myname/Desktop/magpie-notes.txt'
Place the following line in your shell's config file (.bashrc
), adding the path to your copy of magpie-notes.sh
:
alias magpie="ABSOLUTE_PATH_TO_THE_SCRIPTFILE"
Add to end of PS1 value in your .bashrc
file:
\n"$(magpie)"\n
Example .bashrc
file:
alias magpie="/Users/myname/Desktop/magpie/magpie-notes-script.sh"
PS1='\n\u@\w \d \T\n"$(magpie)"\n'
Note that you need to include the double quotes!
Also make sure you have source ~/.bashrc
somewhere in your .bash_profile
file.
Place the following lines in your shell's config file (.zshrc
), adding the path to your copy of magpie-notes.sh
:
setopt PROMPT_SUBST
NEWLINE=$'\n'
alias magpie="ABSOLUTE_PATH_TO_THE_SCRIPTFILE"
Add to end of PS1 value in your .zshrc
file:
${NEWLINE}`magpie`${NEWLINE}
Example .zshrc
file:
setopt PROMPT_SUBST
NEWLINE=$'\n'
PS1='%d (%D{%A, %B %e})${NEWLINE}`magpie`${NEWLINE}'
alias magpie="/Users/myname/Desktop/magpie/magpie-notes-script.sh"
From the command line, enter this command to give the script permission to execute:
chmod +x \<PATH TO YOUR MAGPIE-NOTES.SH FILE>
To add a note, type magpie add "Whatever you want to type"
:
To delete a note, type magpie del <line num>
:
You can also delete a range: magpie del 2-6
:
"Deleted" notes aren't fully gone--they're moved to the bottom of the file as a comment. You can see all current and deleted notes by opening the notes file in a text editor or by typing magpie all
:
To get rid of all your old notes, open the file in a text editor. Or if you want to entirely clear your file of all current and deleted notes and start over, type magpie clear
:
To see a quick summary of usage, including abbreviated forms of these commands, type magpie help
: