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
a4f3d097
Commit
a4f3d097
authored
10 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Fuzzy completion using fzf-tmux
parent
40180c18
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+3
-0
3 additions, 0 deletions
README.md
shell/completion.bash
+10
-6
10 additions, 6 deletions
shell/completion.bash
with
13 additions
and
6 deletions
README.md
+
3
−
0
View file @
a4f3d097
...
...
@@ -256,6 +256,9 @@ export FZF_COMPLETION_TRIGGER='~~'
# Options to fzf command
export
FZF_COMPLETION_OPTS
=
'+c -x'
# Not to use tmux pane
export
FZF_COMPLETION_TMUX
=
0
```
Usage as Vim plugin
...
...
This diff is collapsed.
Click to expand it.
shell/completion.bash
+
10
−
6
View file @
a4f3d097
...
...
@@ -6,6 +6,7 @@
# /_/ /___/_/-completion.bash
#
# - $FZF_COMPLETION_TRIGGER (default: '**')
# - $FZF_COMPLETION_TMUX (default: 1)
# - $FZF_COMPLETION_OPTS (default: empty)
_fzf_orig_completion_filter
()
{
...
...
@@ -65,7 +66,8 @@ _fzf_handle_dynamic_completion() {
}
_fzf_path_completion
()
{
local
cur base
dir
leftover matches trigger cmd
local
cur base
dir
leftover matches trigger cmd fzf
[
${
FZF_COMPLETION_TMUX
:-
1
}
-eq
1
]
&&
fzf
=
"fzf-tmux"
||
fzf
=
"fzf"
cmd
=
$(
echo
${
COMP_WORDS
[0]
}
|
sed
's/[^a-z0-9_=]/_/g'
)
COMPREPLY
=()
trigger
=
${
FZF_COMPLETION_TRIGGER
:-
**
}
...
...
@@ -81,7 +83,7 @@ _fzf_path_completion() {
leftover
=
${
leftover
/#\/
}
[
"
$dir
"
=
'./'
]
&&
dir
=
''
tput sc
matches
=
$(
find
-L
"
$dir
"
*
$1
2> /dev/null | fzf
$FZF_COMPLETION_OPTS
$2
-q
"
$leftover
"
|
while
read
item
;
do
matches
=
$(
find
-L
"
$dir
"
*
$1
2> /dev/null |
$
fzf
$FZF_COMPLETION_OPTS
$2
-q
"
$leftover
"
|
while
read
item
;
do
printf
"%q
$3
"
"
$item
"
done
)
matches
=
${
matches
%
}
...
...
@@ -105,7 +107,8 @@ _fzf_path_completion() {
}
_fzf_list_completion
()
{
local
cur selected trigger cmd src
local
cur selected trigger cmd src fzf
[
${
FZF_COMPLETION_TMUX
:-
1
}
-eq
1
]
&&
fzf
=
"fzf-tmux"
||
fzf
=
"fzf"
read
-r
src
cmd
=
$(
echo
${
COMP_WORDS
[0]
}
|
sed
's/[^a-z0-9_=]/_/g'
)
trigger
=
${
FZF_COMPLETION_TRIGGER
:-
**
}
...
...
@@ -114,7 +117,7 @@ _fzf_list_completion() {
cur
=
${
cur
:0:
${#
cur
}
-
${#
trigger
}}
tput sc
selected
=
$(
eval
"
$src
| fzf
$FZF_COMPLETION_OPTS
$1
-q '
$cur
'"
|
tr
'\n'
' '
)
selected
=
$(
eval
"
$src
|
$
fzf
$FZF_COMPLETION_OPTS
$1
-q '
$cur
'"
|
tr
'\n'
' '
)
selected
=
${
selected
%
}
tput rc
...
...
@@ -149,9 +152,10 @@ _fzf_dir_completion() {
_fzf_kill_completion
()
{
[
-n
"
${
COMP_WORDS
[COMP_CWORD]
}
"
]
&&
return
1
local
selected
local
selected fzf
[
${
FZF_COMPLETION_TMUX
:-
1
}
-eq
1
]
&&
fzf
=
"fzf-tmux"
||
fzf
=
"fzf"
tput sc
selected
=
$(
ps
-ef
|
sed
1d | fzf
-m
$FZF_COMPLETION_OPTS
|
awk
'{print $2}'
|
tr
'\n'
' '
)
selected
=
$(
ps
-ef
|
sed
1d |
$
fzf
-m
$FZF_COMPLETION_OPTS
|
awk
'{print $2}'
|
tr
'\n'
' '
)
tput rc
if
[
-n
"
$selected
"
]
;
then
...
...
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