From 201451a263eabc14a6788ca22f00cc63d95c8a88 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sun, 9 Jan 2011 11:55:20 +0000 Subject: ido-mode/ido_switcher: added a ido_show_active_first setting to prioritise active windows. On by default. --- ido-mode/ido_switcher.pl | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 5576b32..0ad9518 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -129,6 +129,7 @@ my $showing_help = 0; my $need_clear = 0; my $sort_ordering = "start-asc"; +my $sort_active_first = 0; # /set configurable settings my $ido_show_count; @@ -275,9 +276,10 @@ sub load_uberprompt_failed { } sub ido_switch_init { - Irssi::settings_add_bool('ido_switch', 'ido_switch_debug', 0); - Irssi::settings_add_bool('ido_switch', 'ido_use_flex', 1); - Irssi::settings_add_int ('ido_switch', 'ido_show_count', 5); + Irssi::settings_add_bool('ido_switch', 'ido_switch_debug', 0); + Irssi::settings_add_bool('ido_switch', 'ido_use_flex', 1); + Irssi::settings_add_bool('ido_switch', 'ido_show_active_first', 1); + Irssi::settings_add_int ('ido_switch', 'ido_show_count', 5); Irssi::command_bind('ido_switch_start', \&ido_switch_start); @@ -288,9 +290,10 @@ sub ido_switch_init { } sub setup_changed { - $DEBUG_ENABLED = Irssi::settings_get_bool('ido_switch_debug'); - $ido_show_count = Irssi::settings_get_int ('ido_show_count'); - $ido_use_flex = Irssi::settings_get_bool('ido_use_flex'); + $DEBUG_ENABLED = Irssi::settings_get_bool('ido_switch_debug'); + $ido_show_count = Irssi::settings_get_int ('ido_show_count'); + $ido_use_flex = Irssi::settings_get_bool('ido_use_flex'); + $sort_active_first = Irssi::settings_get_bool('ido_show_active_first'); } @@ -384,9 +387,15 @@ sub get_all_windows { my $list_ref = shift; my @ret = @$list_ref; - @ret = sort { $a->{num} <=> $b->{num} } @ret; + @ret = sort { $a->{num} <=> $b->{num} } @ret; + if ($sort_active_first) { + my @active = grep { $_->{active} } @ret; + my @inactive = grep { not $_->{active} } @ret; - return @ret; + return (@active, @inactive); + } else { + return @ret; + } } sub ido_switch_select { -- cgit v1.2.3 From fe7d7fe275acfec543c45bcbe3dd308a0b4e9e8f Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 15 Jan 2011 06:36:09 +0000 Subject: ido-mode/ido_switcher: added C-k to close windows without exiting mode --- ido-mode/ido_switcher.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 0ad9518..66628f1 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -373,7 +373,12 @@ sub get_all_windows { push @ret, { _build_win_obj($win, $item) }; } } else { - _debug_print "Error occurred reading info from window: $win"; + if (not grep { $_->{num} == $win->{refnum} } @ret) { + my $item = { _build_win_obj($win, undef) }; + $item->{name} = "Unknown"; + push @ret, $item; + } + #_debug_print "Error occurred reading info from window: $win"; #_debug_print Dumper($win); } } @@ -727,6 +732,16 @@ sub get_all_windows { Irssi::signal_stop(); return; } + if ($key == 11) { # Ctrl-K + my $sel = get_window_match(); + _debug_print("deleting entry: " . $sel->{num}); + Irssi::command("window close " . $sel->{num}); + _update_cache(); + update_matches(); + update_window_select_prompt(); + Irssi::signal_stop(); + + } if ($key == 18) { # Ctrl-R _debug_print "skipping to prev match"; -- cgit v1.2.3 From 59c17aac1a2f368b3525c2662e8010e023327055 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 19 Mar 2011 01:22:01 +0000 Subject: ido-mode/ido_switcher: switch by refnum by default, since /win goto doesn't accept a tag or server argument. --- ido-mode/ido_switcher.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 66628f1..6eeb7ca 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -74,6 +74,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# BUGS: +# +# * Sometimes selecting a channel with the same name on a different +# network will take you to the wrong channel. +# +# +# use strict; use Irssi; use Irssi::TextUI; @@ -404,11 +411,12 @@ sub get_all_windows { } sub ido_switch_select { - my ($selected) = @_; + my ($selected, $tag) = @_; _debug_print "Selecting window: " . $selected->{name}; - Irssi::command("WINDOW GOTO " . $selected->{name}); + # Irssi::command("WINDOW GOTO " . $selected->{name}); + Irssi::command("WINDOW " . $selected->{refnum}); if ($selected->{type} ne 'WIN') { _debug_print "Selecting window item: " . $selected->{itemname}; -- cgit v1.2.3 From 623734e8f9c2b1e5648ea52425ad9ea5a170858d Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 19 Mar 2011 01:26:32 +0000 Subject: ido-mode/ido_switcher: oops, /win goto, not just /win --- ido-mode/ido_switcher.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 6eeb7ca..db44523 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -416,7 +416,7 @@ sub get_all_windows { _debug_print "Selecting window: " . $selected->{name}; # Irssi::command("WINDOW GOTO " . $selected->{name}); - Irssi::command("WINDOW " . $selected->{refnum}); + Irssi::command("WINDOW GOTO" . $selected->{refnum}); if ($selected->{type} ne 'WIN') { _debug_print "Selecting window item: " . $selected->{itemname}; -- cgit v1.2.3 From 5bf1c009667372e305a52ae07afba6e226ef49f4 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 19 Mar 2011 01:29:30 +0000 Subject: ido-mode/ido_switcher: oops again, try using the actual hash key. Maybe even test it first?! --- ido-mode/ido_switcher.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index db44523..cd789f8 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -413,10 +413,10 @@ sub get_all_windows { sub ido_switch_select { my ($selected, $tag) = @_; - _debug_print "Selecting window: " . $selected->{name}; + _debug_print sprintf("Selecting window: %s (%d)", + $selected->{name}, $selected->{num}); - # Irssi::command("WINDOW GOTO " . $selected->{name}); - Irssi::command("WINDOW GOTO" . $selected->{refnum}); + Irssi::command("WINDOW GOTO" . $selected->{num}); if ($selected->{type} ne 'WIN') { _debug_print "Selecting window item: " . $selected->{itemname}; -- cgit v1.2.3 From 1d362e5a547a4eba1b6ff81334f48c808a80ba18 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Sat, 19 Mar 2011 01:30:47 +0000 Subject: ido-mode/ido_switcher: last one, I promise! --- ido-mode/ido_switcher.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index cd789f8..91da08b 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -416,7 +416,7 @@ sub get_all_windows { _debug_print sprintf("Selecting window: %s (%d)", $selected->{name}, $selected->{num}); - Irssi::command("WINDOW GOTO" . $selected->{num}); + Irssi::command("WINDOW GOTO " . $selected->{num}); if ($selected->{type} ne 'WIN') { _debug_print "Selecting window item: " . $selected->{itemname}; -- cgit v1.2.3 From 8a8ba2c51eadbc0a7ce0236ba6a04dd081f657e2 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 1 Apr 2011 06:43:04 +0100 Subject: modify all scripts to use the new script_is_loaded() function, since newer versions of perl get upset at defined(%hash). --- ido-mode/ido_switcher.pl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 91da08b..e5c5447 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -250,15 +250,9 @@ sub print_all_matches { #_print("Longtest name: $longest_name"); } - sub script_is_loaded { - my $name = shift; - _debug_print "Checking if $name is loaded"; - no strict 'refs'; - my $retval = defined %{ "Irssi::Script::${name}::" }; - use strict 'refs'; - - return $retval; - } +sub script_is_loaded { + return exists($Irssi::Script::{shift . '::'}); +} unless (script_is_loaded('uberprompt')) { -- cgit v1.2.3 From 9b4f3c204419e20bcb470b8aa04a6ffb4e35fdfb Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Fri, 1 Apr 2011 07:26:42 +0100 Subject: Bah. more fixing of script_is_loaded. --- ido-mode/ido_switcher.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index e5c5447..9f8d121 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -251,7 +251,7 @@ sub print_all_matches { } sub script_is_loaded { - return exists($Irssi::Script::{shift . '::'}); + return exists($Irssi::Script::{$_[0] . '::'}); } unless (script_is_loaded('uberprompt')) { -- cgit v1.2.3 From e977e0bfbb9a1db261389621e2d70815664744b7 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Thu, 14 Apr 2011 06:28:33 +0100 Subject: ido-mode/ido_switcher: cosmetic clean up some msglevel_* bits. --- ido-mode/ido_switcher.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 9f8d121..a5ab859 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -160,22 +160,25 @@ sub _print { my $win = Irssi::active_win; my $str = join('', @_); $need_clear = 1; - $win->print($str, Irssi::MSGLEVEL_NEVER); + $win->print($str, MSGLEVEL_NEVER); } sub _debug_print { return unless DEBUG; my $win = Irssi::active_win; my $str = join('', @_); - $win->print($str, Irssi::MSGLEVEL_CLIENTCRAP); + $win->print($str, MSGLEVEL_CLIENTCRAP); } sub _print_clear { return unless $need_clear; my $win = Irssi::active_win(); - $win->command('/scrollback levelclear -level NEVER'); + $win->command('/^scrollback levelclear -level NEVER'); } +# TODO: use the code from rl_history_search to put this into a disposable +# split win. +# TODO: create formats for this. sub display_help { my @message = -- cgit v1.2.3 From 6a1652b99b5653e60d9bf24fda1c36c5f3dd01ea Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 06:30:41 +0100 Subject: ido-mode/ido_switcher: remove an annoying debug print when switching channels/queries mode. --- ido-mode/ido_switcher.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index a5ab859..b8a604b 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -558,7 +558,7 @@ sub get_all_windows { if ($mode_type ne 'ALL') { @mode_cache = @window_cache; - @window_cache = grep { print "Type: " . $_->{type}; $_->{type} eq $mode_type } @window_cache; + @window_cache = grep { $_->{type} eq $mode_type } @window_cache; } else { @window_cache = @mode_cache if @mode_cache; } -- cgit v1.2.3 From 3ec723eeaeb417a30261cbb0ad04c397830a2616 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 07:17:13 +0100 Subject: ido-mode/ido_switcher: added options to /ido_start_switch to start in various modes. See top of file comments for details. --- ido-mode/ido_switcher.pl | 108 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 28 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index b8a604b..9747c31 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -8,6 +8,9 @@ # http://github.com/shabble/irssi-scripts/raw/master/prompt_info/uberprompt.pl # # and follow the instructions at the top of that file for installation. +# If uberprompt.pl is available, but not loaded, this script will make one +# attempt to load it before giving up. This eliminates the need to precisely +# arrange the startup order of your scripts. # # SETUP: # @@ -19,7 +22,27 @@ # # C-g (or whatever you've set the above bind to), enters window switching mode. # -# NB: When entering window switching mode, the contents of your input line will +# EXTENDED USAGE: +# +# It is possible to pass arguments to the /ido_switch_start command, which +# correspond to some of the interactively settable parameters listed below. +# The following options are available: +# +# * -channels -- search through only channels. +# * -queries -- search through only queries. +# * -all -- search both queries and channels (Default). +# * -active -- limit search to only window items with activity. +# * -exact -- enable exact-substring matching +# * -flex -- enable flex-string matching +# [If neither of -exact or -flex are given, the default is the value of +# /set ido_use_flex] +# +# EXAMPLE: +# +# /bind ^G /ido_switch_start -channels +# /bind ^F /ido_switch_start -queries -active +# +# NOTE: When entering window switching mode, the contents of your input line will # be saved and cleared, to avoid visual clutter whilst using the switching # interface. It will be restored once you exit the mode using either C-g, Esc, # or RET. @@ -76,10 +99,26 @@ # BUGS: # -# * Sometimes selecting a channel with the same name on a different +# * FIXED Sometimes selecting a channel with the same name on a different # network will take you to the wrong channel. # -# +# TODO: + +# DONE C-g - cancel +# DONE C-spc - narrow +# DONE flex matching (on by default, but optional) +# TODO server/network narrowing +# DONE colourised output (via uberprompt) +# DONE C-r / C-s rotate matches +# DONE toggle queries/channels +# DONE remove inputline content, restore it afterwards. +# TODO tab - display all possibilities in window (clean up afterwards) +# how exactly will this work? +# DONE sort by recent activity/recently used windows (separate commands?) +# TODO need to be able to switch ordering of active ones (numerical, or most recently +# active, priority to PMs/hilights, etc?) +# DONE should space auto-move forward to next window for easy stepping through +# sequential/active windows? # use strict; use Irssi; @@ -100,22 +139,10 @@ $VERSION = '2.0'; ); -# TODO: -# DONE C-g - cancel -# DONE C-spc - narrow -# DONE flex matching (on by default, but optional) -# TODO server/network narrowing -# DONE colourised output (via uberprompt) -# DONE C-r / C-s rotate matches -# DONE toggle queries/channels -# DONE remove inputline content, restore it afterwards. -# TODO tab - display all possibilities in window (clean up afterwards) -# how exactly will this work? -# DONE sort by recent activity/recently used windows (separate commands?) -# TODO need to be able to switch ordering of active ones (numerical, or most recently -# active, priority to PMs/hilights, etc?) -# DONE should space auto-move forward to next window for easy stepping through -# sequential/active windows? + +my $CMD_NAME = 'ido_switch_start'; +my $CMD_OPTS = '-channels -queries -all -active -exact -flex'; + my $input_copy = ''; my $input_pos_copy = 0; @@ -285,7 +312,9 @@ sub ido_switch_init { Irssi::settings_add_bool('ido_switch', 'ido_show_active_first', 1); Irssi::settings_add_int ('ido_switch', 'ido_show_count', 5); - Irssi::command_bind('ido_switch_start', \&ido_switch_start); + + Irssi::command_bind($CMD_NAME, \&ido_switch_start); + Irssi::command_set_options($CMD_NAME, $CMD_OPTS); Irssi::signal_add ('setup changed' => \&setup_changed); Irssi::signal_add_first('gui key pressed' => \&handle_keypress); @@ -300,23 +329,46 @@ sub setup_changed { $sort_active_first = Irssi::settings_get_bool('ido_show_active_first'); } - sub ido_switch_start { + + my ($args, $server, $witem) = @_; + # store copy of input line to restore later. $input_copy = Irssi::parse_special('$L'); $input_pos_copy = Irssi::gui_input_get_pos(); Irssi::gui_input_set(''); - # set startup flags + my $options = {}; + my @opts = Irssi::command_parse_options($CMD_NAME, $args); + if (@opts and ref($opts[0]) eq 'HASH') { + $options = $opts[0]; + print "Options: " . Dumper($options); + } + + # clear / initialise match variables. $ido_switch_active = 1; $search_str = ''; $match_index = 0; - $mode_type = 'ALL'; - # refresh in case we toggled it last time. - $ido_use_flex = Irssi::settings_get_bool('ido_use_flex'); - $active_only = 0; + # configure settings from provided arguments. + + # use provided options first, or fall back to /setting. + $ido_use_flex = exists $options->{exact} + ? 0 + : exists $options->{flex} + ? 1 + : Irssi::settings_get_bool('ido_use_flex'); + + # only select active items + $active_only = exists $options->{active}; + + # what type of items to search. + $mode_type = exists $options->{queries} + ? 'QUERY' + : exists $options->{channels} + ? 'CHANNEL' + : 'ALL'; _debug_print "Win cache: " . join(", ", map { $_->{name} } @window_cache); @@ -443,7 +495,7 @@ sub get_all_windows { # take the top $ido_show_count entries and display them. my $match_count = scalar @search_matches; my $show_count = $ido_show_count; - my $match_string = '[No match'; + my $match_string = '[No matches]'; $show_count = $match_count if $match_count < $show_count; @@ -505,7 +557,7 @@ sub get_all_windows { push @indicators, 'Active' if $active_only; push @indicators, ucfirst(lc($mode_type)); - my $flex = sprintf(' %%k[%%n%s%%k]%%n ', join ',', @indicators); + my $flex = sprintf(' %%b[%%n%s%%b]%%n ', join ', ', @indicators); my $search = ''; $search = (sprintf '`%s\': ', $search_str) if length $search_str; -- cgit v1.2.3 From 1442491a3281c17ef9930d21f0f1a9250cd51d97 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 08:00:44 +0100 Subject: converted comments to POD. I hope it's worth it. --- ido-mode/ido_switcher.pl | 293 +++++++++++++++++++++++++++++------------------ 1 file changed, 184 insertions(+), 109 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 9747c31..cd3c1de 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -1,6 +1,15 @@ -# Search and select windows similar to ido-mode for emacs -# -# INSTALL: +=pod + +=head1 NAME + +ido_switcher.pl + +=head1 DESCRIPTION + +Search and select windows similar to ido-mode for emacs + +=head1 INSTALLATION + # # This script requires that you have first installed and loaded 'uberprompt.pl' # Uberprompt can be downloaded from: @@ -12,114 +21,180 @@ # attempt to load it before giving up. This eliminates the need to precisely # arrange the startup order of your scripts. # -# SETUP: -# -# * Setup: /bind ^G /ido_switch_start -# -# * Then type ctrl-G and type what you're searching for -# -# USAGE: -# -# C-g (or whatever you've set the above bind to), enters window switching mode. -# -# EXTENDED USAGE: -# -# It is possible to pass arguments to the /ido_switch_start command, which -# correspond to some of the interactively settable parameters listed below. -# The following options are available: -# -# * -channels -- search through only channels. -# * -queries -- search through only queries. -# * -all -- search both queries and channels (Default). -# * -active -- limit search to only window items with activity. -# * -exact -- enable exact-substring matching -# * -flex -- enable flex-string matching -# [If neither of -exact or -flex are given, the default is the value of -# /set ido_use_flex] -# -# EXAMPLE: -# -# /bind ^G /ido_switch_start -channels -# /bind ^F /ido_switch_start -queries -active -# -# NOTE: When entering window switching mode, the contents of your input line will -# be saved and cleared, to avoid visual clutter whilst using the switching -# interface. It will be restored once you exit the mode using either C-g, Esc, -# or RET. -# The following key-bindings are available only once the mode has been -# activated: -# -# * C-g - cancel out of the mode without changing windows. -# * Esc - cancel out, as above. -# * C-s - rotate the list of window candidates forward by 1 -# * C-r - rotate the list of window candidates backward by 1 -# * C-e - Toggle 'Active windows only' filter -# * C-f - Switch between 'Flex' and 'Exact' matching. -# * C-d - Select a network or server to filter candidates by -# * C-u - Clear the current search string -# * C-q - Cycle between showing only queries, channels, or all. -# * C-SPC - Filter candidates by current search string, and then reset -# the search string -# * RET - Select the current head of the candidate list (the green one) -# * SPC - Select the current head of the list, without exiting the -# switching mode. The head is then moved one place to the right, -# allowing one to cycle through channels by repeatedly pressing space. -# * TAB - [currently in development] displays all possible completions -# at the bottom of the current window. -# * All other keys (a-z, A-Z, etc) - Add that character to the current search -# string. -# -# USAGE NOTES: -# -# * Using C-e (show actives), followed by repeatedly pressing space will cycle -# through all your currently active windows. -# -# * If you enter a search string fragment, and realise that more than one candidate -# is still presented, rather than delete the whole string and modify it, you can -# use C-SPC to 'lock' the current matching candidates, but allow you to search -# through those matches alone. -# -# Based in part on window_switcher.pl script Copyright 2007 Wouter Coekaerts -# -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +=head2 SETUP + +C + +=head2 USAGE + +C (or whatever you've set the above bind to), enters IDO window switching mode. +You can then type either a search string, or use one of the additional key-bindings +to change the behaviour of the search. C provides online help regarding +the possible interactive options. + +=head3 EXTENDED USAGE: + +It is possible to pass arguments to the /ido_switch_start command, which +correspond to some of the interactively settable parameters listed below. + +The following options are available: + +=over 4 + +=item C<-channels> -- search through only channels. + +=item C<-queries> -- search through only queries. + +=item C<-all> -- search both queries and channels (Default). + +=item C<-active> -- limit search to only window items with activity. + +=item C<-exact> -- enable exact-substring matching + +=item C<-flex> -- enable flex-string matching + +=back + +I or C<-flex> are given, the default is the value of +C> + +=head4 EXAMPLE + +=over 2 + +=item C + +=item C + +=back + +B When entering window switching mode, the contents of your input line will +be saved and cleared, to avoid visual clutter whilst using the switching +interface. It will be restored once you exit the mode using either C, C, +or C. + +=head3 INTERACTIVE COMMANDS + +The following key-bindings are available only once the mode has been +activated: + +=over 4 + +=item C - Exit the mode without changing windows. + +=item C - Exit, as above. + +=item C - Rotate the list of window candidates forward by 1 + +=item C - Rotate the list of window candidates backward by 1 + +=item C - Toggle 'Active windows only' filter + +=item C - Switch between 'Flex' and 'Exact' matching. + +=item C - Select a network or server to filter candidates by + +=item C - Clear the current search string + +=item C - Cycle between showing only queries, channels, or all. + +=item C - Filter candidates by current search string, and then reset + the search string + +=item C - Select the current head of the candidate list (the green one) + +=item C - Select the current head of the list, without exiting the + switching mode. The head is then moved one place to the right, + allowing one to cycle through channels by repeatedly pressing space. + +=item C - B<[currently in development]> displays all possible completions + at the bottom of the current window. + +=item I (C, etc) - Add that character to the current search + string. + +=head3 USAGE NOTES + +=over 4 + +=item Using C-e (show actives), followed by repeatedly pressing space will cycle + through all your currently active windows. + +=item If you enter a search string fragment, and realise that more than one candidate + is still presented, rather than delete the whole string and modify it, you can + use C-SPC to 'lock' the current matching candidates, but allow you to search + through those matches alone. + + +=head 1 AUTHORS + +Based originally on L script Copyright 2007 Wouter Coekaerts +Ccoekie@irssi.orgE>. + +Primary functionality Copyright 2010-2011 Tom Feist +Cshabble+irssi@metavore.orgE>. + +=head1 LICENCE + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +=head1 BUGS: + +=over 4 + +=item B Sometimes selecting a channel with the same name on a different + network will take you to the wrong channel. + +=back + +=head1 TODO + +=over 4 + +=item B C-g - cancel + +=item B C-spc - narrow + +=item B flex matching (on by default, but optional) + +=item TODO server/network narrowing + +=item B colourised output (via uberprompt) + +=item B C-r / C-s rotate matches + +=item B toggle queries/channels + +=item B remove inputline content, restore it afterwards. + +=item TODO tab - display all possibilities in window (clean up afterwards) +how exactly will this work? + +=item B sort by recent activity/recently used windows (separate commands?) + +=item B need to be able to switch ordering of active ones (numerical, or most +recently active, priority to PMs/hilights, etc?) + +=item B should space auto-move forward to next window for easy stepping + through sequential/active windows? + +=back + +=cut -# BUGS: -# -# * FIXED Sometimes selecting a channel with the same name on a different -# network will take you to the wrong channel. -# -# TODO: - -# DONE C-g - cancel -# DONE C-spc - narrow -# DONE flex matching (on by default, but optional) -# TODO server/network narrowing -# DONE colourised output (via uberprompt) -# DONE C-r / C-s rotate matches -# DONE toggle queries/channels -# DONE remove inputline content, restore it afterwards. -# TODO tab - display all possibilities in window (clean up afterwards) -# how exactly will this work? -# DONE sort by recent activity/recently used windows (separate commands?) -# TODO need to be able to switch ordering of active ones (numerical, or most recently -# active, priority to PMs/hilights, etc?) -# DONE should space auto-move forward to next window for easy stepping through -# sequential/active windows? -# use strict; use Irssi; use Irssi::TextUI; -- cgit v1.2.3 From 3e535f4e465b969c442f0bd1ce85e7b968213a27 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 08:11:21 +0100 Subject: ido-mode/ido_switcher: minor comment/ cleanup --- ido-mode/ido_switcher.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index cd3c1de..3f3d50b 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -10,17 +10,17 @@ Search and select windows similar to ido-mode for emacs =head1 INSTALLATION -# -# This script requires that you have first installed and loaded 'uberprompt.pl' -# Uberprompt can be downloaded from: -# -# http://github.com/shabble/irssi-scripts/raw/master/prompt_info/uberprompt.pl -# -# and follow the instructions at the top of that file for installation. -# If uberprompt.pl is available, but not loaded, this script will make one -# attempt to load it before giving up. This eliminates the need to precisely -# arrange the startup order of your scripts. -# +This script requires that you have first installed and loaded F + +Uberprompt can be downloaded from: + +L + +and follow the instructions at the top of that file for installation. + +If uberprompt.pl is available, but not loaded, this script will make one +attempt to load it before giving up. This eliminates the need to precisely +arrange the startup order of your scripts. =head2 SETUP -- cgit v1.2.3 From 234f117ed4e4c6125a810aa7b0c3c8276256e4af Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 08:15:38 +0100 Subject: ido-mode: fix some pod bugs and regen the readme. --- ido-mode/ido_switcher.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 3f3d50b..419d303 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -14,7 +14,7 @@ This script requires that you have first installed and loaded F Uberprompt can be downloaded from: -L +L and follow the instructions at the top of that file for installation. @@ -33,7 +33,7 @@ You can then type either a search string, or use one of the additional key-bindi to change the behaviour of the search. C provides online help regarding the possible interactive options. -=head3 EXTENDED USAGE: +=head3 EXTENDED USAGE: It is possible to pass arguments to the /ido_switch_start command, which correspond to some of the interactively settable parameters listed below. @@ -126,8 +126,9 @@ activated: use C-SPC to 'lock' the current matching candidates, but allow you to search through those matches alone. +=back -=head 1 AUTHORS +=head1 AUTHORS Based originally on L script Copyright 2007 Wouter Coekaerts Ccoekie@irssi.orgE>. -- cgit v1.2.3 From c665d369223d9c3ca1125777a3d3ac2e21ab38bc Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 08:18:43 +0100 Subject: ido-mode: final fixup. Stupidly missing =back in lists. --- ido-mode/ido_switcher.pl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 419d303..ea19afd 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -114,6 +114,8 @@ activated: =item I (C, etc) - Add that character to the current search string. +=back + =head3 USAGE NOTES =over 4 -- cgit v1.2.3 From 25af30751d22508bd7b89fbe2dc367ef8c657af1 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 15:24:48 +0100 Subject: protecting my newly podded docs against a rogue README generator. --- ido-mode/ido_switcher.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index ea19afd..81f49ff 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -16,7 +16,7 @@ Uberprompt can be downloaded from: L -and follow the instructions at the top of that file for installation. +and follow the instructions at the top of that file or its README for installation. If uberprompt.pl is available, but not loaded, this script will make one attempt to load it before giving up. This eliminates the need to precisely @@ -26,6 +26,8 @@ arrange the startup order of your scripts. C +Where C<^G> is a key of your choice. + =head2 USAGE C (or whatever you've set the above bind to), enters IDO window switching mode. -- cgit v1.2.3 From e9d28fe7464b6250132b9bbde99174f1a456d02a Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Mon, 18 Apr 2011 15:51:25 +0100 Subject: ido-mode: updated POD to try to stop the README from adding anchors everywhere. --- ido-mode/ido_switcher.pl | 113 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 35 deletions(-) (limited to 'ido-mode/ido_switcher.pl') diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl index 81f49ff..8194f8a 100644 --- a/ido-mode/ido_switcher.pl +++ b/ido-mode/ido_switcher.pl @@ -37,24 +37,36 @@ the possible interactive options. =head3 EXTENDED USAGE: -It is possible to pass arguments to the /ido_switch_start command, which +It is possible to pass arguments to the C command, which correspond to some of the interactively settable parameters listed below. The following options are available: =over 4 -=item C<-channels> -- search through only channels. +=item C<-channels> -=item C<-queries> -- search through only queries. +Search through only channels. -=item C<-all> -- search both queries and channels (Default). +=item C<-queries> -=item C<-active> -- limit search to only window items with activity. +Search through only queries. -=item C<-exact> -- enable exact-substring matching +=item C<-all> -=item C<-flex> -- enable flex-string matching +search both queries and channels (Default). + +=item C<-active> + +Lmit search to only window items with activity. + +=item C<-exact> + +Enable exact-substring matching + +=item C<-flex> + +Enable flex-string matching =back @@ -83,38 +95,65 @@ activated: =over 4 -=item C - Exit the mode without changing windows. +=item C + + Exit the mode without changing windows. + +=item C + +Exit, as above. + +=item C + +Rotate the list of window candidates forward by one item + +=item C -=item C - Exit, as above. +Rotate the list of window candidates backward by one item -=item C - Rotate the list of window candidates forward by 1 +=item C -=item C - Rotate the list of window candidates backward by 1 +Toggle 'Active windows only' filter -=item C - Toggle 'Active windows only' filter +=item C -=item C - Switch between 'Flex' and 'Exact' matching. +Switch between 'Flex' and 'Exact' matching. -=item C - Select a network or server to filter candidates by +=item C -=item C - Clear the current search string +Select a network or server to filter candidates by -=item C - Cycle between showing only queries, channels, or all. +=item C -=item C - Filter candidates by current search string, and then reset - the search string +Clear the current search string -=item C - Select the current head of the candidate list (the green one) +=item C -=item C - Select the current head of the list, without exiting the - switching mode. The head is then moved one place to the right, - allowing one to cycle through channels by repeatedly pressing space. +Cycle between showing only queries, channels, or all. -=item C - B<[currently in development]> displays all possible completions - at the bottom of the current window. +=item C -=item I (C, etc) - Add that character to the current search - string. +Filter candidates by current search string, and then reset +the search string + +=item C + +Select the current head of the candidate list (the green one) + +=item C + +Select the current head of the list, without exiting the +switching mode. The head is then moved one place to the right, +allowing one to cycle through channels by repeatedly pressing space. + +=item C + +B<[currently in development]> displays all possible completions +at the bottom of the current window. + +=item I (C, etc) + +Add that character to the current search string. =back @@ -122,13 +161,17 @@ activated: =over 4 -=item Using C-e (show actives), followed by repeatedly pressing space will cycle - through all your currently active windows. +=item * + +Using C-e (show actives), followed by repeatedly pressing space will cycle +through all your currently active windows. -=item If you enter a search string fragment, and realise that more than one candidate - is still presented, rather than delete the whole string and modify it, you can - use C-SPC to 'lock' the current matching candidates, but allow you to search - through those matches alone. +=item * + +If you enter a search string fragment, and realise that more than one candidate +is still presented, rather than delete the whole string and modify it, you +can use C-SPC to 'lock' the current matching candidates, but allow you to +search through those matches alone. =back @@ -205,9 +248,9 @@ use Irssi; use Irssi::TextUI; use Data::Dumper; -use vars qw($VERSION %IRSSI); -$VERSION = '2.0'; -%IRSSI = + +our $VERSION = '2.1'; +our %IRSSI = ( authors => 'Tom Feist, Wouter Coekaerts', contact => 'shabble+irssi@metavore.org, shabble@#irssi/freenode', -- cgit v1.2.3