Closed apoorv569 closed 2 years ago
This is somehow related:
From the Help I get:
(display-buffer-reuse-window BUFFER ALIST) it received 3 arguments, not 2.
I have observed that it does not open at bottom when the windows is to wide; in small screens it behaves as expected.
This is somehow related:
From the Help I get:
(display-buffer-reuse-window BUFFER ALIST) it received 3 arguments, not 2.
I have observed that it does not open at bottom when the windows is to wide; in small screens it behaves as expected.
I see, I do have an ultrawide monitor, maybe this is the issue. I also have the configuration on my laptop, and it always open vterm
on bottom.
So there is no fix for this?
Before the last commit, vterm-toggle was working well for me(I also have a big monitor). With the recent version, vterm-toggle simply cant stay at bottom but in small window it works fine. Anyone have some suggestions to fix that ?
I am also getting this issue. Except it opens on the right "only" when it's the first time. If I toggle it hidden and shown again, it'll be at the bottom (as I wanted).
That happens because at the first time the vterm buffer is created, its major mode is still 'fundamental-mode
, and your display-buffer-alist
is set to act only when major mode is 'vterm-mode
, so it won't run at the first time because vterm-toggle hasn't turned it into a vterm
yet.
On the later runs that callback will run and set your window to the right specs.
A quick fix is relying on bufname
instead of major-mode
:
(add-to-list 'display-buffer-alist
'((lambda (bufname _) (equal bufname vterm-buffer-name))
(display-buffer-reuse-window display-buffer-in-direction)
(direction . bottom)
(dedicated . t)
(reusable-frames . visible)
(window-height . 0.3)))
At the end I made it simpler... not fully functional yet, but good enough
(add-to-list 'display-buffer-alist `(,vterm-buffer-name display-buffer-at-bottom))
But this should also work:
(add-to-list 'display-buffer-alist `(,vterm-buffer-name
(display-buffer-reuse-window display-buffer-at-bottom)
(dedicated . t)
(reusable-frames . visible)
(window-height . 0.3)))
@jixiuf thanks for updating the readme! It works flawlessly most of the time, however, if you happen to use vterm-toggle-scope 'project
then you might end up with multiple vterm buffers, and they are named sequentially like Term<1>
, Term<2>
and so on.
Another quickfix for that is simply comparing the bufname prefix with vterm-buffer-name
instead, like so:
(lambda (bufname _) (with-current-buffer bufname
(or (equal major-mode 'vterm-mode)
(string-prefix-p vterm-buffer-name bufname))))
I'm not sure if that's the best alternative to avoid any false positives, but for me it works fine at least.
I added the code from the
README
for showingvterm
buffer in bottom side, but whenever I runvterm-toggle
it always opens on the right.Here is my
vterm
configuration,What am I doing wrong here?