| Age | Commit message (Collapse) | Author | 
|---|
|  | Add a simple fork that creates a pipe between the parent and child
processes so they can communicate with one another, passes a message
from the child to the parent, and prints that message to the Irssi
window.
Thanks to these plugins which I used as invaluable examples:
https://github.com/shabble/irssi-scripts/blob/master/feature-tests/pipes.pl
https://github.com/irssi/scripts.irssi.org/blob/d62bb05a34ffd6d8d0f719c551d8e454880ef8e1/scripts/chansearch.pl
https://github.com/irssi/scripts.irssi.org/blob/d62bb05a34ffd6d8d0f719c551d8e454880ef8e1/scripts/shortenurl.pl
https://github.com/irssi/scripts.irssi.org/blob/d62bb05a34ffd6d8d0f719c551d8e454880ef8e1/scripts/dns.pl | 
|  | After a ton of trial and error, I have something that kind of works.
Couldn't figure out forking for the moment, so this does block Irssi.
And if you do something like change the window layout in Tmux with
<prefix>-M-1, it messes up and closes the FIFO prematurely.
Key points were:
* Opening Vim before making the FIFO, otherwise Vim will block and not
  start.
* Opening Vim with a random other file instead of the FIFO because it
  hasn't been created yet. On write, Vim is set up to write to the FIFO.
Luckily chat messages don't get messed up when the interface blocks, but
I'd like to fix that urgently. | 
|  | All kinds of things wrong with this, I'm just fiddling to try to see if
I can get something to work. This blocks Irssi, which is bad.
* Rename `tempfile` to `vimput_file` so as not to collide with the
  `tempfile()` function that creates a temporary file.
* Add a new sub that ostensibly is supposed to read from a file handle
  and print the message received.
Read
https://github.com/shabble/irssi-docs/wiki/Guide#Dealing-with-Blocking-IO
and
https://github.com/shabble/irssi-scripts/blob/master/feature-tests/pipes.pl
I feel like I have a better idea of how to deal with this using `fork`. | 
|  |  | 
|  |  | 
|  | 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. | 
|  | Instead of writing the input message to a file on every key press, only
write when Ctrl-X is pressed. This will be our command for opening Vim. | 
|  | 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. | 
|  | Learned about the Perl `our` keyword from
https://github.com/shabble/irssi-docs/wiki/Guide#preamble which
recommends using it. This allows us to eliminate the `use vars` line.
Neat. | 
|  | Yes! Managed to read the current input line contents. Print this out on
every key press.
Thanks to these resources:
Key press signal:
https://github.com/shabble/irssi-docs/wiki/Signals#gui-readlinec
Getting input line contents:
https://github.com/shabble/irssi-docs/wiki/Irssi#getting-the-input-field-contents
https://github.com/irssi/scripts.irssi.org/blob/master/scripts/per_window_prompt.pl |