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
853012ce
Commit
853012ce
authored
10 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[vim] Add g:fzf_action for customizing key bindings
Close #189
parent
2add45fe
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
+5
-22
5 additions, 22 deletions
README.md
plugin/fzf.vim
+9
-6
9 additions, 6 deletions
plugin/fzf.vim
with
14 additions
and
28 deletions
README.md
+
5
−
22
View file @
853012ce
...
...
@@ -276,34 +276,17 @@ If you have set up fzf for Vim, `:FZF` command will be added.
" With options
:
FZF
--
no
-
sort
-
m
/tmp
" Bang version starts in fullscreen instead of using tmux pane or Neovim split
:
FZF
!
```
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.
If you're on a tmux session or using Neovim,
`:FZF`
will launch fzf in a
split-window whose height can be adjusted with
`g:fzf_height`
(default:
'40%'). However, the bang version (
`:FZF!`
) will always start in fullscreen.
In GVim, you need an external terminal emulator to start fzf with.
`xterm`
command is used by default, but you can customize it with
`g:fzf_launcher`
.
```
vim
" This is the default. %s is replaced with fzf command
let
g:fzf_launcher
=
'xterm -e bash -ic %s'
" Use urxvt instead
let
g:fzf_launcher
=
'urxvt -geometry 120x30 -e sh -c %s'
```
If you're running MacVim on OSX, I recommend you to use iTerm2 as the launcher.
Refer to the
[
this wiki
page
](
https://github.com/junegunn/fzf/wiki/On-MacVim-with-iTerm2
)
to see how
to set up.
Note that the environment variables
`FZF_DEFAULT_COMMAND`
and
`FZF_DEFAULT_OPTS`
also apply here.
#### `fzf#run([options])`
...
...
This diff is collapsed.
Click to expand it.
plugin/fzf.vim
+
9
−
6
View file @
853012ce
...
...
@@ -308,23 +308,26 @@ function! s:callback(dict, temps)
return
lines
endfunction
let
s:default_action
=
{
\
'ctrl-m'
:
'e'
,
\
'ctrl-t'
:
'tabedit'
,
\
'ctrl-x'
:
'split'
,
\
'ctrl-v'
:
'vsplit'
}
function
!
s:cmd_callback
(
lines
)
abort
if
empty
(
a:lines
)
return
endif
let
key
=
remove
(
a:lines
,
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
let
cmd
=
get
(
s:action
,
key
,
'e'
)
for
item
in
a:lines
execute
cmd
s:escape
(
item
)
endfor
endfunction
function
!
s:cmd
(
bang
,
...)
abort
let
args
=
extend
([
'--expect=ctrl-t,ctrl-x,ctrl-v'
],
a:000
)
let
s:action
=
get
(
g
:,
'fzf_action'
,
s:default_action
)
let
args
=
extend
([
'--expect='
.
join
(
keys
(
s:action
),
','
)],
a:000
)
let
opts
=
{}
if
len
(
args
)
>
0
&&
isdirectory
(
expand
(
args
[
-1
]))
let
opts
.
dir
=
remove
(
args
,
-1
)
...
...
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