mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-10 15:50:56 +00:00
Merge branch 'mjwhitta-master'
This commit is contained in:
commit
829c7f909c
@ -476,7 +476,7 @@ speed of the traversal.
|
||||
```sh
|
||||
# Copy the original fzf function to __fzf
|
||||
declare -f __fzf > /dev/null ||
|
||||
eval "$(echo "__fzf() {"; declare -f fzf | grep -v '^{' | tail -n +2)"
|
||||
eval "$(echo "__fzf() {"; declare -f fzf | \grep -v '^{' | tail -n +2)"
|
||||
|
||||
# Use git ls-tree when possible
|
||||
fzf() {
|
||||
|
@ -119,7 +119,7 @@ _fzf_list_completion() {
|
||||
elif [ -n "$_fzf_completion_loader" ]; then
|
||||
_completion_loader "$@"
|
||||
ret=$?
|
||||
eval $(complete | grep "\-F.* $cmd$" | _fzf_orig_completion_filter)
|
||||
eval $(complete | \grep "\-F.* $cmd$" | _fzf_orig_completion_filter)
|
||||
source $BASH_SOURCE
|
||||
return $ret
|
||||
fi
|
||||
@ -160,13 +160,13 @@ _fzf_kill_completion() {
|
||||
|
||||
_fzf_telnet_completion() {
|
||||
_fzf_list_completion '+m' "$@" << "EOF"
|
||||
grep -v '^\s*\(#\|$\)' /etc/hosts | awk '{if (length($2) > 0) {print $2}}' | sort -u
|
||||
\grep -v '^\s*\(#\|$\)' /etc/hosts | awk '{if (length($2) > 0) {print $2}}' | sort -u
|
||||
EOF
|
||||
}
|
||||
|
||||
_fzf_ssh_completion() {
|
||||
_fzf_list_completion '+m' "$@" << "EOF"
|
||||
cat <(cat ~/.ssh/config /etc/ssh/ssh_config 2> /dev/null | grep -i ^host | grep -v '*') <(grep -v '^\s*\(#\|$\)' /etc/hosts) | awk '{print $2}' | sort -u
|
||||
cat <(cat ~/.ssh/config /etc/ssh/ssh_config 2> /dev/null | \grep -i ^host | \grep -v '*') <(\grep -v '^\s*\(#\|$\)' /etc/hosts) | awk '{print $2}' | sort -u
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -201,8 +201,8 @@ x_cmds="kill ssh telnet unset unalias export"
|
||||
# Preserve existing completion
|
||||
if [ "$_fzf_completion_loaded" != '0.8.6-1' ]; then
|
||||
# Really wish I could use associative array but OSX comes with bash 3.2 :(
|
||||
eval $(complete | grep '\-F' | grep -v _fzf_ |
|
||||
grep -E " ($(echo $d_cmds $f_cmds $a_cmds $x_cmds | sed 's/ /|/g' | sed 's/+/\\+/g'))$" | _fzf_orig_completion_filter)
|
||||
eval $(complete | \grep '\-F' | \grep -v _fzf_ |
|
||||
\grep -E " ($(echo $d_cmds $f_cmds $a_cmds $x_cmds | sed 's/ /|/g' | sed 's/+/\\+/g'))$" | _fzf_orig_completion_filter)
|
||||
export _fzf_completion_loaded=0.8.6-1
|
||||
fi
|
||||
|
||||
|
12
install
12
install
@ -132,7 +132,7 @@ __fcd() {
|
||||
__use_tmux=0
|
||||
[ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ] && __use_tmux=1
|
||||
|
||||
if [ -z "$(set -o | grep '^vi.*on')" ]; then
|
||||
if [ -z "$(set -o | \grep '^vi.*on')" ]; then
|
||||
# Required to refresh the prompt after fzf
|
||||
bind '"\er": redraw-current-line'
|
||||
|
||||
@ -316,7 +316,7 @@ function fzf_key_bindings
|
||||
else
|
||||
set height 40%
|
||||
end
|
||||
if echo $height | grep -q -E '%$'
|
||||
if echo $height | \grep -q -E '%$'
|
||||
echo "-p "(echo $height | sed 's/%$//')
|
||||
else
|
||||
echo "-l $height"
|
||||
@ -337,7 +337,11 @@ append_line() {
|
||||
echo "Update $2:"
|
||||
echo " - $1"
|
||||
[ -f "$2" ] || touch "$2"
|
||||
line=$(grep -nF "$1" "$2" | sed 's/:.*//')
|
||||
if [ $# -lt 3 ]; then
|
||||
line=$(\grep -nF "$1" "$2" | sed 's/:.*//')
|
||||
else
|
||||
line=$(\grep -nF "$3" "$2" | sed 's/:.*//')
|
||||
fi
|
||||
if [ -n "$line" ]; then
|
||||
echo " - Already exists (line #$line)"
|
||||
else
|
||||
@ -349,7 +353,7 @@ append_line() {
|
||||
|
||||
echo
|
||||
for shell in bash zsh; do
|
||||
append_line "source ~/.fzf.${shell}" ~/.${shell}rc
|
||||
append_line "[ -f ~/.fzf.${shell} ] && source ~/.fzf.${shell}" ~/.${shell}rc "~/.fzf.${shell}"
|
||||
done
|
||||
|
||||
if [ $key_bindings -eq 0 -a $has_fish -eq 1 ]; then
|
||||
|
@ -29,7 +29,7 @@ remove_line() {
|
||||
line_no=1
|
||||
match=0
|
||||
while [ 1 ]; do
|
||||
line=$(sed -n "$line_no,\$p" "$src" | grep -m1 -nF "$1") || break
|
||||
line=$(sed -n "$line_no,\$p" "$src" | \grep -m1 -nF "$1") || break
|
||||
line_no=$(( $(sed 's/:.*//' <<< "$line") + line_no - 1 ))
|
||||
content=$(sed 's/^[0-9]*://' <<< "$line")
|
||||
match=1
|
||||
@ -50,7 +50,7 @@ remove_line() {
|
||||
|
||||
for shell in bash zsh; do
|
||||
remove ~/.fzf.${shell}
|
||||
remove_line "source ~/.fzf.${shell}" ~/.${shell}rc
|
||||
# remove_line "source ~/.fzf.${shell}" ~/.${shell}rc
|
||||
done
|
||||
|
||||
bind_file=~/.config/fish/functions/fish_user_key_bindings.fish
|
||||
|
Loading…
Reference in New Issue
Block a user