tags:

views:

641

answers:

5

I'm trying to edit some assembly code which tends to be formatted in long but thin listings. I'd like to be able to use some of the acres of horizontal space I have and see more code on-screen at one time. Is there a method for getting Emacs (or indeed another editor) to show me multiple columns all pointing to the same buffer?

C-x 3 (emacs) and :vsplit (vim) are great for multiple separate views into the code, but I'd like it to flow from one column to the other (like text in a newspaper).

+2  A: 

this is the default behaviour of emacs when splitting the window (C-x 3 for vertical split) you get two columns which both have the current buffer open

second
A: 

Vim can do this using :vsplit - and you can have the same buffer open in multiple "windows" (which are actually sections within a single "window").

Documentation here

inkedmn
emacs can do that too, as mentioned in the question, but that's not what is being asked.
justinhj
The question was edited after I responded.
inkedmn
A: 

Use vertical-split with C-x 3. This will split the current buffer into two columns that you can switch between with C-x o.

Nathaniel Flath
This does not flow automatically from one column to another.
kmarsh
+1  A: 

A quick look at the emacs wiki doesn't show a mode like you describe. However, it shouldn't be too hard to write one... You just need to split the window with C-x 3 and move the text in the other window down, and whenever you move the text, do the same to the other window...

Problems may occur when you get to the bottom of the buffer, do you want the cursor to immediately go to the other window at the top?

Hmm, maybe its not that easy. But it should still be doable...

Brian Postow
...and so Elisp is added to the things-I-need-to-learn-list :) Many thanks Brian ;)
Evidently, someone already did it, but yes, elisp is an amazing tool!
Brian Postow
+21  A: 

See follow-mode. Excerpt:

Follow mode is a minor mode that makes two windows, both showing the same buffer, scroll as a single tall “virtual window.” To use Follow mode, go to a frame with just one window, split it into two side-by-side windows using C-x 3, and then type M-x follow-mode. From then on, you can edit the buffer in either of the two windows, or scroll either one; the other window follows it. In Follow mode, if you move point outside the portion visible in one window and into the portion visible in the other window, that selects the other window—again, treating the two as if they were parts of one large window.
huaiyuan
Oh. My. Word. Just what I was looking for. Many thanks huaiyuan.
Nice, learn something new every day!
Brian Postow
Can I use this with more than two windows? Can I have four windows using this?
Yktula