Make fish bindings feature complete, add documentation

Added features:
- Updating TMUX_PWD_* when PWD variable changes
- Updating TMUX_COLUMNS_* when WINCH signal is received
This commit is contained in:
ZyX 2013-11-04 23:07:49 +04:00
parent 38f24852eb
commit 972bd45c21
2 changed files with 26 additions and 1 deletions

View File

@ -150,6 +150,16 @@ absolute path to your Powerline installation directory:
. {repository_root}/powerline/bindings/zsh/powerline.zsh
Fish prompt
^^^^^^^^^^^
Add the following line to your :file:`config.fish`, where ``{repository_root}``
is the absolute path to your Powerline installation directory:
.. code-block:: bash
. {repository_root}/powerline/bindings/fish/powerline.fish
Tmux statusline
---------------

View File

@ -6,7 +6,7 @@ function powerline
set -g -x POWERLINE_COMMAND powerline
end
end
function _powerline_update -v POWERLINE_COMMAND
function --on-variable POWERLINE_COMMAND _powerline_update
eval "
function fish_prompt
$POWERLINE_COMMAND shell left --last_exit_code=\$status --last_pipe_status=\$status
@ -17,4 +17,19 @@ function powerline
"
end
_powerline_update
function _powerline_tmux_setenv
if test -n "$TMUX"
tmux setenv -g TMUX_$argv[1]_(tmux display -p "#D" | tr -d "%") "$argv[2]"
tmux refresh -S
end
end
function --on-variable PWD _powerline_tmux_set_pwd
_powerline_tmux_setenv PWD "$PWD"
end
function --on-signal WINCH _powerline_tmux_set_columns
_powerline_tmux_setenv COLUMNS "$COLUMNS"
end
_powerline_tmux_set_columns
_powerline_tmux_set_pwd
end
powerline