Merge remote-tracking branch 'zyx-i/zsh-emulate' into develop
This commit is contained in:
commit
72ea6730ea
|
@ -56,7 +56,7 @@ class Args(object):
|
||||||
|
|
||||||
def string(s):
|
def string(s):
|
||||||
if type(s) is bytes:
|
if type(s) is bytes:
|
||||||
return s.decode('utf-8', errors='replace')
|
return s.decode('utf-8', 'replace')
|
||||||
else:
|
else:
|
||||||
return str(s)
|
return str(s)
|
||||||
|
|
||||||
|
@ -76,6 +76,14 @@ class Environment(object):
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def __contains__(key):
|
||||||
|
try:
|
||||||
|
zsh.getvalue(key)
|
||||||
|
return True
|
||||||
|
except IndexError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
environ = Environment()
|
environ = Environment()
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,13 @@ _powerline_tmux_set_columns() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_powerline_install_precmd() {
|
_powerline_install_precmd() {
|
||||||
emulate zsh
|
emulate -L zsh
|
||||||
for f in "${precmd_functions[@]}"; do
|
for f in "${precmd_functions[@]}"; do
|
||||||
if [[ "$f" = "_powerline_precmd" ]]; then
|
if [[ "$f" = "_powerline_precmd" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
chpwd_functions+=( _powerline_tmux_set_pwd )
|
chpwd_functions+=( _powerline_tmux_set_pwd )
|
||||||
setopt promptpercent
|
|
||||||
setopt promptsubst
|
|
||||||
if zmodload zsh/zpython &>/dev/null ; then
|
if zmodload zsh/zpython &>/dev/null ; then
|
||||||
zpython 'from powerline.bindings.zsh import setup as powerline_setup'
|
zpython 'from powerline.bindings.zsh import setup as powerline_setup'
|
||||||
zpython 'powerline_setup()'
|
zpython 'powerline_setup()'
|
||||||
|
@ -37,4 +35,6 @@ _powerline_install_precmd() {
|
||||||
trap "_powerline_tmux_set_columns" SIGWINCH
|
trap "_powerline_tmux_set_columns" SIGWINCH
|
||||||
_powerline_tmux_set_columns
|
_powerline_tmux_set_columns
|
||||||
|
|
||||||
|
setopt promptpercent
|
||||||
|
setopt promptsubst
|
||||||
_powerline_install_precmd
|
_powerline_install_precmd
|
||||||
|
|
|
@ -15,7 +15,7 @@ if __name__ == '__main__':
|
||||||
args = get_argparser(description=__doc__).parse_args()
|
args = get_argparser(description=__doc__).parse_args()
|
||||||
finish_args(args)
|
finish_args(args)
|
||||||
powerline = ShellPowerline(args, run_once=True)
|
powerline = ShellPowerline(args, run_once=True)
|
||||||
segment_info = {'args': args, 'environ': os.environ},
|
segment_info = {'args': args, 'environ': os.environ}
|
||||||
if args.renderer_arg:
|
if args.renderer_arg:
|
||||||
segment_info.update(args.renderer_arg)
|
segment_info.update(args.renderer_arg)
|
||||||
rendered = powerline.render(
|
rendered = powerline.render(
|
||||||
|
|
|
@ -9,3 +9,4 @@ if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
|
||||||
pip install unittest2 argparse
|
pip install unittest2 argparse
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
true
|
||||||
|
|
Loading…
Reference in New Issue