summaryrefslogtreecommitdiffstats
path: root/scripts/special_complete.pl
diff options
context:
space:
mode:
authorAlexander Færøy2014-05-31 13:10:46 +0200
committerAlexander Færøy2014-05-31 13:10:46 +0200
commit2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch)
tree1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/special_complete.pl
parent2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff)
downloadscripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/special_complete.pl')
-rw-r--r--scripts/special_complete.pl30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/special_complete.pl b/scripts/special_complete.pl
new file mode 100644
index 0000000..d8f0672
--- /dev/null
+++ b/scripts/special_complete.pl
@@ -0,0 +1,30 @@
+use strict;
+use vars qw($VERSION %IRSSI);
+use Irssi;
+$VERSION = '1.1';
+%IRSSI = (
+ authors => 'Wouter Coekaerts',
+ contact => 'wouter@coekaerts.be, coekie@#irssi',
+ name => 'special_complete',
+ description => '(tab)complete irssi special variables (words that start with $) by evaluating them',
+ license => 'GPLv2',
+ url => 'http://wouter.coekaerts.be/irssi/',
+ changed => '28/07/03',
+);
+
+Irssi::signal_add_last 'complete word', sub {
+ my ($complist, $window, $word, $linestart, $want_space) = @_;
+ if ($word =~ /^\$/){
+ my $evaluated;
+ if (Irssi::active_win->{'active'}) {
+ $evaluated = Irssi::active_win->{'active'}->parse_special($word);
+ } elsif (Irssi::active_win->{'active_server'}) {
+ $evaluated = Irssi::active_win->{'active_server'}->parse_special($word);
+ } else {
+ $evaluated = Irssi::parse_special($word);
+ }
+ if ($evaluated ne '') {
+ push @$complist, $evaluated;
+ }
+ }
+};