Skip to content

Commit

Permalink
Look for editor in environment vars instead of hardcoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Borenstein committed Nov 22, 2010
1 parent eb46729 commit b84997c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vimfluence
Expand Up @@ -11,7 +11,10 @@ use Digest::MD5 qw( md5_hex );
use URI::Split qw( uri_split uri_join );


my ($wiki_url, $space, $title);
my ($wiki_url, $space, $title, $editor);

$editor = $ENV{WIKI_EDITOR} || $ENV{VISUAL} || $ENV{EDITOR};

if ($#ARGV == 1) {
# `WIKI_URL=... vimfluence SPACE "PAGE NAME"`
$space = $ARGV[0];
Expand All @@ -29,7 +32,7 @@ if ($#ARGV == 1) {
help();
exit 1;
}
#die "WIKI_URL: $wiki_url, SPACE: $space, TITLE: $title\n";
# die "EDITOR : $editor, WIKI_URL: $wiki_url, SPACE: $space, TITLE: $title\n";

my $lookup = Net::Netrc->lookup($wiki_url);
my $login = $lookup->login;
Expand All @@ -44,7 +47,8 @@ my ($fh, $filename) = mkstemps("tmpfileXXXXXX", ".confluencewiki");
print $fh $output;
close $fh;

system("vim +\"set ft=confluencewiki\" $filename");
# system("vim +\"set ft=confluencewiki\" $filename");
system("$editor $filename");
my $afterMD5 = md5_hex(readfile($filename));

if ($afterMD5 ne $initialMD5) {
Expand Down

0 comments on commit b84997c

Please sign in to comment.