aboutsummaryrefslogtreecommitdiffstats
path: root/vimput.pl
diff options
context:
space:
mode:
authorTeddy Wing2017-12-15 21:51:24 +0100
committerTeddy Wing2017-12-15 21:51:24 +0100
commite26b8d26ebfe24cee1ef9f301d3f426ca510f035 (patch)
tree8a0d25f92f9513046fe4b912f4b921220aa048e9 /vimput.pl
parent597272ba275406e6ae8e02af1065637eee53c32d (diff)
downloadirssi-vimput-e26b8d26ebfe24cee1ef9f301d3f426ca510f035.tar.bz2
Write input contents on key press
Now instead of printing the current input to the Irssi window, write it to a script-specific file. The filename is inspired by Git. I figure we'll probably want to remove the file when we're done with it. Debated between creating a real temp file and using this one. We'll decide that later.
Diffstat (limited to 'vimput.pl')
-rw-r--r--vimput.pl18
1 files changed, 17 insertions, 1 deletions
diff --git a/vimput.pl b/vimput.pl
index 971616c..7cba39c 100644
--- a/vimput.pl
+++ b/vimput.pl
@@ -12,8 +12,24 @@ our %IRSSI = {
};
+# The location of the temporary file where prompt contents are written.
+sub tempfile {
+ Irssi::get_irssi_dir() . '/VIMPUT_MSG';
+}
+
+
+# Write the given string to our tempfile.
+sub write_input {
+ my ($message) = @_;
+
+ open my $handle, '>', tempfile or die $!;
+ print $handle $message;
+ close $handle;
+}
+
+
Irssi::signal_add_last 'gui key pressed' => sub {
my ($key) = @_;
- print Irssi::parse_special('$L', undef, 0);
+ write_input(Irssi::parse_special('$L', undef, 0));
};