aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-12-15 22:23:43 +0100
committerTeddy Wing2017-12-15 22:25:05 +0100
commit8e4cc4df3ee71010ec9654112f1bd9d588f64e9e (patch)
treee6041a4d2e8b0870d88a5028a68ca3ba27972439
parent68569622cdd6390ed19ae1fed540d3485b956871 (diff)
downloadirssi-vimput-8e4cc4df3ee71010ec9654112f1bd9d588f64e9e.tar.bz2
Open a Tmux split with the prompt contents
After writing to the file, our keyboard shortcut opens a Tmux pane with a Vim and our input message available for editing. If we're not in Tmux, we should print an error message. Need to rewrite that to print a real Irssi message.
-rw-r--r--vimput.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/vimput.pl b/vimput.pl
index 0c09d36..8563f44 100644
--- a/vimput.pl
+++ b/vimput.pl
@@ -31,10 +31,23 @@ sub write_input {
}
+# Open a Tmux split containing a Vim instance editing the tempfile.
+sub open_tmux_split {
+ if (!$ENV{TMUX}) {
+ print 'no tmux'; # TODO: Replace with Irssi print
+ return;
+ }
+
+ my $command = "vim ${\tempfile}";
+ system('tmux', 'split-window', $command);
+}
+
+
Irssi::signal_add_last 'gui key pressed' => sub {
my ($key) = @_;
if ($key eq CTRL_X) {
write_input(Irssi::parse_special('$L', undef, 0));
+ open_tmux_split();
}
};