aboutsummaryrefslogtreecommitdiffstats
path: root/emacs
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-10-17 18:18:10 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-10-17 18:18:10 +0100
commitc0a3a8b951db708d227dc090f0fdea7907f85545 (patch)
tree121da07a6bd9dc850b5d277961534685a939d31c /emacs
parent14db78786649a286801f5d5e480c56e538a59ffe (diff)
downloaddotfiles-c0a3a8b951db708d227dc090f0fdea7907f85545.tar.gz
dotfiles-c0a3a8b951db708d227dc090f0fdea7907f85545.zip
Improve mode-line in emacs
Diffstat (limited to 'emacs')
-rw-r--r--emacs/loader.org74
1 files changed, 69 insertions, 5 deletions
diff --git a/emacs/loader.org b/emacs/loader.org
index 4f1c4e4..73d7ae3 100644
--- a/emacs/loader.org
+++ b/emacs/loader.org
@@ -85,9 +85,9 @@ Threshold for faster startup.
**** UI
Editor specific options such as adding line numbers.
-Disable UI that starts when starting emacs and also set the y or n instead of
-yes or no. Also stop the start up message from popping up and enter the scratch
-buffer instead.
+Disable UI that starts when starting emacs and also set the y or n
+instead of yes or no. Also stop the start up message from popping up
+and enter the scratch buffer instead.
#+BEGIN_SRC emacs-lisp
(setq inhibit-startup-message t)
(tool-bar-mode 0)
@@ -95,6 +95,64 @@ buffer instead.
(fset 'yes-or-no-p 'y-or-n-p)
#+END_SRC
+Editing the modeline. ~%c~ might be a bit slow though, so that could
+be removed if that is ever a problem.
+
+#+BEGIN_SRC emacs-lisp
+ (defun -custom-modeline-github-vc ()
+ (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-")))
+ (concat
+ (propertize (format " %s" (all-the-icons-octicon "git-branch"))
+ 'face `(:height 1 :family ,(all-the-icons-octicon-family))
+ 'display '(raise 0))
+ (propertize (format " %s" branch))
+ (propertize " "))))
+
+ (defun -custom-modeline-svn-vc ()
+ (let ((revision (cadr (split-string vc-mode "-"))))
+ (concat
+ (propertize (format " %s" (all-the-icons-faicon "cloud"))
+ 'face `(:height 1)
+ 'display '(raise 0))
+ (propertize (format " %s" revision) 'face `(:height 0.9)))))
+
+ (defvar y/mode-line-vc
+ '(:propertize
+ (:eval (when vc-mode
+ (cond
+ ((string-match "Git[:-]" vc-mode) (-custom-modeline-github-vc))
+ ((string-match "SVN-" vc-mode) (-custom-modeline-svn-vc))
+ (t (format "%s" vc-mode)))))
+ face mode-line-directory)
+ "Formats the current directory.")
+
+ (define-minor-mode minor-mode-blackout-mode
+ "Hides minor modes from the mode line."
+ t)
+
+ (catch 'done
+ (mapc (lambda (x)
+ (when (and (consp x)
+ (equal (cadr x) '("" minor-mode-alist)))
+ (let ((original (copy-sequence x)))
+ (setcar x 'minor-mode-blackout-mode)
+ (setcdr x (list "" original)))
+ (throw 'done t)))
+ mode-line-modes))
+
+ (setq-default mode-line-format
+ (list
+ " " mode-line-modified
+ " %[" mode-line-buffer-identification "%] %6l:%3c %6 "
+ mode-line-modes
+ " %6 "
+ y/mode-line-vc
+ mode-line-end-spaces))
+#+END_SRC
+
+#+RESULTS:
+| | (%1* %1+) | %[ | (%12b) | %] %6l:%3c %6 | (%[ ( (:propertize ( mode-name) help-echo Major mode |
+
**** Global settings
Move the backup files into the temporaty directory so that they are out of the
@@ -825,16 +883,22 @@ Enabling global flycheck support.
;; (use-package dracula-theme)
+ (use-package solarized-theme
+ :config
+ (setq solarized-use-variable-pitch nil))
+
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
- (load-theme 'plan9 t)
+ (load-theme 'solarized-light t)
(toggle-scroll-bar -1)))
- (progn (load-theme 'plan9 t)
+ (progn (load-theme 'solarized-light t)
(toggle-scroll-bar -1)))
#+END_SRC
+#+RESULTS:
+
** My Code
#+BEGIN_SRC emacs-lisp
(defun y/swap-windows ()