Added powerline

This commit is contained in:
larstvei 2014-03-23 02:26:29 +01:00
parent 2209c952e6
commit 58a4a20c9b
5 changed files with 106 additions and 8 deletions

View File

@ -204,6 +204,7 @@ configurations are also dependent on them).
multiple-cursors ; Multiple cursors for Emacs. multiple-cursors ; Multiple cursors for Emacs.
org ; Outline-based notes management and organizer org ; Outline-based notes management and organizer
paredit ; minor mode for editing parentheses paredit ; minor mode for editing parentheses
powerline ; Rewrite of Powerline
pretty-lambdada ; the word `lambda' as the Greek letter. pretty-lambdada ; the word `lambda' as the Greek letter.
smex)) ; M-x interface with Ido-style fuzzy matching. smex)) ; M-x interface with Ido-style fuzzy matching.
(upgrade-or-install-package package)) (upgrade-or-install-package package))
@ -389,8 +390,39 @@ Change the color-theme to `monokai` (downloaded using `package`).
Use the [Inconsolata](http://www.levien.com/type/myfonts/inconsolata.html) font if it's installed on the system. Use the [Inconsolata](http://www.levien.com/type/myfonts/inconsolata.html) font if it's installed on the system.
```lisp ```lisp
(when (member "Inconsolata" (font-family-list)) (when (member "Inconsolata-g" (font-family-list))
(set-face-attribute 'default nil :font "Inconsolata-13")) (set-face-attribute 'default nil :font "Inconsolata-g-11"))
```
[Powerline](https://github.com/milkypostman/powerline) is an extension to customize the mode line. This is modified
version `powerline-nano-theme`. This is what it looks like:
![img](./powerline.png)
```lisp
(setq-default
mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
;; left hand side displays Read only or Modified.
(lhs (list (powerline-raw
(cond (buffer-read-only "Read only")
((buffer-modified-p) "Modified")
(t "")) nil 'l)))
;; right side hand displays (line,column).
(rhs (list
(powerline-raw
(concat
"(" (number-to-string (line-number-at-pos))
"," (number-to-string (current-column)) ")") nil 'r)))
;; center displays buffer name.
(center (list (powerline-raw "%b" nil))))
(concat (powerline-render lhs)
(powerline-fill-center nil (/ (powerline-width center) 2.0))
(powerline-render center)
(powerline-fill nil (powerline-width rhs))
(powerline-render rhs))))))
``` ```
## Ido ## Ido
@ -836,6 +868,9 @@ using `C-c C-c` (instead of `M-x compile`), a habit from `latex-mode`.
(defun c-setup () (defun c-setup ()
(local-set-key (kbd "C-c C-c") 'compile)) (local-set-key (kbd "C-c C-c") 'compile))
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-hook 'c-mode-common-hook 'c-setup) (add-hook 'c-mode-common-hook 'c-setup)
``` ```

32
init.el
View File

@ -90,6 +90,7 @@ PACKAGE is installed and the current version is deleted."
multiple-cursors ; Multiple cursors for Emacs. multiple-cursors ; Multiple cursors for Emacs.
org ; Outline-based notes management and organizer org ; Outline-based notes management and organizer
paredit ; minor mode for editing parentheses paredit ; minor mode for editing parentheses
powerline ; Rewrite of Powerline
pretty-lambdada ; the word `lambda' as the Greek letter. pretty-lambdada ; the word `lambda' as the Greek letter.
smex)) ; M-x interface with Ido-style fuzzy matching. smex)) ; M-x interface with Ido-style fuzzy matching.
(upgrade-or-install-package package)) (upgrade-or-install-package package))
@ -179,8 +180,32 @@ PACKAGE is installed and the current version is deleted."
(load-theme 'monokai t) (load-theme 'monokai t)
(when (member "Inconsolata" (font-family-list)) (when (member "Inconsolata-g" (font-family-list))
(set-face-attribute 'default nil :font "Inconsolata-13")) (set-face-attribute 'default nil :font "Inconsolata-g-11"))
(setq-default
mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
;; left hand side displays Read only or Modified.
(lhs (list (powerline-raw
(cond (buffer-read-only "Read only")
((buffer-modified-p) "Modified")
(t "")) nil 'l)))
;; right side hand displays (line,column).
(rhs (list
(powerline-raw
(concat
"(" (number-to-string (line-number-at-pos))
"," (number-to-string (current-column)) ")") nil 'r)))
;; center displays buffer name.
(center (list (powerline-raw "%b" nil))))
(concat (powerline-render lhs)
(powerline-fill-center nil (/ (powerline-width center) 2.0))
(powerline-render center)
(powerline-fill nil (powerline-width rhs))
(powerline-render rhs))))))
(dolist (mode (dolist (mode
'(ido-mode ; Interactivly do. '(ido-mode ; Interactivly do.
@ -407,6 +432,9 @@ LANGUAGES (cyclic) list."
(defun c-setup () (defun c-setup ()
(local-set-key (kbd "C-c C-c") 'compile)) (local-set-key (kbd "C-c C-c") 'compile))
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-hook 'c-mode-common-hook 'c-setup) (add-hook 'c-mode-common-hook 'c-setup)
(define-abbrev-table 'java-mode-abbrev-table (define-abbrev-table 'java-mode-abbrev-table

View File

@ -161,6 +161,7 @@
multiple-cursors ; Multiple cursors for Emacs. multiple-cursors ; Multiple cursors for Emacs.
org ; Outline-based notes management and organizer org ; Outline-based notes management and organizer
paredit ; minor mode for editing parentheses paredit ; minor mode for editing parentheses
powerline ; Rewrite of Powerline
pretty-lambdada ; the word `lambda' as the Greek letter. pretty-lambdada ; the word `lambda' as the Greek letter.
smex)) ; M-x interface with Ido-style fuzzy matching. smex)) ; M-x interface with Ido-style fuzzy matching.
(upgrade-or-install-package package)) (upgrade-or-install-package package))
@ -346,8 +347,39 @@
Use the [[http://www.levien.com/type/myfonts/inconsolata.html][Inconsolata]] font if it's installed on the system. Use the [[http://www.levien.com/type/myfonts/inconsolata.html][Inconsolata]] font if it's installed on the system.
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp :tangle yes
(when (member "Inconsolata" (font-family-list)) (when (member "Inconsolata-g" (font-family-list))
(set-face-attribute 'default nil :font "Inconsolata-13")) (set-face-attribute 'default nil :font "Inconsolata-g-11"))
#+END_SRC
[[https://github.com/milkypostman/powerline][Powerline]] is an extension to customize the mode line. This is modified
version =powerline-nano-theme=. This is what it looks like:
[[./powerline.png]]
#+BEGIN_SRC emacs-lisp :tangle yes
(setq-default
mode-line-format
'("%e"
(:eval
(let* ((active (powerline-selected-window-active))
;; left hand side displays Read only or Modified.
(lhs (list (powerline-raw
(cond (buffer-read-only "Read only")
((buffer-modified-p) "Modified")
(t "")) nil 'l)))
;; right side hand displays (line,column).
(rhs (list
(powerline-raw
(concat
"(" (number-to-string (line-number-at-pos))
"," (number-to-string (current-column)) ")") nil 'r)))
;; center displays buffer name.
(center (list (powerline-raw "%b" nil))))
(concat (powerline-render lhs)
(powerline-fill-center nil (/ (powerline-width center) 2.0))
(powerline-render center)
(powerline-fill nil (powerline-width rhs))
(powerline-render rhs))))))
#+END_SRC #+END_SRC
** Ido ** Ido
@ -791,6 +823,9 @@
(defun c-setup () (defun c-setup ()
(local-set-key (kbd "C-c C-c") 'compile)) (local-set-key (kbd "C-c C-c") 'compile))
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers)
(add-hook 'c-mode-common-hook 'c-setup) (add-hook 'c-mode-common-hook 'c-setup)
#+END_SRC #+END_SRC

BIN
init.pdf

Binary file not shown.

BIN
powerline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB