Ignore user-defined grep aliases
This commit is contained in:
parent
175fe158ed
commit
ce53b9b2a5
@ -476,7 +476,7 @@ speed of the traversal.
|
|||||||
```sh
|
```sh
|
||||||
# Copy the original fzf function to __fzf
|
# Copy the original fzf function to __fzf
|
||||||
declare -f __fzf > /dev/null ||
|
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
|
# Use git ls-tree when possible
|
||||||
fzf() {
|
fzf() {
|
||||||
|
@ -119,7 +119,7 @@ _fzf_list_completion() {
|
|||||||
elif [ -n "$_fzf_completion_loader" ]; then
|
elif [ -n "$_fzf_completion_loader" ]; then
|
||||||
_completion_loader "$@"
|
_completion_loader "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
eval $(complete | grep "\-F.* $cmd$" | _fzf_orig_completion_filter)
|
eval $(complete | \grep "\-F.* $cmd$" | _fzf_orig_completion_filter)
|
||||||
source $BASH_SOURCE
|
source $BASH_SOURCE
|
||||||
return $ret
|
return $ret
|
||||||
fi
|
fi
|
||||||
@ -160,13 +160,13 @@ _fzf_kill_completion() {
|
|||||||
|
|
||||||
_fzf_telnet_completion() {
|
_fzf_telnet_completion() {
|
||||||
_fzf_list_completion '+m' "$@" << "EOF"
|
_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
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
_fzf_ssh_completion() {
|
_fzf_ssh_completion() {
|
||||||
_fzf_list_completion '+m' "$@" << "EOF"
|
_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
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,8 +201,8 @@ x_cmds="kill ssh telnet unset unalias export"
|
|||||||
# Preserve existing completion
|
# Preserve existing completion
|
||||||
if [ "$_fzf_completion_loaded" != '0.8.6-1' ]; then
|
if [ "$_fzf_completion_loaded" != '0.8.6-1' ]; then
|
||||||
# Really wish I could use associative array but OSX comes with bash 3.2 :(
|
# Really wish I could use associative array but OSX comes with bash 3.2 :(
|
||||||
eval $(complete | grep '\-F' | grep -v _fzf_ |
|
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)
|
\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
|
export _fzf_completion_loaded=0.8.6-1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
6
install
6
install
@ -132,7 +132,7 @@ __fcd() {
|
|||||||
__use_tmux=0
|
__use_tmux=0
|
||||||
[ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ] && __use_tmux=1
|
[ -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
|
# Required to refresh the prompt after fzf
|
||||||
bind '"\er": redraw-current-line'
|
bind '"\er": redraw-current-line'
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ function fzf_key_bindings
|
|||||||
else
|
else
|
||||||
set height 40%
|
set height 40%
|
||||||
end
|
end
|
||||||
if echo $height | grep -q -E '%$'
|
if echo $height | \grep -q -E '%$'
|
||||||
echo "-p "(echo $height | sed 's/%$//')
|
echo "-p "(echo $height | sed 's/%$//')
|
||||||
else
|
else
|
||||||
echo "-l $height"
|
echo "-l $height"
|
||||||
@ -337,7 +337,7 @@ append_line() {
|
|||||||
echo "Update $2:"
|
echo "Update $2:"
|
||||||
echo " - $1"
|
echo " - $1"
|
||||||
[ -f "$2" ] || touch "$2"
|
[ -f "$2" ] || touch "$2"
|
||||||
line=$(grep -nF "$1" "$2" | sed 's/:.*//')
|
line=$(\grep -nF "$1" "$2" | sed 's/:.*//')
|
||||||
if [ -n "$line" ]; then
|
if [ -n "$line" ]; then
|
||||||
echo " - Already exists (line #$line)"
|
echo " - Already exists (line #$line)"
|
||||||
else
|
else
|
||||||
|
@ -29,7 +29,7 @@ remove_line() {
|
|||||||
line_no=1
|
line_no=1
|
||||||
match=0
|
match=0
|
||||||
while [ 1 ]; do
|
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 ))
|
line_no=$(( $(sed 's/:.*//' <<< "$line") + line_no - 1 ))
|
||||||
content=$(sed 's/^[0-9]*://' <<< "$line")
|
content=$(sed 's/^[0-9]*://' <<< "$line")
|
||||||
match=1
|
match=1
|
||||||
|
Loading…
Reference in New Issue
Block a user