aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-04-08 22:49:31 +0000
committerTom Feist <shabble@metavore.org>2011-04-08 22:49:31 +0000
commit9ae4aa07f5b14a7add1b58684513218f46f80767 (patch)
tree268dca625fb3ffeb0c569e989bc380f323989f17 /vim-mode
parentadd sig_unbind as a demonstration of the signal_remove coderef bug, and a patch (diff)
downloadirssi-scripts-9ae4aa07f5b14a7add1b58684513218f46f80767.tar.gz
irssi-scripts-9ae4aa07f5b14a7add1b58684513218f46f80767.zip
vim-mode: minimal ex-mode tab-completion. Completes provided only the current
prefix allows only 1 unique completion.
Diffstat (limited to '')
-rw-r--r--vim-mode/vim_mode.pl10
1 files changed, 9 insertions, 1 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index e247e35..6ce4d22 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -2074,6 +2074,10 @@ sub _parse_mapping_bracket {
sub _parse_mapping_reverse {
my ($string) = @_;
+ if (not defined $string) {
+ _warn("Unable to reverse-map command: " . join('', @ex_buf));
+ return;
+ }
# Convert char to <char-name>.
$string =~ s/ /<Space>/g;
$string =~ s/\n/<CR>/g;
@@ -2789,7 +2793,11 @@ sub handle_command_ex {
print "Tab pressed" if DEBUG;
print "Ex buf contains: " . join('', @ex_buf) if DEBUG;
@tab_candidates = _tab_complete(join('', @ex_buf), [keys %$commands_ex]);
-
+ _debug("Candidates: " . join(", ", @tab_candidates));
+ if (@tab_candidates == 1) {
+ @ex_buf = ( split('', $tab_candidates[0]), ' ');
+ _set_prompt(':' . join '', @ex_buf);
+ }
# Ignore control characters for now.
} elsif ($key > 0 && $key < 32) {
# TODO: use them later, e.g. completion