People occasionally post screenshots with modelines that have solid colors and triangles:
How do I replicate this effect?
People occasionally post screenshots with modelines that have solid colors and triangles:
How do I replicate this effect?
This can be achieved with two packages:
Overall, smart-mode-line is more powerful than powerline (pardon the pun), in the sense that it offers more features to control the mode-line's behaviour and more customizability in the appearance. The Readme has a great list of features, but in short it offers width-control, string replacement in the file path, hiding of the minor modes, among other things.
Since powerline has been very well explained on another answer, I'll focus on how you can achieve that appearance with smart-mode-line.
You can install smart-mode-line from Melpa, Melpa-Stable, or download it manually. Assuming you decide to use the package manager, just do
M-x package-install RET smart-mode-line
Once you turn it on with M-x sml/setup
, your mode-line should look
similar to one of these two.
smart-mode-line has several themes built-in, the one that achieves
the requested appearance is provided separately in the themes/
directory. Note that this theme is still in beta, so customizing it
might not work perfectly just yet.
Install the theme from Melpa
M-x package-install RET smart-mode-line-powerline-theme
If you want to install it manually, it's here, but you'll also need to install powerline.
Finally you can turn on the theme with M-x sml/apply-theme RET powerline
. And your mode-line should then look like this.
As you can see, the order of elements is not quite the same, but the
overall appearance is there.
To use this theme every-time, add the following to your init file. You can also customize any of the powerline configuration variables, and they should have the same effect here.
;; These two lines are just examples
(setq powerline-arrow-shape 'curve)
(setq powerline-default-separator-dir '(right . left))
;; These two lines you really need.
(setq sml/theme 'powerline)
(sml/setup)
:ED:
instead of ~/.emacs.d/
and rich-minority
to hide the minor mode lighters.
Commented
Sep 26, 2014 at 10:05
This can be achieved with a package called "powerline". There are several variants available, including at least one you can install through package.el
.
Personally, I use this one. Here's a screenshot from the package's README:
You can configure the color by setting the face of the mode-line:
(set-face-attribute 'mode-line nil
:foreground "Black"
:background "DarkOrange"
:box nil)
You can also configure different shapes, rather than just triangles:
(setq powerline-arrow-shape 'curve)
(setq powerline-default-separator 'utf-8)
which allows you to use any of the powerline patched fonts here.
(setq powerline-default-separator 'arrow)
. I am installing Carbon Emacs with Homebrew with the --srgb
flag and (setq ns-use-srgb-colorspace t)
in my .emacs.d.
curve
is nice, but I use diagonal
now) and my .emacs itself, which has some misc settings I got somewhere. If you're so inclined, you can make your own copy of powerline.el
and add your own separator shapes through ASCII art to get the exact effect you need :).
Commented
Jul 23, 2015 at 22:33
As other people have mentioned, powerline is the package that formats the modeline that way. Most emacs themes however, don't define colours for powerline (which is not great). One theme that does is the colourful (and comprehensive) moe-theme. It even has a mode that changes colour in the evening to be easier on the eyes. It looks like this:
My arrows in the powerline look strange because I'm using an unpatched version of Luxi Mono font.
My arrows in the powerline look strange because I'm using an unpatched version of Luxi Mono font.
William Roe, judging from your screenshot you are on macOS. As stated in this issue comment, you will need to add
(setq powerline-image-apple-rgb t)
to your init file(s). This should correct the colouring issue with the separators ("arrows"). Worked for me at least.