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. :) – Ipsquiggle Jan 21 '19 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.)

- 251
- 1
- 9
-
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) – bombadil Feb 03 '16 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. – Nathanael Farley Feb 03 '16 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 – bombadil Feb 03 '16 at 12:00
-
1Perhaps you need something like `SPC b M` which puts the current buffer in the 'other' frame, then `C-x 5 1` to remove all other frames? – Nathanael Farley Feb 03 '16 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 (specifically `spacemacs/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 to `SPC b m` which is as before `spacemacs/kill-other-buffers`. There is a `move buffer to window` command but it doesn't seem to be mapped to anything in particular. I don't see anything about frames. – mpacer Apr 17 '17 at 20:17
-
It's entirely possible; spacemacs doesn't worry too much about backward compatibility (in my experience) when it comes to changing keyboard shortcuts to make better sense. – Nathanael Farley Dec 08 '18 at 07:25