diff options
| author | Teddy Wing | 2017-12-16 21:49:40 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2017-12-16 21:49:40 +0100 | 
| commit | 5bb2b3a3307d3d36b539caecf1955fceaa010e0c (patch) | |
| tree | cd6fffd4cd065d4100c93b40e93e0cf2f6f845e6 /vimput.pl | |
| parent | 84ff19af19f6ca44c658bf4fb0f3e9d0214ae8f0 (diff) | |
| download | irssi-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.
Diffstat (limited to 'vimput.pl')
| -rw-r--r-- | vimput.pl | 8 | 
1 files changed, 5 insertions, 3 deletions
| @@ -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 $!; | 
