Emacsist RSS --- If never, make it ever: C-h C-h

Spaceline:Powerline theme from Spacemacs


这里 查看更多 Emacs 相关推荐文章最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist


This is the package that provides Spacemacs with its famous mode-line theme. It has been extracted as an independent package for general fun and profit.


This package provides features for three kinds of users.

  1. You just want to use the Spacemacs mode-line theme and forget about it.
  2. You want to use something similar to the Spacemacs mode-line theme, but with a handful of easy tweaks.
  3. You want an easy-to-use library for building your own mode-line from scratch, and you think the Spacemacs theme looks good.

The functionality for each are described in the following sections.

The files in this package are organized as follows. Choose which you want to load based on what you want to do.

  • spaceline.el: Contains the core library used to define segments and render the modeline. It defines no segments by itself except the global segment. (See below.)
  • spaceline-segments.el: Defines all the segments used by the default Spacemacs theme, but doesn't do anything with them.
  • spaceline-config.el: Defines the default Spacemacs theme.

The Spacemacs mode-line theme

To install it, just load spaceline-config and call the theme function you want. E.g.

(require 'spaceline-config)

There are two themes currently:

  • spaceline-spacemacs-theme: The theme used by Spacemacs.
  • spaceline-emacs-theme: A similar theme designed to look good with no other packages installed.

It should work out of the box. This theme integrates with the following third-party packages, which you may consider installing for added benefit:

  • [eyebrowse](https://github.com/wasamasa/eyebrowse): a simple workspace-like package.
  • [window-numbering](https://github.com/nschum/window-numbering.el): gives each visible window a number.
  • [anzu](https://github.com/syohex/emacs-anzu): shows the current match and the total number of matches while searching.
  • [flycheck](https://github.com/flycheck/flycheck/): shows the number of errors, warnings and notifications after syntax checking.
  • [erc](http://www.emacswiki.org/emacs/ERC): shows the channels with new messages if you have erc-track turned on.
  • [org](http://orgmode.org/): shows the currently clocking task.
  • [org-pomodoro](https://github.com/lolownia/org-pomodoro): kind of like clocks in org, only with a tomato.
  • [nyan-mode](https://github.com/TeMPOraL/nyan-mode): shows the current position in the buffer with kittens and rainbows.
  • [fancy-battery](https://github.com/lunaryorn/fancy-battery.el): shows battery information.
  • [evil](https://bitbucket.org/lyro/evil/wiki/Home): makes Emacs behave like vim.

Why does it look different?

There are a number of reasons why Spaceline might look different on your setup compared to Spacemacs proper. Some of the more important ones are addressed here.

  • You're missing an optional dependency. Spacemacs includes packages that display information in the mode-line. The leftmost segment is invisible if eyebrowse-mode, window-numbering-mode andevil are all not present. If you don't wish to use these packages, there is a theme provided calledspaceline-emacs-theme which is supposed to look good regardless.

  • Consider setting or increasing the value of powerline-height to give your mode-line some room to breathe.

  • The default powerline separator is arrow, but Spacemacs uses wave. You should try out various settings of powerline-default-separator to find the one that works for you.

  • If you're using eyebrowse-mode or window-numbering-mode, consider setting spaceline-workspace-numbers-unicode and spaceline-window-numbers-unicode to t to get the nice-looking unicode numbers seen in the screenshot.

  • Use [diminish](https://github.com/emacsmirror/diminish) to tweak the output of the minor modes segment.

  • To get the mode-line highlight to change color depending on the evil state, set spaceline-highlight-face-func to spaceline-highlight-face-evil-state.

Medium tweaking

Turning segments on and off

Each segment has a variable spaceline-<name>-p that can switch the segment off by setting it to nil. There are also three convenient interactive functions for toggling segments:

  • spaceline-toggle-<name>
  • spaceline-toggle-<name>-on
  • spaceline-toggle-<name>-off

You can bind these to whichever keys you like.

The full list of segments available, from left to right:

  • workspace-number: integrates with eyebrowse.
  • window-number: integrates with window-numbering.
  • evil-state: shows the current evil state, integrates with evil.
  • anzu: integrates with anzu.
  • buffer-modified: the standard marker denoting whether the buffer is modified or not.
  • buffer-size: the size of the buffer.
  • buffer-id: the name of the buffer.
  • remote-host: the host for remote buffers.
  • major-mode: the current major mode.
  • flycheck-error: number of flycheck errors, integrates with flycheck.
  • flycheck-warning: number of flycheck warnings, integrates with flycheck.
  • flycheck-info: number of flycheck notifications, integrates with flycheck.
  • minor-modes: the currently enabled minor modes. The output of this segment can be tweaked with[diminish](https://github.com/emacsmirror/diminish).
  • process: the background process associated with the buffer, if any.
  • erc-track: IRC channels with new messages, integrates with erc.
  • version-control: version control information.
  • org-pomodoro: integrates with org-pomodoro.
  • org-clock: the current org clock, integrates with org.
  • nyan-cat: integrates with nyan-mode.
  • battery: integrates with fancy-battery-mode.
  • selection-info: information about the currently active selection, if any.
  • buffer-encoding-abbrev: the line ending convention used in the current buffer (unix, dos ormac).
  • point-position: the value of point, this is disabled by default.
  • line-column: current line and column.
  • global: meta-segment used by third-party packages.
  • buffer-position: shows the current position in the buffer as a percentage.
  • hud: shows the currently visible part of the buffer.

There is also a buffer-encoding segment, which is not used by the Spacemacs theme.

The highlight face

The highlight face is the face that (by default) is a sharp orange, used e.g. by the HUD segment on the far right, and the first segment on the left (note that it may be invisible if you are using the Spacemacs theme but not some of its optional dependencies). The actual face used as a highlight face is determined by a function, which can be configured by setting the value of spaceline-highlight-face-func. Spaceline comes with three choices, but of course you can write your own:

  • spaceline-highlight-face-default: Uses the orange, all the time. This is the default. Hence the name.
  • spaceline-highlight-face-evil-state: Chooses a face determined by the current evil state. The face corresponding to each state is determined by the association list spaceline-evil-state-faces, which contains default values for the standard evil states. (Spacemacs has a few more.)
  • spaceline-highlight-face-modified: Chooses a face determined by the status of the current buffer (modified, unmodified or read-only).

Note that the highlight face is only used in the active window.

Other faces

In the active window, the mode-line will use these faces:

  • powerline-active1
  • powerline-active2
  • mode-line

And in inactive windows:

  • powerline-inactive1
  • powerline-inactive2
  • mode-line-inactive

Powerline separators

Set powerline-default-separator to configure this. The docstring for that variable enumerates the choices.

Each separator comes in two directions: left and right. The variables spaceline-separator-dir-leftand spaceline-separator-dir-right specify which directions to alternate between on the left and right side, respectively.

For example, to use only one direction on each side (looks good with the arrow separator style), you can use

(setq spaceline-separator-dir-left '(left . left))
(setq spaceline-separator-dir-right '(right . right))

By default, the directions alternate between each segment.

原文出处: TheBB
原文地址: https://github.com/TheBB/spaceline
原文时间: 2015-09-29 01:54
本文地址: http://emacsist.com/10470
整理时间: 2015-10-11 02:22

本文由 Hick 整理,转载请保留以上信息;
COPYLEFTThe articles on this site come from Internet, thanks to all the original authors.
      If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .