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– Ipsquiggle2019-01-21 18:37:47 +00:00Commented 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:
hleftjdownkuplright
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)bombadil– bombadil2016-02-03 11:56:37 +00:00Commented Feb 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.Nathanael Farley– Nathanael Farley2016-02-03 11:58:54 +00:00Commented 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 movebombadil– bombadil2016-02-03 12:00:14 +00:00Commented Feb 3, 2016 at 12:00
- 1Perhaps you need something like
SPC b Mwhich puts the current buffer in the 'other' frame, thenC-x 5 1to remove all other frames?Nathanael Farley– Nathanael Farley2016-02-03 12:04:49 +00:00Commented 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 Mseems to be unmapped to any specific command and is remapped toSPC b mwhich is as beforespacemacs/kill-other-buffers. There is amove buffer to windowcommand but it doesn't seem to be mapped to anything in particular. I don't see anything about frames.mpacer– mpacer2017-04-17 20:17:09 +00:00Commented Apr 17, 2017 at 20:17