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
cf8dbf80
Commit
cf8dbf80
authored
10 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Allow setting tmux split height in %
parent
995d3802
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.md
+12
-12
12 additions, 12 deletions
README.md
install
+18
-4
18 additions, 4 deletions
install
plugin/fzf.vim
+12
-2
12 additions, 2 deletions
plugin/fzf.vim
with
42 additions
and
18 deletions
README.md
+
12
−
12
View file @
cf8dbf80
...
...
@@ -214,7 +214,7 @@ The install script will setup the following key bindings.
If you're on a tmux session,
`CTRL-T`
will launch fzf in a new split-window. You
may disable this tmux integration by setting
`FZF_TMUX`
to 0, or change the
height of the window with
`FZF_TMUX_HEIGHT`
.
height of the window with
`FZF_TMUX_HEIGHT`
(e.g.
`20`
,
`50%`
)
.
The source code can be found in
`~/.fzf.bash`
and in
`~/.fzf.zsh`
.
...
...
@@ -315,8 +315,8 @@ Note that the environment variables `FZF_DEFAULT_COMMAND` and `FZF_DEFAULT_OPTS`
also apply here.
If you're on a tmux session,
`:FZF`
will launch fzf in a new split-window whose
height can be adjusted with
`g:fzf_tmux_height`
(default:
15
). However, the
bang
version (
`:FZF!`
) will always start in fullscreen.
height can be adjusted with
`g:fzf_tmux_height`
(default:
'40%'
). However, the
bang
version (
`:FZF!`
) will always start in fullscreen.
### `fzf#run([options])`
...
...
@@ -325,15 +325,15 @@ of the selected items.
`fzf#run()`
may take an options-dictionary:
| Option name | Type | Description |
| ----------- | -------
|
---------------------------------------------------------- |
|
`source`
| string | External command to generate input to fzf (e.g.
`find .`
) |
|
`source`
| list | Vim list as input to fzf |
|
`sink`
| string | Vim command to handle the selected item (e.g.
`e`
,
`tabe`
) |
|
`sink`
| funcref | Reference to function to process each selected item |
|
`options`
| string | Options to fzf |
|
`dir`
| string | Working directory |
|
`tmux`
| number
| Use tmux split if possible with the given height
|
| Option name | Type
| Description
|
| ----------- | -------
------ | ---------
---------------------------------------------------------- |
|
`source`
| string
| External command to generate input to fzf (e.g.
`find .`
)
|
|
`source`
| list
| Vim list as input to fzf
|
|
`sink`
| string
| Vim command to handle the selected item (e.g.
`e`
,
`tabe`
)
|
|
`sink`
| funcref
| Reference to function to process each selected item
|
|
`options`
| string
| Options to fzf
|
|
`dir`
| string
| Working directory
|
|
`tmux`
| number
/string
| Use tmux split if possible with the given height
(e.g.
`20`
,
`50%`
)
|
#### Examples
...
...
This diff is collapsed.
Click to expand it.
install
+
18
−
4
View file @
cf8dbf80
...
...
@@ -115,7 +115,14 @@ __fsel() {
}
__fsel_tmux() {
tmux split-window -l
${
FZF_TMUX_HEIGHT
:-
15
}
"tmux send-keys -t
$TMUX_PANE
\"\$
(
$__fsel
)
\"
"
local height lines
height=
${
FZF_TMUX_HEIGHT
:-
40
%
}
lines=
${
LINES
:-
40
}
if [[
$height
=~ %
$
]]; then
height=
${
height
:0:
${#
height
}
-1
}
height=
$((
height
*
lines
/
100
))
fi
tmux split-window -l
$height
"tmux send-keys -t
$TMUX_PANE
\"\$
(
$__fsel
)
\"
"
}
__fcd() {
...
...
@@ -124,7 +131,7 @@ __fcd() {
}
__use_tmux=0
[ -n "
$TMUX_PANE
" -a
${
FZF_TMUX
:-
1
}
-ne 0 -a
${
LINES
:-
3
0
}
-gt 15 ] && __use_tmux=1
[ -n "
$TMUX_PANE
" -a
${
FZF_TMUX
:-
1
}
-ne 0 -a
${
LINES
:-
4
0
}
-gt 15 ] && __use_tmux=1
if [ -z "
$(
set
-o
|
grep
'^vi.*on'
)
" ]; then
# Required to refresh the prompt after fzf
...
...
@@ -180,9 +187,16 @@ read -r -d '' __fsel <<'EOF'
echo
EOF
if [ -n "
$TMUX_PANE
" -a
${
FZF_TMUX
:-
1
}
-ne 0 -a
${
LINES
:-
3
0
}
-gt 15 ]; then
if [ -n "
$TMUX_PANE
" -a
${
FZF_TMUX
:-
1
}
-ne 0 -a
${
LINES
:-
4
0
}
-gt 15 ]; then
fzf-file-widget() {
tmux split-window -l
${
FZF_TMUX_HEIGHT
:-
15
}
"tmux send-keys -t
$TMUX_PANE
\"\$
(
$__fsel
)
\"
"
local height lines
height=
${
FZF_TMUX_HEIGHT
:-
40
%
}
lines=
${
LINES
:-
40
}
if [[
$height
=~ %
$
]]; then
height=
${
height
:0:
${#
height
}
-1
}
height=
$((
height
*
lines
/
100
))
fi
tmux split-window -l
$height
"tmux send-keys -t
$TMUX_PANE
\"\$
(
$__fsel
)
\"
"
}
else
fzf-file-widget() {
...
...
This diff is collapsed.
Click to expand it.
plugin/fzf.vim
+
12
−
2
View file @
cf8dbf80
...
...
@@ -22,7 +22,7 @@
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
let
s:min_tmux_height
=
3
let
s:default_tmux_height
=
15
let
s:default_tmux_height
=
'40%'
let
s:cpo_save
=
&
cpo
set
cpo
&
vim
...
...
@@ -114,7 +114,17 @@ function! s:execute_tmux(dict, command, temps)
else
let
command
=
a:command
endif
let
height
=
a:dict
.
tmux
if
type
(
a:dict
.
tmux
)
==
1
if
a:dict
.
tmux
=~
'%$'
let
height
=
screenrow
()
*
str2nr
(
a:dict
.
tmux
[
0
:
-2
])
/
100
else
let
height
=
str2nr
(
a:dict
.
tmux
)
endif
else
let
height
=
a:dict
.
tmux
endif
let
s:pane
=
substitute
(
\
system
(
\
printf
(
...
...
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