• Stars
    star
    895
  • Rank 51,027 (Top 2 %)
  • Language
    Emacs Lisp
  • Created over 12 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A powerful and beautiful mode-line for Emacs.

Smart-mode-line http://melpa.org/packages/smart-mode-line-badge.svg http://stable.melpa.org/packages/smart-mode-line-badge.svg

Contribute

Smart Mode Line is a sexy mode-line for Emacs. It aims to be easy to read from small to large monitors by using colors, a prefix feature, and smart truncation.

Images

Dark Theme
https://raw.github.com/Malabarba/smart-mode-line/master/screenshot-2013-11-11-dark.png

Light Theme
https://raw.github.com/Malabarba/smart-mode-line/master/screenshot-2013-11-11-light.png

Atom-one Dark Theme
https://raw.github.com/Malabarba/smart-mode-line/master/screenshot-atom-one-dark.png

(Note: to use the Atom-one theme, install the smart-mode-line-atom-one-dark-theme package from MELPA)

Solarized Dark Theme
https://cloud.githubusercontent.com/assets/601365/7131638/34a3b0f8-e247-11e4-8fd5-811365167d22.png

Solarized Light Theme
https://cloud.githubusercontent.com/assets/601365/7131637/34946ac6-e247-11e4-8e0e-35a47df70686.png

(Note: to use the Solarized themes, install the solarized-theme package from MELPA)

Powerline Theme
https://raw.github.com/Malabarba/smart-mode-line/master/screenshot-powerline-theme.png

Light Powerline Theme
https://raw.github.com/Malabarba/smart-mode-line/master/screenshot-light-powerline-theme.png

(Note: to use either powerline theme, install the smart-mode-line-powerline-theme package from MELPA)

Installation

smart-mode-line is available on Melpa, and that’s the recommended way of installing it. If you do that, you can simply activate it with:

(sml/setup)

By default, sml will try to figure out the best sml theme to go with your Emacs theme. But if you want to chose the theme yourself, do one of the following BEFORE sml/setup:

(setq sml/theme 'dark)
(setq sml/theme 'light)
(setq sml/theme 'respectful)

Installation Issues (FAQ)

  • Problem: If Emacs always warns you that “Loading themes can run lisp code” and keeps asking /“Would you like to mark this theme as safe for future sessions?”/. That is probably an issue with your init.el or .emacs file, but we offer a workaround.
  • Workaround: Add the following snippet before sml/setup
    (setq sml/no-confirm-load-theme t)
        
  • Proper Solution: Make sure the (custom-set-variables ...) sexp is at the very top of your .emacs file. That is the right place for it. If that doesn’t work, forget about smart-mode-line for a moment and see if you have the same problem with other themes installed from Melpa.

Features

Its main features include:

Color coded
Highlights the most important information for you (buffer name, modified state, line number). Don’t like the colors? See item 5.!
Fixed width (if you want)
Lets you set a maximum width for the path name and mode names, and truncates them intelligently (truncates the directory, not the buffer name). Also let’s you right indent strings in the mode-line (see sml/mode-width).
Directory as Prefixes
Prefix feature saves a LOT of space. e.g. ~/.emacs.d/ is translated to :ED: in the path (open a file inside this folder to see it in action). Long path names you are commonly working on are displayed as short abbreviations. Set your own prefixes to make best use of it (by configuring sml/replacer-regexp-list). Mousing over the abbreviated path will show you the full path. See below for examples.
Hide or Highlight minor-modes
The rich-minority package saves even more space. Select which minor modes you don’t want to see listed by adding them to the variable rm-blacklist, or even highlight the modes that are more important with the variable rm-text-properties. This will filter out the modes you don’t care about and unclutter the modes list (mousing over the modes list still shows the full list).
Very easy to configure
All colors and variables are customizable. You can change the whole theme with sml/apply-theme, or just customize anything manually with sml/customize and sml/customize-faces. There are DOZENS of variables to customize your mode-line, just pop over there and have a look!
Compatible with absolutely anything
I’m serious. Versions 2.0 and above should be compatible with any other packages that display information in the mode-line (evil, nyan-mode, elscreen, display-battery-mode, etc). If you find ANYTHING that does not appear as it should, file a bug report and I’ll get to it.

Important Variables:

All variables can be edited by running sml/customize, and the documentations are mostly self explanatory, I list here only the most important ones.

  1. sml/theme
    Choose what theme you want to use for the mode-line colors. For now there are 3 different themes: dark, light, and respectful.
  2. sml/shorten-directory and sml/shorten-modes
    Setting both of these to t guarantees a fixed width mode-line (directory name and minor-modes list will be truncated to fit). To actually define the width, see below.
  3. sml/name-width and sml/mode-width
    Customize these according to the width of your emacs frame. I set them to 40 and full respectively, and the mode-line fits perfectly when the frame is split in two even on my laptop’s small 17” monitor. full means everything after the minor-modes will be right-indented.
  4. sml/replacer-regexp-list
    This variable is a list of (REGEXP REPLACEMENT) that is used to parse the path. The replacements are applied sequentially. This allows you to greatly abbreviate the path that’s shown in the mode-line. If this abbreviation is of the form :SOMETHING:, it is considered a prefix and get’s a different color (you can change what’s considered a prefix by customizing sml/prefix-regexp). For example, if you do a lot of work on a folder called ~/Dropbox/Projects/In-Development/ almost half the mode-line would be occupied just by the folder name, which is much less important than the buffer name. But, you can’t just hide the folder name, since editting a file in ~/Dropbox/Projects/In-Development/Source is VERY different from editting a file in ~/Dropbox/Projects/Source. By setting up a prefix for your commonly used folders, you get all that information without wasting all that space. In this example you could set the replacement to :ProjDev: or just :InDev:, so the path shown in the mode-line will be :ProjDev:Source/ (saves a lot of space without hiding information).

Some abbreviations are defined out of the box, for instance (see the documentation for a complete list):

("^~/\\.emacs\\.d/" ":ED:")
("^/sudo:.*:" ":SU:")
("^~/Documents/" ":Doc:")
("^~/Dropbox/" ":DB:")

You can stack abbreviations sequentially, by adding them in order:

(add-to-list 'sml/replacer-regexp-list '("^~/Git-Projects/" ":Git:") t)
(add-to-list 'sml/replacer-regexp-list '("^:Git:\(.*\)/src/main/java/" ":G/\1/SMJ:") t)

Note the t option ensures that your customizations are added to the end of the list, which ensures that the second one is applied after the first.

However, if you want to override one of the pre-defined abbreviations with your own definition you need to add it to the start of the list (note the omitted t):

(add-to-list 'sml/replacer-regexp-list '("^~/Dropbox/" ":DBox:"))

In order to use more complex transformations (like upcasing), you’ll need to write a more complex replacement. The second argument needs to be a function that accepts the matched string as its argument and returns the replacement string. You can access matched data with the match-string function as explained in the manual. For example, for using the upcased project name (assuming the project is in the ~/Projects directory:

(add-to-list 'sml/replacer-regexp-list
             '("^~/Projects/\\(\\w+\\)/"
               (lambda (s) (concat ":" (upcase (match-string 1 s)) ":")))
             t)

Contributing

https://cdn.rawgit.com/gratipay/gratipay-badge/2.1.3/dist/gratipay.png

More Repositories

1

aggressive-indent-mode

Emacs minor mode that keeps your code always indented. More reliable than electric-indent-mode.
Emacs Lisp
850
star
2

beacon

A light that follows your cursor around so you don't lose it!
Emacs Lisp
657
star
3

paradox

Project for modernizing Emacs' Package Menu. With package ratings, usage statistics, customizability, and more.
Emacs Lisp
561
star
4

elisp-bug-hunter

Hunt down errors in elisp files.
Emacs Lisp
271
star
5

emacs-google-this

A set of emacs functions and bindings to google under point.
Emacs Lisp
264
star
6

names

A Namespace implementation for Emacs-Lisp
Emacs Lisp
249
star
7

Nameless

Less is more. Hide package namespace in your emacs-lisp code
Emacs Lisp
134
star
8

fancy-narrow

Emacs package to immitate narrow-to-region with more eye-candy
Emacs Lisp
129
star
9

rich-minority

Emacs package for hiding and/or highlighting the list of minor-modes in the mode-line.
Emacs Lisp
108
star
10

camcorder.el

Tool for capturing screencasts directly from Emacs.
Emacs Lisp
108
star
11

spinner.el

Emacs mode-line spinner for operations in progress
Emacs Lisp
104
star
12

speed-of-thought-lisp

Write elisp at the speed of thought. Emacs minor mode with abbrevs and keybinds.
Emacs Lisp
73
star
13

latex-extra

A series of usability improvements for Emacs latex-mode.
Emacs Lisp
69
star
14

org-agenda-property

Display org properties in the agenda buffer.
Emacs Lisp
65
star
15

gmail-mode

A major-mode for editing gmail messages using markdown syntax (in emacs).
Emacs Lisp
57
star
16

lazy-map-clojure

Create Clojure maps whose values are only calculated when accessed, either from data or from java objects.
Clojure
49
star
17

ham-mode

Html As Markdown. Transparently edit an html file using markdown.
Emacs Lisp
42
star
18

control-pianobar

Pair of scripts that interact with pianobar entirely through notification bubbles and hotkeys. No terminal necessary.
Shell
35
star
19

ox-jekyll-subtree

Extension to ox-jexkyll for better export of subtrees
Emacs Lisp
30
star
20

audio-notes-mode

Emacs mode to play audio notes synced from somewhere else.
Emacs Lisp
26
star
21

speed-of-thought-clojure

Write clojure at the speed of thought.
Emacs Lisp
23
star
22

validate.el

Schema validator for Emacs-lisp
Emacs Lisp
23
star
23

emacs-online-documentation

A project meant to keep an updated online documentation of ALL emacs' built-in functions and variables.
Emacs Lisp
22
star
24

html-to-markdown

HTML to Markdown converter written in emacs-lisp.
Emacs Lisp
17
star
25

alpine-osd-notify

Script to run alpine mail client using a notify-osd notification system.
Shell
17
star
26

conkeror-minor-mode

Mode for editing conkeror javascript files.
Emacs Lisp
17
star
27

emacs-archive-tracker

A script in emacs-lisp to track some statistics about emacs package archives.
Emacs Lisp
14
star
28

comment-or-uncomment-sexp

Emacs-lisp command for inteligently commenting and commenting the sexp under point.
Emacs Lisp
9
star
29

org-bibtex

Simple example of combining a .bib file with org-mode.
8
star
30

emacs-documentation-android

Emacs Documentation android app. Search emacs variables/functions and view their documentations on android.
Java
5
star
31

HugeSQLiteCursor

A version of SQLiteCursor which remains fast even when the cursor is arbitrarily large.
Java
4
star
32

EndlessParentheses

Endless Parentheses blog. See http://endlessparentheses.com
HTML
4
star
33

lisp-assistant

A set of functions, variables, and snippets to assist in developing lisp code.
Emacs Lisp
3
star
34

threads-list-mode

tabulated-list-mode specialized at viewing threads
Emacs Lisp
3
star
35

Keystone

Play Hearthstone with the keyboard.
AutoHotkey
2
star
36

Zumi

Rails WebApp for apartment listings
Ruby
2
star
37

hdh

Ruby gem for rendering plain data into HTML
Ruby
2
star
38

Zumi-front

Frontend for https://github.com/Malabarba/Zumi
Vue
1
star
39

display-keys-emacs

Popup that displays keys pressed for certain commands
Emacs Lisp
1
star
40

greek-unicode-insert

Simple keymap to insert Unicode Greek characters in emacs.
Emacs Lisp
1
star