From 41f6e47c03d023af6f147f90cb892fea77d264dd Mon Sep 17 00:00:00 2001 From: Satyajit Roy Date: Mon, 23 Jan 2017 12:08:50 -0800 Subject: [PATCH] Adding directory toggle for prompt Budspencer sytle PWD toggle --- bobthefish_keymapping.fish | 3 +++ fish_prompt.fish | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 bobthefish_keymapping.fish diff --git a/bobthefish_keymapping.fish b/bobthefish_keymapping.fish new file mode 100644 index 0000000..38dc392 --- /dev/null +++ b/bobthefish_keymapping.fish @@ -0,0 +1,3 @@ +function fish_user_key_bindings + bind ' ' __bobthefish_dir_length # toggle PWD on NORMAL with `space bar` +end diff --git a/fish_prompt.fish b/fish_prompt.fish index ab2f45e..8196316 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -51,6 +51,16 @@ # and command hg stat > /dev/null ^&1 # end +function __bobthefish_dir_length -d "Toggle Directory length in prompt" + set -q fish_prompt_pwd_dir_length; or set -l fish_prompt_pwd_dir_length 0 + if [ $fish_prompt_pwd_dir_length -eq 0 ] + set -U fish_prompt_pwd_dir_length 1 + else + set -U fish_prompt_pwd_dir_length 0 + end + commandline -f repaint +end + function __bobthefish_git_branch -S -d 'Get the current git branch (or commitish)' set -l ref (command git symbolic-ref HEAD ^/dev/null) and echo $ref | sed "s#refs/heads/#$__bobthefish_branch_glyph #"