aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode/vim_mode.pl
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-27 22:16:44 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-27 23:10:12 +0000
commitf1d3e2e9ba4fffb7a8d5fae66000e771f6898418 (patch)
treeec00e63cd46802bb9bc2a4c06b92ec5ba05c6018 /vim-mode/vim_mode.pl
parentfixed enter key not working in cmd mode, also added pass-thru for meta-keys in (diff)
downloadirssi-scripts-f1d3e2e9ba4fffb7a8d5fae66000e771f6898418.tar.gz
irssi-scripts-f1d3e2e9ba4fffb7a8d5fae66000e771f6898418.zip
vim_mode: Remove G, instead use Ex-mode :b (:buffer) to switch windows.
Diffstat (limited to 'vim-mode/vim_mode.pl')
-rw-r--r--vim-mode/vim_mode.pl34
1 files changed, 14 insertions, 20 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 44abc99..26f950b 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -17,7 +17,6 @@
# * repeat change: .
# * change/change/yank line: cc dd yy S
# * Combinations like in Vi, e.g. d5fx
-# * goto window: 5G
#
# TODO:
# * /,?,n to search through history (like history_search.pl)
@@ -208,8 +207,6 @@ my $movements
# to end of line
'C' => { func => \&cmd_movement_dollar },
'D' => { func => \&cmd_movement_dollar },
- # change window
- 'G' => { func => \&cmd_movement_G },
# misc
'~' => { func => \&cmd_movement_tilde },
'.' => {},
@@ -638,20 +635,6 @@ sub _paste_at_position {
_input_pos($pos - 1 + length $string);
}
-sub cmd_movement_G {
- my ($count, $pos) = @_;
-
- # If no count is given go to the last window (= highest refnum).
- if (not $count) {
- $count = List::Util::max(map { $_->{refnum} } Irssi::windows());
- }
-
- my $window = Irssi::window_find_refnum($count);
- if ($window) {
- $window->set_active();
- }
-}
-
sub cmd_movement_tilde {
my ($count, $pos) = @_;
@@ -700,6 +683,18 @@ sub cmd_ex_command {
print "New line is: $line" if DEBUG;
_input($line);
+
+ } elsif ($arg_str =~ m|b(?:uffer)?\s*(.+)$|) {
+ my $window;
+ my $buffer = $1;
+
+ if ($buffer =~ /^[0-9]+$/) {
+ $window = Irssi::window_find_refnum($buffer);
+ }
+
+ if ($window) {
+ $window->set_active();
+ }
}
}
@@ -965,9 +960,8 @@ sub handle_command {
if ($skip) {
print "Skipping movement and operator." if DEBUG;
} else {
- # Make sure count is at least 1, except for G which needs to
- # handle undef specially.
- if (not $numeric_prefix and $char ne 'G') {
+ # Make sure count is at least 1.
+ if (not $numeric_prefix) {
$numeric_prefix = 1;
}