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
02316178
Commit
02316178
authored
8 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[neovim] Fix issues with `enew` and `tabnew` layouts
Related: #559
parent
7f64fba8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin/fzf.vim
+23
-22
23 additions, 22 deletions
plugin/fzf.vim
with
23 additions
and
22 deletions
plugin/fzf.vim
+
23
−
22
View file @
02316178
...
...
@@ -298,7 +298,7 @@ function! s:split(dict)
\
'down'
:
[
'botright'
,
'resize'
,
&
lines
],
\
'left'
:
[
'vertical topleft'
,
'vertical resize'
,
&
columns
],
\
'right'
:
[
'vertical botright'
,
'vertical resize'
,
&
columns
]
}
let
s:
ppos
=
s:getpos
()
let
ppos
=
s:getpos
()
try
for
[
dir
,
triple
]
in
items
(
directions
)
let
val
=
get
(
a:dict
,
dir
,
''
)
...
...
@@ -311,7 +311,7 @@ function! s:split(dict)
endif
execute
cmd sz
.
'new'
execute
resz sz
return
{}
return
[
ppos
,
{}
]
endif
endfor
if
s:present
(
a:dict
,
'window'
)
...
...
@@ -319,36 +319,44 @@ function! s:split(dict)
else
execute
(
tabpagenr
()
-1
).
'tabnew'
endif
return
{
'&l:wfw'
:
&
l
:
wfw
,
'&l:wfh'
:
&
l
:
wfh
}
return
[
ppos
,
{
'&l:wfw'
:
&
l
:
wfw
,
'&l:wfh'
:
&
l
:
wfh
}
]
finally
setlocal
winfixwidth
winfixheight
endtry
endfunction
function
!
s:execute_term
(
dict
,
command
,
temps
)
abort
let
winopts
=
s:split
(
a:dict
)
let
fzf
=
{
'buf'
:
bufnr
(
'%'
),
'dict'
:
a:dict
,
'temps'
:
a:temps
,
'name'
:
'FZF'
,
'winopts'
:
winopts
}
let
s:command
=
a:command
let
[
ppos
,
winopts
]
=
s:split
(
a:dict
)
let
fzf
=
{
'buf'
:
bufnr
(
'%'
),
'ppos'
:
ppos
,
'dict'
:
a:dict
,
'temps'
:
a:temps
,
\
'name'
:
'FZF'
,
'winopts'
:
winopts
,
'command'
:
a:command
}
function
!
fzf
.
switch_back
(
inplace
)
if
a:inplace
&&
bufnr
(
''
)
==
self
.
buf
" FIXME: Can't re-enter normal mode from terminal mode
" execute "normal! \<c-^>"
b
#
" No other listed buffer
if
bufnr
(
''
)
==
self
.
buf
enew
endif
endif
endfunction
function
!
fzf
.
on_exit
(
id
,
code
)
let
pos
=
s:getpos
()
let
inplace
=
pos
==
s:ppos
"
{
'window'
:
'enew'
}
if
inplace
if
s:getpos
()
==
self
.
ppos "
{
'window'
:
'enew'
}
for
[
opt
,
val
]
in
items
(
self
.
winopts
)
execute
'let'
opt
'='
val
endfor
call
self
.
switch_back
(
1
)
else
if
bufnr
(
''
)
==
self
.
buf
" We use close instead of bd! since Vim does not close the split when
" there's no other listed buffer (nvim +'set nobuflisted')
close
endif
if
pos
.
tab
==
s:ppos
.
tab
wincmd
p
endif
execute
'tabnext'
self
.
ppos
.
tab
execute
self
.
ppos
.
win
.
'wincmd w'
endif
if
!
s:exit_handler
(
a:code
,
s
:
command
,
1
)
if
!
s:exit_handler
(
a:code
,
s
elf
.
command
,
1
)
return
endif
...
...
@@ -356,14 +364,7 @@ function! s:execute_term(dict, command, temps) abort
let
ret
=
[]
try
let
ret
=
s:callback
(
self
.
dict
,
self
.
temps
)
if
inplace &&
bufnr
(
''
)
==
self
.
buf
execute
"normal! \<c-^>"
" No other listed buffer
if
bufnr
(
''
)
==
self
.
buf
bd
!
endif
endif
call
self
.
switch_back
(
s:getpos
()
==
self
.
ppos
)
finally
call
s:popd
(
self
.
dict
,
ret
)
endtry
...
...
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