Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cupric
Fzf
Commits
ce53b9b2
Commit
ce53b9b2
authored
10 years ago
by
Miles Whittaker
Browse files
Options
Download
Email Patches
Plain Diff
Ignore user-defined grep aliases
parent
175fe158
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-1
README.md
fzf-completion.bash
+5
-5
fzf-completion.bash
install
+3
-3
install
uninstall
+1
-1
uninstall
with
10 additions
and
10 deletions
+10
-10
README.md
+
1
-
1
View file @
ce53b9b2
...
...
@@ -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 |
\
g
rep
-v
'^{'
|
tail
-n
+2
)
"
# Use git ls-tree when possible
fzf
()
{
...
...
This diff is collapsed.
Click to expand it.
fzf-completion.bash
+
5
-
5
View file @
ce53b9b2
...
...
@@ -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
|
\
g
rep
"
\-
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
\
g
rep -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 |
\
g
rep -i ^host |
\
g
rep -v '*') <(
\
g
rep -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
|
\
g
rep
'\-F'
|
\
g
rep
-v
_fzf_ |
\
g
rep
-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
...
...
This diff is collapsed.
Click to expand it.
install
+
3
-
3
View file @
ce53b9b2
...
...
@@ -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
|
\
g
rep
'^vi.*on'
)
" ]; then
# Required to refresh the prompt after fzf
bind '"
\e
r": 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
|
\
g
rep -q -E '%
$'
echo "-p "(echo
$height
| sed 's/%
$/
/')
else
echo "-l
$height
"
...
...
@@ -337,7 +337,7 @@ append_line() {
echo
"Update
$2
:"
echo
" -
$1
"
[
-f
"
$2
"
]
||
touch
"
$2
"
line
=
$(
grep
-nF
"
$1
"
"
$2
"
|
sed
's/:.*//'
)
line
=
$(
\
g
rep
-nF
"
$1
"
"
$2
"
|
sed
's/:.*//'
)
if
[
-n
"
$line
"
]
;
then
echo
" - Already exists (line #
$line
)"
else
...
...
This diff is collapsed.
Click to expand it.
uninstall
+
1
-
1
View file @
ce53b9b2
...
...
@@ -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
"
|
\
g
rep
-m1
-nF
"
$1
"
)
||
break
line_no
=
$((
$(
sed
's/:.*//'
<<<
"
$line
"
)
+
line_no
-
1
))
content
=
$(
sed
's/^[0-9]*://'
<<<
"
$line
"
)
match
=
1
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment