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
4ec40334
Unverified
Commit
4ec40334
authored
5 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Update Neovim floating window example to have border
parent
e01266ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README-VIM.md
+30
-15
30 additions, 15 deletions
README-VIM.md
with
30 additions
and
15 deletions
README-VIM.md
+
30
−
15
View file @
4ec40334
...
...
@@ -281,24 +281,39 @@ The latest versions of Vim and Neovim include builtin terminal emulator
```
vim
" Using floating windows of Neovim to start fzf
if
has
(
'nvim'
)
let
$FZF_DEFAULT_OPTS
.=
' --border --margin=0,2'
function
!
FloatingFZF
()
let
width
=
float2nr
(
&
columns
*
0
.
9
)
let
height
=
float2nr
(
&
lines
*
0
.
6
)
let
opts
=
{
'relative'
:
'editor'
,
\
'row'
:
(
&
lines
-
height
)
/
2
,
\
'col'
:
(
&
columns
-
width
)
/
2
,
\
'width'
:
width
,
\
'height'
:
height
}
let
win
=
nvim_open_win
(
nvim_create_buf
(
v
:
false
,
v
:
true
),
v
:
true
,
opts
)
call
setwinvar
(
win
,
'&winhighlight'
,
'NormalFloat:Normal'
)
function
!
FloatingFZF
(
width
,
height
,
border_highlight
)
function
!
s:create_float
(
hl
,
opts
)
let
buf
=
nvim_create_buf
(
v
:
false
,
v
:
true
)
let
opts
=
extend
({
'relative'
:
'editor'
,
'style'
:
'minimal'
},
a:opts
)
let
win
=
nvim_open_win
(
buf
,
v
:
true
,
opts
)
call
setwinvar
(
win
,
'&winhighlight'
,
'NormalFloat:'
.
a:hl
)
call
setwinvar
(
win
,
'&colorcolumn'
,
''
)
return
buf
endfunction
" Size and position
let
width
=
float2nr
(
&
columns
*
a:width
)
let
height
=
float2nr
(
&
lines
*
a:height
)
let
row
=
float2nr
((
&
lines
-
height
)
/
2
)
let
col
=
float2nr
((
&
columns
-
width
)
/
2
)
" Border
let
top
=
'╭'
.
repeat
(
'─'
,
width
-
2
)
.
'╮'
let
mid
=
'│'
.
repeat
(
' '
,
width
-
2
)
.
'│'
let
bot
=
'╰'
.
repeat
(
'─'
,
width
-
2
)
.
'╯'
let
border
=
[
top
]
+
repeat
([
mid
],
height
-
2
)
+
[
bot
]
" Draw frame
let
s:frame
=
s:create_float
(
a:border_highlight
,
{
'row'
:
row
,
'col'
:
col
,
'width'
:
width
,
'height'
:
height
})
call
nvim_buf_set_lines
(
s:frame
,
0
,
-1
,
v
:
true
,
border
)
" Draw viewport
call
s:create_float
(
'Normal'
,
{
'row'
:
row
+
1
,
'col'
:
col
+
2
,
'width'
:
width
-
4
,
'height'
:
height
-
2
})
autocmd
BufWipeout
<
buffer
>
execute
'bwipeout'
s:frame
endfunction
let
g:fzf_layout
=
{
'window'
:
'call FloatingFZF()'
}
let
g:fzf_layout
=
{
'window'
:
'call FloatingFZF(
0.9, 0.6, "Comment"
)'
}
endif
```
#### Hide statusline
...
...
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