Last active
December 20, 2015 07:49
-
-
Save marcransome/6096005 to your computer and use it in GitHub Desktop.
A fish shell function that opens the default editor with a date prepended filename and the specified title for jekyll posts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jp -d "Open default editor with date prepended filename and specified title for jekyll posts." | |
set title (date +"%Y-%m-%d") | |
switch (count $argv) | |
case 0 | |
echo "No post title was specified." | |
return 1 | |
case 1 | |
set lower_arg (echo $argv[1] | tr A-Z a-z) | |
set title $title-$lower_arg.md | |
case \* | |
for arg in $argv | |
set lower_arg (echo $arg | tr A-Z a-z) | |
set title $title-$lower_arg | |
end | |
set title $title.md | |
end | |
EDITOR $title | |
end |
All text will be converted to lowercase when using the latest revision.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this file in your
~/.config/fish/functions
directory. If you haven't already defined an EDITOR function, add aneditor.fish
file to the same directory, with the following code:Finally, create a blog post about your adventures:
*Note: quotes around the post title are optional.