Skip to content

Commit

Permalink
key binding for vim mode, improve comments, fix some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickF1 committed Sep 7, 2020
1 parent af48324 commit 556b9b8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions conf.d/fzf.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions functions/__fzf_search_git_status.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
5 changes: 3 additions & 2 deletions functions/uninstall.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 556b9b8

Please sign in to comment.