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
6c035718
Unverified
Commit
6c035718
authored
5 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[vim] Add fzf#install() for downloading fzf binary
parent
4fb410a9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README-VIM.md
+44
-0
44 additions, 0 deletions
README-VIM.md
README.md
+7
-28
7 additions, 28 deletions
README.md
plugin/fzf.vim
+11
-18
11 additions, 18 deletions
plugin/fzf.vim
with
62 additions
and
46 deletions
README-VIM.md
+
44
−
0
View file @
6c035718
FZF Vim integration
===================
Installation
------------
Once you have fzf installed, you can enable it inside Vim simply by adding the
directory to
`&runtimepath`
in your Vim configuration file. The path may
differ depending on the package manager.
```
vim
" If installed using Homebrew
set
rtp
+=
/usr/
local
/opt/
fzf
" If installed using git
set
rtp
+=~
/
.
fzf
```
If you use
[
vim-plug
](
https://github.com/junegunn/vim-plug
)
, the same can be
written as:
```
vim
" If installed using Homebrew
Plug
'/usr/local/opt/fzf'
" If installed using git
Plug
'~/.fzf'
```
But if you want the latest Vim plugin file from GitHub rather than the one
included in the package, write:
```
vim
Plug
'junegunn/fzf'
```
The Vim plugin will pick up fzf binary available on the system. If fzf is not
found on
`$PATH`
, it will ask you if it should download the latest binary for
you.
To make sure that you have the latest version of the binary, set up
post-update hook like so:
```
vim
Plug
'junegunn/fzf'
,
{
'do'
:
{
->
fzf#install
()
}
}
```
Summary
-------
...
...
This diff is collapsed.
Click to expand it.
README.md
+
7
−
28
View file @
6c035718
...
...
@@ -138,39 +138,18 @@ page][windows-wiki].
### As Vim plugin
Once you have fzf installed, you can enable it inside Vim simply by adding th
e
directory to
`&runtimepath`
in your Vim configuration file. The path may
differ depending on the package manager.
If you us
e
[
vim-plug
](
https://github.com/junegunn/vim-plug
)
, add this line to your Vim
configuration file:
```
vim
" If installed using Homebrew
set
rtp
+=
/usr/
local
/opt/
fzf
" If installed using git
set
rtp
+=~
/
.
fzf
```
If you use
[
vim-plug
](
https://github.com/junegunn/vim-plug
)
, the same can be
written as:
```
vim
" If installed using Homebrew
Plug
'/usr/local/opt/fzf'
" If installed using git
Plug
'~/.fzf'
Plug
'junegunn/fzf'
,
{
'do'
:
{
->
fzf#install
()
}
}
```
But instead of separately installing fzf on your system (using Homebrew or
"git clone") and enabling it on Vim (adding it to
`&runtimepath`
), you can use
vim-plug to do both.
`fzf#install()`
makes sure that you have the latest binary, but it's optional,
so you can omit it if you use a plugin manager that doesn't support hooks.
```
vim
" PlugInstall and PlugUpdate will clone fzf in ~/.fzf and run the install script
Plug
'junegunn/fzf'
,
{
'dir'
:
'~/.fzf'
,
'do'
:
'./install --all'
}
" Both options are optional. You don't have to install fzf in ~/.fzf
" and you don't have to run the install script if you use fzf only in Vim.
```
For more installation options, see
[
README-VIM.md
](
README-VIM.md
)
.
Upgrading fzf
-------------
...
...
This diff is collapsed.
Click to expand it.
plugin/fzf.vim
+
11
−
18
View file @
6c035718
...
...
@@ -119,40 +119,30 @@ let s:default_layout = { 'down': '~40%' }
let
s:layout_keys
=
[
'window'
,
'up'
,
'down'
,
'left'
,
'right'
]
let
s:fzf_go
=
s:base_dir
.
'/bin/fzf'
let
s:fzf_tmux
=
s:base_dir
.
'/bin/fzf-tmux'
let
s:installed
=
0
let
s:cpo_save
=
&
cpo
set
cpo
&
vim
function
!
s:download_bin
()
if
s:installed
return
0
endif
function
!
fzf#install
()
if
s:is_win
&&
!
has
(
'win32unix'
)
let
script
=
s:base_dir
.
'/install.ps1'
if
!
filereadable
(
script
)
return
0
throw
script
.
' not found'
endif
let
script
=
'powershell -ExecutionPolicy Bypass -file '
.
script
else
let
script
=
s:base_dir
.
'/install'
if
!
executable
(
script
)
return
0
throw
script
.
' not found'
endif
let
script
.=
' --bin'
endif
if
input
(
'fzf executable not found. Download binary? (y/n) '
)
!~
?
'^y'
return
0
end
redraw
echo
call
s:warn
(
'Downloading fzf binary. Please wait ...'
)
let
s:installed
=
1
call
s:warn
(
'Running fzf installer ...'
)
call
system
(
script
)
return
v
:
shell_error
==
0
if
v
:
shell_error
throw
'Failed to download fzf: '
.
script
endif
endfunction
function
!
s:fzf_exec
()
...
...
@@ -161,7 +151,10 @@ function! s:fzf_exec()
let
s:exec
=
s:fzf_go
elseif
executable
(
'fzf'
)
let
s:exec
=
'fzf'
elseif
s:download_bin
()
elseif
input
(
'fzf executable not found. Download binary? (y/n) '
)
=~
?
'^y'
redraw
echo
call
fzf#install
()
return
s:fzf_exec
()
else
redraw
...
...
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