zed icon indicating copy to clipboard operation
zed copied to clipboard

Add setting for minimap on active buffer only

Open AlvaroParker opened this issue 9 months ago • 4 comments

Release Notes:

  • Add a setting to show the minimap only on the current active buffer (file)
  • This can be configured on settings.json:
{
  "minimap": {
    "display_scope": "focused_pane", // defaults to "all_panes"
  }
}

  • The minimap won't hide if you go from a pane to the terminal, the project panel, the search bar, etc. It will only hide if you go from one pane to another.

Preview:

image

Only the active buffer (left) display the minimap.

AlvaroParker avatar May 25 '25 18:05 AlvaroParker

@MrSubidubi Good points! I see three possible alternatives:

  1. Implement OnActiveBuffer within the ShowMinimap config.
  2. Move OnActiveBuffer to its own config name.
  3. Merge it into ShowMinimap::Auto so that it automatically hides when the focus is not on the buffer (I don't think this is a good idea, but it can be done).

Or, of course, we could leave it as is and not allow the user to choose where to show the minimap.

AlvaroParker avatar May 25 '25 21:05 AlvaroParker

Putting it within the minimap config seems most reasonable to me currently, although I lack a good idea for a config name.

Personally, I would also like something likeOnActivePane slightlly more as a behavior than what is currently proposed here - the current implementation would also hide the minimap if I change focus to e.g. the terminal, the project panel or even the search bar. To me, this feels overly flickery (and the latter might even be more of a bug). For the active_pane_modifiers.magnification, we continue to magnify the most recently selected pane. Personally, I feel this behaviour would be more reasonable for the issue faced here (so we continue to show the minimap in the most recently used editor even if it no longer has focus). Theoretically, we could implement both approaches (with the mentioned bug fixed), although I would like to know where you see advantages in OnActiveBuffer to the OnActivePane idea.

I also think allowing users to select where to show the minimap overall sounds reasonable - it does take up some screen space and showing the minimap only in the currently active editor could reduce visual clutter for users that want a less busy UI.

MrSubidubi avatar May 25 '25 22:05 MrSubidubi

I was actually thinking on something like this:

/// Where to show the minimap in the editor.
///
/// Default: all
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MinimapDisplayScope {
    /// Show on all open panes.
    #[default]
    AllPanes,
    /// Show the minimap on the focused pane only.
    FocusedPane,
}

And put the config on minimap.display_scope

AlvaroParker avatar May 25 '25 22:05 AlvaroParker

I'm noticing a flickering when splitting panes. I'll see what I can do about it

https://github.com/user-attachments/assets/773f6f2d-4252-4137-a89c-6e12a9d45564

AlvaroParker avatar May 27 '25 21:05 AlvaroParker

I went on and flipped the default, given that there were some reports about current minimap's performance: https://github.com/zed-industries/zed/pull/32878

SomeoneToIgnore avatar Jun 17 '25 15:06 SomeoneToIgnore