diff options
author | Tom Feist <shabble@metavore.org> | 2010-11-04 21:07:07 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2010-11-04 21:07:07 +0000 |
commit | d69da7ce28152d0c8765e2073e51e66b4c1931ba (patch) | |
tree | 8bc8cbd611143d7374c2a1131244d4a75ec01a11 /vim-mode | |
parent | vim_mode: bugfix for error on :map<spc>, should be treated as just :map<ret> (diff) | |
download | irssi-scripts-d69da7ce28152d0c8765e2073e51e66b4c1931ba.tar.gz irssi-scripts-d69da7ce28152d0c8765e2073e51e66b4c1931ba.zip |
vim_mode: added a setting for 'prompt_leading_space' to determine whether the
:ex prompt is preceeded by a space.
Diffstat (limited to 'vim-mode')
-rw-r--r-- | vim-mode/vim_mode.pl | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 0eddc76..b47e959 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -516,6 +516,8 @@ my $settings start_cmd => { type => S_BOOL, value => 0 }, # not used yet max_undo_lines => { type => S_INT, value => 50 }, + # prompt_leading_space + prompt_leading_space => { type => S_BOOL, value => 1 }, }; sub DEBUG { $settings->{debug}->{value} } @@ -601,7 +603,7 @@ my $history_pos = 0; my @undo_buffer; my $undo_index = undef; - +# tab completion state vars my @tab_candidates; my $completion_active = 0; my $completion_string = ''; @@ -3111,8 +3113,11 @@ sub _update_mode { sub _set_prompt { my $msg = shift; + # add a leading space unless we're trying to clear it entirely. - $msg = ' ' . $msg if length $msg; + if (length($msg) and $settings->{prompt_leading_space}->{value}) { + $msg = ' ' . $msg; + } # escape % symbols. This prevents any _set_prompt calls from using # colouring sequences. @@ -3127,17 +3132,21 @@ sub _setting_get { my $type = $settings->{$name}->{type}; $name = "vim_mode_$name"; + my $ret = undef; + if ($type == S_BOOL) { - return Irssi::settings_get_bool($name); + $ret = Irssi::settings_get_bool($name); } elsif ($type == S_INT) { - return Irssi::settings_get_int($name); + $ret = Irssi::settings_get_int($name); } elsif ($type == S_STR) { - return Irssi::settings_get_str($name); + $ret = Irssi::settings_get_str($name); } else { _warn("Unknown setting type '$type', please report."); } - return undef; + + return $ret; } + sub _setting_set { my ($name, $value) = @_; |