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_add_widget zle-keymap-select _powerline_zle_keymap_select
|
||||||
_powerline_precmd
|
_powerline_precmd
|
||||||
|
|
||||||
|
if [[ "$POWERLINE_MODE" != vi* ]] ; then
|
||||||
|
export POWERLINE_DEFAULT_MODE="$POWERLINE_MODE"
|
||||||
|
fi
|
||||||
|
|
||||||
trap "_powerline_tmux_set_columns" SIGWINCH
|
trap "_powerline_tmux_set_columns" SIGWINCH
|
||||||
_powerline_tmux_set_columns
|
_powerline_tmux_set_columns
|
||||||
_powerline_tmux_set_pwd
|
_powerline_tmux_set_pwd
|
||||||
|
|
|
@ -44,19 +44,22 @@ def last_pipe_status(pl, segment_info):
|
||||||
|
|
||||||
|
|
||||||
@requires_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.
|
'''Return the current mode.
|
||||||
|
|
||||||
:param dict override:
|
:param dict override:
|
||||||
dict for overriding mode strings.
|
dict for overriding mode strings.
|
||||||
:param str default:
|
:param str default:
|
||||||
If current mode is equal to this string then this segment will not get
|
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']
|
mode = segment_info['mode']
|
||||||
if not mode:
|
if not mode:
|
||||||
pl.warn('No or empty POWERLINE_MODE variable')
|
pl.warn('No or empty POWERLINE_MODE variable')
|
||||||
return None
|
return None
|
||||||
|
default = default or segment_info['environ'].get('POWERLINE_DEFAULT_MODE')
|
||||||
if mode == default:
|
if mode == default:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue