Is there any keybinding or function to move an open buffer to a different window or a different frame in spacemacs?
2 Answers
It seems key bindings have been changed in Spacemacs since @Nathanael's answer.
To move a buffer to a diffferent window, you can use SPC b [n]
(buffer-to-window-[n]), where n is the number of the window to move to.
If you want to move the window , rather than the buffer (which makes sense in the light of the comments given above):
SPC w [H|J|K|L]
to move the window left|down|up|right, respectively.
-
Thanks for the answer! The final sentence is the actual answer to the question (and what I came here looking for), and I very nearly missed it. Might be worth moving it to the top or calling it out better. :) Jan 21, 2019 at 18:37
In spacemacs (vim mode) you can press SPC b m <your-direction>
to move a buffer. <your-direction>
can be:
h
leftj
downk
upl
right
In emacs mode, it should be M-m b m <your-direction>
If you want to switch to the 'other' frame, you can use SPC b M
(or M-m b M
).
(In general, Emacs places no restriction on the number of windows/frames a buffer is displayed in, so you can simply switch to the buffer in however many windows/frames you want.)
-
and is it possible to move the buffer to a different frame? (ideal would be something comparable to ace-window to select the target window and frame)– bombadilFeb 3, 2016 at 11:56
-
1You can just switch to the buffer when you are in the other frame, not sure if there's a native spacemacs way to do this though. Feb 3, 2016 at 11:58
-
1Perhaps to clarify, what I am looking for: I have a buffer open in one window want to open it in a different window and frame while closing it in the current one, so that I have the buffer open only in the target window and frame after the move– bombadilFeb 3, 2016 at 12:00
-
1Perhaps you need something like
SPC b M
which puts the current buffer in the 'other' frame, thenC-x 5 1
to remove all other frames? Feb 3, 2016 at 12:04 -
2I'm not sure if this is still valid — could these commands have changed because when I try to use
SPC b m
(or look at commands available in buffer mode) it gives the option to kill buffers (specificallyspacemacs/kill-other-buffers
), and does not offer to move the current buffer.SPC b M
seems to be unmapped to any specific command and is remapped toSPC b m
which is as beforespacemacs/kill-other-buffers
. There is amove buffer to window
command but it doesn't seem to be mapped to anything in particular. I don't see anything about frames.– mpacerApr 17, 2017 at 20:17