Omit any non-vi* mode by default
This commit is contained in:
parent
34d4877abf
commit
36c007058d
|
@ -99,6 +99,10 @@ _powerline_zle_keymap_select() {
|
|||
_powerline_add_widget zle-keymap-select _powerline_zle_keymap_select
|
||||
_powerline_precmd
|
||||
|
||||
if [[ "$POWERLINE_MODE" != vi* ]] ; then
|
||||
export POWERLINE_DEFAULT_MODE="$POWERLINE_MODE"
|
||||
fi
|
||||
|
||||
trap "_powerline_tmux_set_columns" SIGWINCH
|
||||
_powerline_tmux_set_columns
|
||||
_powerline_tmux_set_pwd
|
||||
|
|
|
@ -44,19 +44,22 @@ def last_pipe_status(pl, segment_info):
|
|||
|
||||
|
||||
@requires_segment_info
|
||||
def mode(pl, segment_info, override={'vicmd': 'COMMND', 'viins': 'INSERT'}, default='main'):
|
||||
def mode(pl, segment_info, override={'vicmd': 'COMMND', 'viins': 'INSERT'}, default=None):
|
||||
'''Return the current mode.
|
||||
|
||||
:param dict override:
|
||||
dict for overriding mode strings.
|
||||
:param str default:
|
||||
If current mode is equal to this string then this segment will not get
|
||||
displayed.
|
||||
displayed. If not specified the value is taken from
|
||||
``$POWERLINE_DEFAULT_MODE`` variable. This variable is set by zsh
|
||||
bindings for any mode that does not start from ``vi``.
|
||||
'''
|
||||
mode = segment_info['mode']
|
||||
if not mode:
|
||||
pl.warn('No or empty POWERLINE_MODE variable')
|
||||
return None
|
||||
default = default or segment_info['environ'].get('POWERLINE_DEFAULT_MODE')
|
||||
if mode == default:
|
||||
return None
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue