> And for this updated version... Here is the equivalent above function to keep buffer sizes to 80 wide...
> (defun minimap-toggle-retain-size ()
> "Toggle minimap"
> (if (or (not (boundp 'minimap-exists))
> (not minimap-exists))
> (progn (minimap-create)
> (setf minimap-exists t)
> (set-frame-width (selected-frame) 100))
> (progn (minimap-kill)
> (setf minimap-exists nil)
> (set-frame-width (selected-frame) 80))))
> [http://www.sublimetext.com/ Minimap] is a feature provided by the Sublime editor. It shows a smaller,
Minimap is a feature provided by the Sublime editor. It shows a smaller, “minibar”, display of the current buffer alongside the main editing window.
This page is about a minimap implementation for Emacs. In the minibar window, it highlights the portion of the buffer that is currently visible in the main window. This highlight position is updated automatically, as you navigate in the main window. You can scroll the main window by dragging the highlighted area in the minibar.
You can configure the size/readability of the sidebar freely by specifying the font familiy and height. Here are two screenshots of the minibar in action:
With Bitstream Vera Sans, Height 30, with semantic overlays enabled (requires CEDET):
With Proggyfont Tiny, Height 20:
It is in GNU ELPA, so you can get it directly from
‘M-x install-package’, or you can find its code at http://bzr.savannah.gnu.org/lh/emacs/elpa/files/head:/packages/minimap/
Also in Marmalade http://marmalade-repo.org/packages/minimap/1.0
Alternatively, you can find a Git repository holding an older version:
git://randomsample.de/minimap.git or http://randomsample.de/minimap.git
minimap.elin your load path.
‘M-x minimap-create’in a buffer you’re currently editing.
‘M-x minimap-kill’to kill the minimap.
‘M-x customize-group RET minimap RET’to adapt minimap to your needs.
Things you can customize:
Nice. I found two issues:
The movement of the very small cursor is visible in the minimap windows when the viewport is dragged with the mouse. The cursor should be hidden in that window with
The other thing is an interaction bug. When I finish dragging the viewport I get the following backtrace:
Debugger entered--Lisp error: (error "The mark is not set now, so there is no region") call-interactively(copy-region-as-kill-nomark nil nil)
I use pc-selection mode, copy-region-as-kill-nomark is a function in that package. pc-selection allows the user to copy text by simply selecting text and releasing the mouse button. Apparently, this feature clashes with viewport dragging. pc-selection mode should be deactivated in the minimap buffer, if it’s possible.
Thanks, I think I fixed those two in the latest version.
I suggest hiding the vertical scrollbars in the minimap buffer. They are not really needed if the viewport can be dragged.
I agree. I added a new option for that. The default is to hide the scroll-bar.
You could create a new screenshot with the toolbars hidden. I assume it looks better too!
Some actions seem to steal the minimap window for their own output. What about adding
(set-window-dedicated-p nil t)
in the mode setup to try and minimize that.
Added a new option for that. It defaults to ‘nil’ though, because dedicated windows tend to confuse users since they behave unexpectedly.
Really nice! How can you set up emacs so it creates a minimap for every buffer (or, for buffers of a certain type)? A problem I encounter is that when you create minimaps for 2 buffers, you get two minimap windows side-by-side. And so on. Could the minimap frame be reused when you switch buffer in a window? (On Carbon Emacs Fall 2008: Emacs 22.3.1) Thanks!
Well, that’s in the TODO list. Currently, you can’t really do that in Emacs without heaviliy using ‘defadvice’ on all the functions that switch or change buffers (thats what EmacsCodeBrowser does at the moment). There is some work going on to make this kind of fixed ‘window grouping’ possible in Emacs proper, so I rather just wait for that. At the moment, I’d suggest to bind ‘minimap-create’ to a key, then just maximize the buffer you’re currently editing and use the key combination for ‘minimap-create’. Existing minimaps which are currently hidden will then be reused.
It seems linum-mode displays line numbers at normal size and thus only displays the normal number of lines in the minimap, you should probably check for it and disable it in the minimap buffer.
Done. I also changed the overlay-syncing, so that only the ‘face and ‘invisible property will be synced - otherwise, linum-mode would still change the line spacing in the minimap buffer.
I find the following function handy, maybe it would make sense to add it to minimap.el?
;;;###autoload (defun minimap-toggle () "Toggle minimap for current buffer." (interactive) (if (null minimap-bufname) (minimap-create) (minimap-kill)))
Then I can bind single shortcut to minimap toggling, it’s handy.
…and for those of us who like to keep the width of our frames at 80 columns…
(defun minimap-toggle () "Toggle minimap for current buffer." (interactive) (if (not (boundp 'minimap-bufname)) (setf minimap-bufname nil)) (if (null minimap-bufname) (progn (minimap-create) (set-frame-width (selected-frame) 100)) (progn (minimap-kill) (set-frame-width (selected-frame) 80))))
I have this set to <f7>… It is quite convenient since I don’t have to resize my window each time.
I have updated minimap.el to use a single dedicated minimap sidebar window instead of new windows per buffer. Minimap now updates based on what the currently selected buffer is. You can find it here: https://github.com/dustinlacewell/emacs-minimap
Current bugs include semantic overlays disappearing when the current buffer changes.
And for this updated version… Here is the equivalent above function to keep buffer sizes to 80 wide…
(defun minimap-toggle-retain-size () "Toggle minimap" (interactive) (if (or (not (boundp 'minimap-exists)) (not minimap-exists)) (progn (minimap-create) (setf minimap-exists t) (set-frame-width (selected-frame) 100)) (progn (minimap-kill) (setf minimap-exists nil) (set-frame-width (selected-frame) 80))))
Would it be possible to make the minimap buffer scroll-wheel enabled ? Currently using the scroll-wheel triggers a refresh which just makes the buffer glitch a bit. As a workaround, tips to (really) disable the scroll wheel would be welcome.
Some problems occurs when resizing the view (emacs 22.214.171.124 on Ubuntu 10.10). M-x minimap-create Drag to resize the windows to full screen, drag to make it 0 columns wide. Repeat. Sometimes the minimap gets as wide as the buffer, sometimes it disappears. Furthermore there is no way to change the width of the minimap alone. Hovering the mouse over its scrollbar changes the pointer to a double horizontal arrow and pops up “drag-mouse-1: resize”, but dragging doesn’t do anything.
It would be really good if the minimap would change automatically as you go through buffers. The link posted by the other user has 2 issues: - the minimap is always on the left - it is buggy
I am using Emacs in server environments where I do not have X11 available, so I use it in text terminal. Minimap shows fonts at same size as other buffers if used this way. Is it possible to solve this issue?