Closed PhilRunninger closed 7 years ago
For :EditVifm
just calls :args <list of files
, which should give the behaviour you expect. Maybe you're using old version of the plugin?
Yes, I'm using the latest commit. I think there's some confusion here; maybe I chose my words poorly before. I would like the empty buffer to be replaced by the first (or any) file I select using vifm. I think the :args
statement is causing the behavior I'm seeing. If I just open vim and issue the command :args foo.txt
, I still have the empty buffer. However, when I start vim and use :edit foo.txt
, the empty buffer is replaced.
After looking at the code, I made the changes shown here, and it behaves as I was expecting it to. Are these changes compatible with your design?
edit
command.drop
to silent! drop
in line 180. This prevents the error messages from the drop command. Per the vim documentation, :drop is {only available when compiled with a GUI}
. Another option is to use
if has("drop")
execute 'drop' firstfile
else
execute 'buffer' fnamemodify(firstfile, ':.')
endif
OK, I misunderstood the issue.
Delete lines 163-167. This lets lines 170-178 process the list with the edit command.
And will probably break opening multiple files at the same time.
:drop is {only available when compiled with a GUI}
Thanks, didn't know that.
There used to be this piece:
if len(flist) == 1
execute a:editcmd flist[0]
return
endif
But I removed it because :args
handles this case as well. It can be returned, but it doesn't help when opening multiple files and I'm not sure I want to close such buffers explicitly as it might cause some side effects.
My changes do work with multiple files, and they remove what I see as an inconsistency - :EditVifm
(using :args
) leaves the empty empty buffer there, while :SplitVifm
and :VsplitVifm
(using :edit
) do not.
Right, it's just that argument list isn't populated, but we can do this manually without using :args
.
Here is a comparison of two similar workflows, first without Vifm, and then with.
At this point,
foo.txt
is the only buffer in vim, having reused the buffer number of the default empty buffer.Using this workflow, I end up with two buffers: the initial empty buffer and
foo.txt
.I prefer the first behavior, but while using vifm as the file picker. Am I doing something wrong, is there a vim setting I need to change, or is this a bug?
Thanks, Phil