aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-12-16 21:49:40 +0100
committerTeddy Wing2017-12-16 21:49:40 +0100
commit5bb2b3a3307d3d36b539caecf1955fceaa010e0c (patch)
treecd6fffd4cd065d4100c93b40e93e0cf2f6f845e6
parent84ff19af19f6ca44c658bf4fb0f3e9d0214ae8f0 (diff)
downloadirssi-vimput-5bb2b3a3307d3d36b539caecf1955fceaa010e0c.tar.bz2
open_tmux_split: Remove filename first argument
The filename isn't useful to us any more since we can't open the FIFO directly from Vim (`vim $fifo`). But, in order to be able to close Vim after writing without it complaining that we haven't written the buffer to a file, we need to appease it by giving it a random filename.
-rw-r--r--vimput.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/vimput.pl b/vimput.pl
index ad6dea3..e76da3d 100644
--- a/vimput.pl
+++ b/vimput.pl
@@ -38,7 +38,7 @@ sub write_input {
# Open a Tmux split containing a Vim instance editing the vimput_file.
sub open_tmux_split {
- my ($filename, $fifo) = @_;
+ my ($fifo) = @_;
if (!$ENV{TMUX}) {
print 'no tmux'; # TODO: Replace with Irssi print
@@ -46,8 +46,10 @@ sub open_tmux_split {
return;
}
+ my $random_unused_filename = tmpnam();
+
# my $command = "vim ${\vimput_file}";
- my $command = "vim -c 'set buftype=acwrite' -c 'read ${\vimput_file}' -c '1 delete _' -c 'autocmd BufWriteCmd <buffer> :write $fifo | set nomodified' $filename";
+ my $command = "vim -c 'set buftype=acwrite' -c 'read ${\vimput_file}' -c '1 delete _' -c 'autocmd BufWriteCmd <buffer> :write $fifo | set nomodified' $random_unused_filename";
system('tmux', 'split-window', $command);
}
@@ -188,7 +190,7 @@ if ($pid == 0) {
# print $command_handle $fifo_path;
close $command_handle;
- open_tmux_split('rando', $fifo_path);
+ open_tmux_split($fifo_path);
mkfifo($fifo_path, 0600) or die $!;