diff --git a/README.md b/README.md index df0734ff..6b060ec6 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A plugin that integrates [fzf](https://github.com/junegunn/fzf) into your [fish] ![file search](/images/file_search.png) -> Select paths from the current repository's **git status** - `Ctrl+Alt+s` (s for status, Alt to prevent overriding filter tab completion) +> Select multiple paths from the current repository's **git status** - `Ctrl+Alt+s` (s for status, Alt to prevent overriding filter tab completion) ![git status select](/images/git_status_select.png) diff --git a/conf.d/fzf.fish b/conf.d/fzf.fish index 39c336c2..432b35aa 100644 --- a/conf.d/fzf.fish +++ b/conf.d/fzf.fish @@ -14,6 +14,7 @@ if not set --query fzf_fish_custom_keybindings bind --mode insert \cr '__fzf_search_history' bind --mode insert \cv '__fzf_search_shell_variables' bind --mode insert \e\cl '__fzf_search_git_log' + bind --mode insert \e\cs '__fzf_search_git_status' end end diff --git a/functions/__fzf_search_git_status.fish b/functions/__fzf_search_git_status.fish index 1549e8ed..153b95a7 100755 --- a/functions/__fzf_search_git_status.fish +++ b/functions/__fzf_search_git_status.fish @@ -8,14 +8,15 @@ function __fzf_search_git_status --description "Search the git status of the cur fzf --ansi --multi ) if test $status -eq 0 - # don't need to string escape paths because git status automatically handles it for us + # git status --short automatically escapes the paths of most files for us so not going to bother trying to handle + # the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping") for path in $selected_paths if test (string sub --length 1 $path) = 'R' # path has been renamed and looks like "R LICENSE -> LICENSE.md" # extract the path to use from after the arrow set cleaned_path (string split -- "-> " $path)[-1] else - set cleaned_path (string sub --start=4 $path) # todo need to string escape for cases like help\ i\'m\ testing + set cleaned_path (string sub --start=4 $path) end # add a space after each path to keep them separated when inserted set cleaned_path_padded "$cleaned_path " diff --git a/functions/uninstall.fish b/functions/uninstall.fish index d2b68369..bf450dbf 100644 --- a/functions/uninstall.fish +++ b/functions/uninstall.fish @@ -3,11 +3,12 @@ if not set --query fzf_fish_custom_keybindings bind --erase --all \cf bind --erase --all \cr bind --erase --all \cv - bind --erase --all \c\el + bind --erase --all \e\cl + bind --erase --all \e\cs set_color --italics cyan echo "fzf.fish key bindings removed" set_color normal end -# Not going to erase FZF_DEFAULT_OPTS because too hard to tell if it set by the user or by this plugin +# Not going to erase FZF_DEFAULT_OPTS because too hard to tell if it was set by the user or by this plugin