Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
5c7dcaff
Unverified
Commit
5c7dcaff
authored
5 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[bash-completion] _fzf_setup_completion to retain previous options
parent
50958992
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shell/completion.bash
+11
-9
11 additions, 9 deletions
shell/completion.bash
with
11 additions
and
9 deletions
shell/completion.bash
+
11
−
9
View file @
5c7dcaff
...
...
@@ -292,7 +292,7 @@ if type _completion_loader > /dev/null 2>&1; then
_fzf_completion_loader
=
1
fi
_fzf_defc
()
{
_
_fzf_defc
()
{
local
cmd func opts orig_var orig def
cmd
=
"
$1
"
func
=
"
$2
"
...
...
@@ -309,16 +309,14 @@ _fzf_defc() {
# Anything
for
cmd
in
$a_cmds
;
do
_fzf_defc
"
$cmd
"
_fzf_path_completion
"-o default -o bashdefault"
_
_fzf_defc
"
$cmd
"
_fzf_path_completion
"-o default -o bashdefault"
done
# Directory
for
cmd
in
$d_cmds
;
do
_fzf_defc
"
$cmd
"
_fzf_dir_completion
"-o nospace -o dirnames"
_
_fzf_defc
"
$cmd
"
_fzf_dir_completion
"-o nospace -o dirnames"
done
unset
_fzf_defc
# Kill completion
complete
-F
_fzf_complete_kill
-o
nospace
-o
default
-o
bashdefault
kill
...
...
@@ -334,16 +332,20 @@ complete -F _fzf_complete_unalias -o default -o bashdefault unalias
unset
cmd d_cmds a_cmds x_cmds
_fzf_setup_completion
()
{
local
fn cmd
if
[[
$#
-lt
2
]]
||
!
type
-t
_fzf_
${
1
}
_completion
>
/dev/null
;
then
local
kind fn cmd
kind
=
$1
fn
=
_fzf_
${
1
}
_completion
if
[[
$#
-lt
2
]]
||
!
type
-t
"
$fn
"
>
/dev/null
;
then
echo
"usage:
${
FUNCNAME
[0]
}
path|dir COMMANDS..."
return
1
fi
fn
=
_fzf_
${
1
}
_completion
shift
for
cmd
in
"
$@
"
;
do
eval
"
$(
complete
-p
"
$cmd
"
2> /dev/null |
grep
-v
"
$fn
"
| __fzf_orig_completion_filter
)
"
complete
-F
"
$fn
"
-o
default
-o
bashdefault
"
$cmd
"
case
"
$kind
"
in
dir
)
__fzf_defc
"
$cmd
"
"
$fn
"
"-o nospace -o dirnames"
;;
*
)
__fzf_defc
"
$cmd
"
"
$fn
"
"-o default -o bashdefault"
;;
esac
done
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment