Emacs: how to show the same file with different zoom levels in different windows?

You can zoom in in Emacs using Cx C- + and Cx C--. If I visit a specific file and that file is displayed in multiple windows (like "view" or "pane" in other editors), at the same time all windows always show the same file at the same zoom level. In case of words, if I change the zoom level in one window, the zoom level changes in all other windows that show the same file. I want to control the zoom level for each window separately.

I need this feature because for long files it is sometimes useful to see the overall shape of the file when editing at high magnification. Something like that:

http://twimgs.com/ddj/images/article/2012/1012/dup2.gif

I would also like the cursor to move synchronously in both views, allowing me to easily see where I am.

+3


source to share


2 answers


Akira, maybe you used minimap 1.2 or earlier? Try installing the minimap from the melpa repository. Version 20140201.1209 works in Emacs 24.4.50.1. Dustin Lasewell reorganized it at David Engster and I think it works better. Once installed and downloaded, simply use "Mx mini-toggle" to turn it on and off.



+3


source


Just scale the frame instead of the buffer.

If you increase the size of the buffer (for example, scaling text), then the buffer will be enlarged wherever it appears. But instead, you can scale a specific frame: all of its windows. In this case, other frames displaying the same buffer are not affected: you can display the buffer with any text size you want, anywhere. See Changing the font size for details .

The library zoom-frm.el

allows you to scale a buffer or a frame with the same team: zoom-in/out

. This is a superset replacement for the vanilla command text-scale-adjust

, which only scales buffers. Just bind zoom-in/out

to the same keys and you're good to go:

(define-key ctl-x-map [(control ?+)] 'zoom-in/out)
(define-key ctl-x-map [(control ?-)] 'zoom-in/out)
(define-key ctl-x-map [(control ?=)] 'zoom-in/out)
(define-key ctl-x-map [(control ?0)] 'zoom-in/out)

      

Also, I recommend snapping the mouse ( Shift + button-1

zoom in, Control + Shift + button-1

zoom out):



(global-set-key [S-mouse-1]    'zoom-in)
(global-set-key [C-S-mouse-1]  'zoom-out)
(global-set-key [S-down-mouse-1] nil)

      

And if you want to use the mouse wheel to zoom in (on click Control

) like in web browsers, do this as well:

(global-set-key (vector (list 'control mouse-wheel-down-event)) 'zoom-in)
(global-set-key (vector (list 'control mouse-wheel-up-event))   'zoom-out)

      

The library zoom-frm.el

requires a library frame-cmds.el

and frame-fns.el

. All of these libraries are also available on MELPA , in addition to the Emacs Wiki .

+1


source







All Articles