diff options
| author | Teddy Wing | 2017-12-15 22:23:43 +0100 |
|---|---|---|
| committer | Teddy Wing | 2017-12-15 22:25:05 +0100 |
| commit | 8e4cc4df3ee71010ec9654112f1bd9d588f64e9e (patch) | |
| tree | e6041a4d2e8b0870d88a5028a68ca3ba27972439 | |
| parent | 68569622cdd6390ed19ae1fed540d3485b956871 (diff) | |
| download | irssi-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.pl | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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(); } }; |
