-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
post
executable file
·45 lines (32 loc) · 837 Bytes
/
post
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
# vim:ft=perl:
# abstract: tool to aid me in writing a new blog post using jekyll
use strict;
my $posts_dir = "$ENV{HOME}/dev/japh.se/_posts";
#chdir($posts_dir) or die("Can not chdir to '$posts_dir': $!!\n");
my ($day, $month, $year);
(undef, undef, undef, $day, $month, $year) = localtime(time);
$year += 1900;
# read blog post title
print "title: ";
chomp(my $post_title = <STDIN>);
$post_title =~ s/\s+/-/g;
my $post_filename = sprintf(
"%s-%s-%s-%s.markdown",$year, $month, $day, $post_title
);
system($ENV{EDITOR}, "$posts_dir/$post_filename") or die "$!\n";
=pod
~/etc/vim/templates/template.markdown:
---
layout: post
title:
date:
tags:
---
vim/nancy/000-ft.vim:
au BufNewFile *.markdown
\ silent! 0r $VIMRUNTIME/templates/template.markdown
\ 0
\ exe 'normal d$A'
\ startinsert
=end