Merge pull request #754 from ZyX-I/improve-bash-bindings
Improve bash bindings
This commit is contained in:
commit
5c700b8bbe
|
@ -60,3 +60,15 @@ My vim statusline is not displayed completely and has too much spaces
|
|||
* Be sure you have ``ambiwidth`` option set to ``single``.
|
||||
* Alternative: set :ref:`ambiwidth <config-common-ambiwidth>` to 2, remove fancy
|
||||
dividers (they suck when ``ambiwidth`` is set to double).
|
||||
|
||||
When using `z <https://github.com/rupa/z>` powerline shows wrong number of jobs
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This happens because `z <https://github.com/rupa/z>` is launching some jobs in
|
||||
the background from ``$POWERLINE_COMMAND`` and these jobs fail to finish before
|
||||
powerline prompt is run.
|
||||
|
||||
Solution to this problem is simple: be sure that :file:`z.sh` is sourced
|
||||
strictly after :file:`powerline/bindings/bash/powerline.sh`. This way background
|
||||
jobs are spawned by `z <https://github.com/rupa/z>` after powerline has done its
|
||||
job.
|
||||
|
|
|
@ -31,9 +31,7 @@ _powerline_tmux_set_columns() {
|
|||
|
||||
_powerline_prompt() {
|
||||
local last_exit_code=$?
|
||||
[[ -z "$POWERLINE_OLD_PROMPT_COMMAND" ]] ||
|
||||
eval $POWERLINE_OLD_PROMPT_COMMAND
|
||||
PS1="$($POWERLINE_COMMAND shell left -r bash_prompt --last_exit_code=$last_exit_code --jobnum="$(jobs|wc -l)")"
|
||||
PS1="$($POWERLINE_COMMAND shell left -r bash_prompt --last_exit_code=$last_exit_code --jobnum="$(jobs -p|wc -l)")"
|
||||
_powerline_tmux_set_pwd
|
||||
return $last_exit_code
|
||||
}
|
||||
|
@ -42,5 +40,4 @@ trap "_powerline_tmux_set_columns" SIGWINCH
|
|||
_powerline_tmux_set_columns
|
||||
|
||||
[[ "$PROMPT_COMMAND" != "${PROMPT_COMMAND/_powerline_prompt/}" ]] ||
|
||||
POWERLINE_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
|
||||
export PROMPT_COMMAND="_powerline_prompt"
|
||||
export PROMPT_COMMAND="${PROMPT_COMMAND}"$'\n'"_powerline_prompt;"
|
||||
|
|
|
@ -29,9 +29,9 @@ with codecs.open(fname, 'r', encoding='utf-8') as R:
|
|||
line = line.translate({
|
||||
ord('\r'): None
|
||||
})
|
||||
line = line.replace(pid, 'PID')
|
||||
line = line.replace(hostname, 'HOSTNAME')
|
||||
line = line.replace(user, 'USER')
|
||||
line = line.replace(pid, 'PID')
|
||||
W.write(line)
|
||||
|
||||
os.rename(new_fname, fname)
|
||||
|
|
Loading…
Reference in New Issue