Join tmux/prompt shell scripts into one common script
This commit is contained in:
parent
57876a87e9
commit
091400c84f
|
@ -16,4 +16,4 @@ trap "_powerline_tmux_set_columns" SIGWINCH
|
|||
kill -SIGWINCH "$$"
|
||||
|
||||
export PROMPT_COMMAND="_powerline_tmux_set_pwd"
|
||||
export PS1='$(powerline-prompt --last_exit_code=$? left)'
|
||||
export PS1='$(powerline shell left --last_exit_code=$?)'
|
||||
|
|
|
@ -4,8 +4,8 @@ set -g status-interval 2
|
|||
set -g status-fg colour231
|
||||
set -g status-bg colour234
|
||||
set -g status-left-length 20
|
||||
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]#(powerline-tmux left)'
|
||||
set -g status-right '#(powerline-tmux right)'
|
||||
set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]#(powerline tmux left)'
|
||||
set -g status-right '#(powerline tmux right)'
|
||||
set -g status-right-length 150
|
||||
set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[fg=colour249]#W "
|
||||
set -g window-status-current-format "#[fg=colour234,bg=colour31]#[fg=colour117,bg=colour31] #I #[fg=colour231,bold]#W #[fg=colour31,bg=colour234,nobold]"
|
||||
|
|
|
@ -25,8 +25,8 @@ _powerline_install_precmd() {
|
|||
precmd_functions+=(_powerline_precmd)
|
||||
setopt promptpercent
|
||||
setopt promptsubst
|
||||
PS1='$(powerline-prompt --renderer_module=zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus" left)'
|
||||
RPS1='$(powerline-prompt --renderer_module=zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus" right)'
|
||||
PS1='$(powerline shell left -r zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus")'
|
||||
RPS1='$(powerline shell right -r zsh_prompt --last_exit_code=$? --last_pipe_status="$pipestatus")'
|
||||
}
|
||||
|
||||
trap "_powerline_tmux_set_columns" SIGWINCH
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
'''Powerline tmux statusline.'''
|
||||
'''Powerline prompt and statusline script.'''
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
|
@ -12,12 +12,15 @@ except ImportError:
|
|||
from powerline.core import Powerline # NOQA
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('side', nargs='?', default=None, choices=('left', 'right'))
|
||||
parser.add_argument('--ext', default='tmux')
|
||||
parser.add_argument('ext', nargs=1)
|
||||
parser.add_argument('side', nargs='?', choices=('left', 'right'))
|
||||
parser.add_argument('-r', '--renderer_module', choices=('shell', 'zsh_prompt', 'tmux'))
|
||||
parser.add_argument('--last_exit_code', type=int, metavar='int')
|
||||
parser.add_argument('--last_pipe_status', metavar='list')
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parser.parse_args()
|
||||
powerline = Powerline(args.ext)
|
||||
powerline = Powerline(ext=args.ext[0], renderer_module=args.renderer_module, segment_info=args)
|
||||
rendered = powerline.renderer.render(side=args.side)
|
||||
try:
|
||||
sys.stdout.write(rendered)
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
'''Powerline prompt script.'''
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
try:
|
||||
from powerline.core import Powerline
|
||||
except ImportError:
|
||||
import os
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from powerline.core import Powerline # NOQA
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('side', nargs='?', default=None, choices=('left', 'right'))
|
||||
parser.add_argument('--renderer_module', default='shell', choices=('shell', 'zsh_prompt'))
|
||||
parser.add_argument('--ext', default='shell')
|
||||
parser.add_argument('--last_exit_code', default=None, type=int)
|
||||
parser.add_argument('--last_pipe_status', default=None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parser.parse_args()
|
||||
powerline = Powerline(ext=args.ext, renderer_module=args.renderer_module, segment_info=args)
|
||||
rendered = powerline.renderer.render(side=args.side)
|
||||
try:
|
||||
sys.stdout.write(rendered)
|
||||
except UnicodeEncodeError:
|
||||
sys.stdout.write(rendered.encode('utf-8'))
|
Loading…
Reference in New Issue