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
e865144a
Commit
e865144a
authored
9 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[vim] Implement ctrlp-compatible key bindings (#139, #96, #61)
parent
2a167aa0
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
+4
-0
4 additions, 0 deletions
README.md
plugin/fzf.vim
+24
-2
24 additions, 2 deletions
plugin/fzf.vim
with
28 additions
and
2 deletions
README.md
+
4
−
0
View file @
e865144a
...
...
@@ -275,6 +275,10 @@ If you have set up fzf for Vim, `:FZF` command will be added.
:
FZF
--
no
-
sort
-
m
/tmp
```
Similarly to
[
ctrlp.vim
](
https://github.com/kien/ctrlp.vim
)
, use enter key,
`CTRL-T`
,
`CTRL-X`
or
`CTRL-V`
to open selected files in the current window,
in new tabs, in horizontal splits, or in vertical splits respectively.
Note that the environment variables
`FZF_DEFAULT_COMMAND`
and
`FZF_DEFAULT_OPTS`
also apply here.
...
...
This diff is collapsed.
Click to expand it.
plugin/fzf.vim
+
24
−
2
View file @
e865144a
...
...
@@ -26,6 +26,7 @@ let s:launcher = 'xterm -e bash -ic %s'
let
s:fzf_go
=
expand
(
'<sfile>:h:h'
).
'/bin/fzf'
let
s:fzf_rb
=
expand
(
'<sfile>:h:h'
).
'/fzf'
let
s:fzf_tmux
=
expand
(
'<sfile>:h:h'
).
'/bin/fzf-tmux'
let
s:legacy
=
0
let
s:cpo_save
=
&
cpo
set
cpo
&
vim
...
...
@@ -40,6 +41,7 @@ function! s:fzf_exec()
let
s:exec
=
path
[
0
]
elseif
executable
(
s:fzf_rb
)
let
s:exec
=
s:fzf_rb
let
s:legacy
=
1
else
call
system
(
'type fzf'
)
if
v
:
shell_error
...
...
@@ -221,7 +223,7 @@ function! s:callback(dict, temps)
if
type
(
a:dict
.
sink
)
==
2
call
a:dict
.
sink
(
line
)
else
execute
a:dict
.
sink
.
' '
.
s:escape
(
line
)
execute
a:dict
.
sink
s:escape
(
line
)
endif
endfor
endif
...
...
@@ -238,6 +240,9 @@ endfunction
function
!
s:cmd
(
bang
,
...)
abort
let
args
=
copy
(
a:000
)
if
!
s:legacy
let
args
=
add
(
args
,
'--expect=ctrl-t,ctrl-x,ctrl-v'
)
endif
let
opts
=
{}
if
len
(
args
)
>
0
&&
isdirectory
(
expand
(
args
[
-1
]))
let
opts
.
dir
=
remove
(
args
,
-1
)
...
...
@@ -245,7 +250,24 @@ function! s:cmd(bang, ...) abort
if
!
a:bang
let
opts
.
down
=
get
(
g
:,
'fzf_tmux_height'
,
s:default_tmux_height
)
endif
call
fzf#run
(
extend
({
'sink'
:
'e'
,
'options'
:
join
(
args
)
},
opts
))
if
s:legacy
call
fzf#run
(
extend
({
'sink'
:
'e'
,
'options'
:
join
(
args
)
},
opts
))
else
let
output
=
fzf#run
(
extend
({
'options'
:
join
(
args
)
},
opts
))
if
empty
(
output
)
return
endif
let
key
=
remove
(
output
,
0
)
if
key
==
'ctrl-t'
|
let
cmd
=
'tabedit'
elseif
key
==
'ctrl-x'
|
let
cmd
=
'split'
elseif
key
==
'ctrl-v'
|
let
cmd
=
'vsplit'
else
|
let
cmd
=
'e'
endif
for
item
in
output
execute
cmd
s:escape
(
item
)
endfor
endif
endfunction
command
!
-
nargs
=
*
-
complete
=
dir
-
bang FZF
call
s:cmd
(
'<bang>'
==
'!'
,
<
f
-
args
>)
...
...
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