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
684bfff7
Unverified
Commit
684bfff7
authored
5 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Update README/CHANGELOG
parent
3db6b88d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
README.md
+32
-48
32 additions, 48 deletions
README.md
with
34 additions
and
48 deletions
CHANGELOG.md
+
2
−
0
View file @
684bfff7
...
...
@@ -9,6 +9,8 @@ CHANGELOG
--color
'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899'
\
--border
--height
20
--layout
reverse
--info
inline
```
-
Preview window border can be disabled by setting
`noborder`
in
`--preview-window`
-
Removed the immediate flicking of the screen on
`reload`
action.
```
sh
: | fzf
--bind
'change:reload:seq {q}'
--phony
...
...
This diff is collapsed.
Click to expand it.
README.md
+
32
−
48
View file @
684bfff7
...
...
@@ -54,7 +54,6 @@ Table of Contents
*
[
Preview window
](
#preview-window
)
*
[
Tips
](
#tips
)
*
[
Respecting .gitignore
](
#respecting-gitignore
)
*
[
git ls-tree for fast traversal
](
#git-ls-tree-for-fast-traversal
)
*
[
Fish shell
](
#fish-shell
)
*
[
Related projects
](
#related-projects
)
*
[
<a href="LICENSE">License</a>
](
#license
)
...
...
@@ -500,37 +499,50 @@ important that the command finishes quickly.
fzf
--preview
'head -100 {}'
```
Preview window supports ANSI colors, so you can use program
s
that
Preview window supports ANSI colors, so you can use
any
program that
syntax-highlights the content of a file.
-
Bat: https://github.com/sharkdp/bat
-
Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php
-
CodeRay: http://coderay.rubychan.de/
-
Rouge: https://github.com/jneen/rouge
```
bash
# Try bat, highlight, coderay, rougify in turn, then fall back to cat
fzf
--preview
'[[ $(file --mime {}) =~ binary ]] &&
echo {} is a binary file ||
(bat --style=numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}) 2> /dev/null | head -500'
fzf
--preview
'bat --style=numbers --color=always {} | head -500'
```
You can customize the size and position of the preview window using
`--preview-window`
option. For example,
You can customize the size, position, and border of the preview window using
`--preview-window`
option, and the foreground and background color of it with
`--color`
option. For example,
```
bash
fzf
--height
40%
--reverse
--preview
'file {}'
--preview-window
down:1
fzf
--height
40%
--layout
reverse
--info
inline
--border
\
--preview
'file {}'
--preview-window
down:1:noborder
\
--color
'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899'
```
See the man page (
`man fzf`
) for the full list of options.
For more advanced examples, see
[
Key bindings for git with fzf
][
fzf-git
]
(
[
code
](
https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236
)
).
[
fzf-git
]:
https://junegunn.kr/2016/07/fzf-git/
----
Since fzf is a general-purpose text filter rather than a file finder,
**
it is
not a good idea to add
`--preview`
option to your
`$FZF_DEFAULT_OPTS`
**
.
```
sh
# *********************
# ** DO NOT DO THIS! **
# *********************
export
FZF_DEFAULT_OPTS
=
'--preview "bat --style=numbers --color=always {} | head -500"'
# bat doesn't work with any input other than the list of files
ps
-ef
| fzf
seq
100 | fzf
history
| fzf
```
Tips
----
...
...
@@ -563,45 +575,17 @@ hidden files, use the following command:
export
FZF_DEFAULT_COMMAND
=
'fd --type f --hidden --follow --exclude .git'
```
#### `git ls-tree` for fast traversal
If you're running fzf in a large git repository,
`git ls-tree`
can boost up the
speed of the traversal.
```
sh
export
FZF_DEFAULT_COMMAND
=
'
(git ls-tree -r --name-only HEAD ||
find . -path "*/\.*" -prune -o -type f -print -o -type l -print |
sed s/^..//) 2> /dev/null'
```
#### Fish shell
Fish shell before version 2.6.0
[
doesn't allow
](
https://github.com/fish-shell/fish-shell/issues/1362
)
reading from STDIN in command substitution, which means simple
`vim (fzf)`
doesn't work as expected. The workaround for fish 2.5.0 and earlier is to use
the
`read`
fish command:
```
sh
fzf |
read
-l
result
;
and vim
$result
```
or, for multiple results:
```
sh
fzf
-m
|
while
read
-l
r
;
set
result
$result
$r
;
end
;
and vim
$result
```
The globbing system is different in fish and thus
`**`
completion will not work.
However, the
`CTRL-T`
command will use the last token on the command-line as the
root folder for the recursive search. For instance, hitting
`CTRL-T`
at the end
of the following command-line
`CTRL-T`
key binding of fish, unlike those of bash and zsh, will use the last
token on the command-line as the root directory for the recursive search. For
instance, hitting
`CTRL-T`
at the end of the following command-line
```
sh
ls
/var/
```
will list all files and
folder
s under
`/var/`
.
will list all files and
directorie
s under
`/var/`
.
When using a custom
`FZF_CTRL_T_COMMAND`
, use the unexpanded
`$dir`
variable to
make use of this feature.
`$dir`
defaults to
`.`
when the last token is not a
...
...
@@ -621,4 +605,4 @@ https://github.com/junegunn/fzf/wiki/Related-projects
The MIT License (MIT)
Copyright (c) 201
7
Junegunn Choi
Copyright (c) 201
9
Junegunn Choi
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