icon modeline
This commit is contained in:
21
init.el
21
init.el
@@ -14,3 +14,24 @@
|
||||
(load "~/.emacs.d/my-modeline.elc")
|
||||
(load "~/.emacs.d/my-linum.elc")
|
||||
(load "~/.emacs.d/my-themes.elc")))
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(swiper colemak-evil evil all-the-icons use-package rich-minority projectile mode-icons magit-find-file haskell-mode gruvbox-theme fill-column-indicator evil-magit counsel))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(term-color-black ((t (:foreground "#525252"))))
|
||||
'(term-color-blue ((t (:foreground "#33ddff"))))
|
||||
'(term-color-cyan ((t (:foreground "#196f80"))))
|
||||
'(term-color-green ((t (:foreground "#bf4c26"))))
|
||||
'(term-color-magenta ((t (:foreground "#26a6bf"))))
|
||||
'(term-color-red ((t (:foreground "#ff6633"))))
|
||||
'(term-color-white ((t (:foreground "#bfbfbf"))))
|
||||
'(term-color-yellow ((t (:foreground "#803319")))))
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
(count-lines
|
||||
(point-min)
|
||||
(point-max))))))
|
||||
(concat "%" (number-to-string w) "d "))))))
|
||||
(concat "%" (number-to-string w) "d"))))))
|
||||
|
||||
|
||||
(defun linum-format-func (line)
|
||||
|
||||
@@ -3,30 +3,45 @@
|
||||
(require 'use-package)
|
||||
|
||||
(use-package ivy
|
||||
:init
|
||||
(setq ivy-use-virtual-buffers t
|
||||
ivy-count-format ""
|
||||
ivy-display-style nil)
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
:init
|
||||
(setq ivy-use-virtual-buffers t
|
||||
ivy-count-format ""
|
||||
ivy-display-style nil)
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
(use-package projectile)
|
||||
(use-package cl)
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-normal-state-tag "N"
|
||||
evil-insert-state-tag "I"
|
||||
evil-visual-state-tag "V"
|
||||
evil-emacs-state-tag "E"
|
||||
evil-operator-state-tag "O"
|
||||
evil-motion-state-tag "M"
|
||||
evil-replace-state-tag "R"
|
||||
evil-want-fine-undo 'fine )
|
||||
:config
|
||||
(evil-mode 1))
|
||||
:init
|
||||
(setq evil-normal-state-tag "N"
|
||||
evil-insert-state-tag "I"
|
||||
evil-visual-state-tag "V"
|
||||
evil-emacs-state-tag "E"
|
||||
evil-operator-state-tag "O"
|
||||
evil-motion-state-tag "M"
|
||||
evil-replace-state-tag "R"
|
||||
evil-want-fine-undo 'fine )
|
||||
:config
|
||||
;; (add-to-list 'evil-insert-state-modes 'lisp-interaction-mode)
|
||||
(evil-mode 1))
|
||||
(use-package magit)
|
||||
(use-package evil-magit
|
||||
:init
|
||||
(setq evil-magit-state 'normal))
|
||||
:init
|
||||
(setq evil-magit-state 'normal))
|
||||
(use-package fill-column-indicator
|
||||
:init
|
||||
(setq fci-rule-column 80))
|
||||
:init
|
||||
(setq fci-rule-column 80))
|
||||
(use-package all-the-icons)
|
||||
;; (use-package neotree
|
||||
;; :init
|
||||
;; (setq neo-smart-open 1
|
||||
;; neo-auto-indent-point nil
|
||||
;; neo-mode-line-type 'none
|
||||
;; neo-persist-show nil
|
||||
;; neo-window-width 25
|
||||
;; neo-banner-message nil
|
||||
;; neo-show-updir-line nil)
|
||||
;; :config
|
||||
;; (add-hook 'neotree-mode-hook (lambda () (setq-local tab-width 1)))
|
||||
;; (eval-after-load "neotree" (load "~/.emacs.d/my-neotree.elc"))
|
||||
;; )
|
||||
|
||||
176
my-modeline.el
176
my-modeline.el
@@ -1,62 +1,156 @@
|
||||
(eval-when-compile (require 'cl))
|
||||
(require 'evil)
|
||||
(require 'magit)
|
||||
(lexical-let ((default-color (cons (face-background 'mode-line)
|
||||
(face-foreground 'mode-line))))
|
||||
(add-hook 'post-command-hook
|
||||
(lambda ()
|
||||
(let ((color (cond ((minibufferp) default-color)
|
||||
((evil-normal-state-p)
|
||||
'("gray17" . "ivory"))
|
||||
((evil-insert-state-p)
|
||||
'("firebrick" . "ivory"))
|
||||
((evil-visual-state-p)
|
||||
'("DarkSlateGray" . "ivory"))
|
||||
((evil-emacs-state-p)
|
||||
'("SeaGreen" . "ivory"))
|
||||
((buffer-modified-p)
|
||||
'("firebrick" . "ivory"))
|
||||
(t default-color))))
|
||||
(set-face-background 'mode-line (car color))
|
||||
(set-face-foreground 'mode-line (cdr color))))))
|
||||
(require 'all-the-icons)
|
||||
|
||||
;; (lexical-let ((default-color (cons (face-background 'mode-line)
|
||||
;; (face-foreground 'mode-line))))
|
||||
;; (add-hook 'post-command-hook
|
||||
;; (lambda ()
|
||||
;; (let ((color (cond ((minibufferp) default-color)
|
||||
;; ((evil-normal-state-p)
|
||||
;; '("#181818" . "ivory"))
|
||||
;; ((evil-insert-state-p)
|
||||
;; '("firebrick" . "ivory"))
|
||||
;; ((evil-visual-state-p)
|
||||
;; '("DarkSlateGray" . "ivory"))
|
||||
;; ((evil-emacs-state-p)
|
||||
;; '("SeaGreen" . "ivory"))
|
||||
;; ((buffer-modified-p)
|
||||
;; '("firebrick" . "ivory"))
|
||||
;; (t default-color))))
|
||||
;; (set-face-background 'mode-line (car color))
|
||||
;; (set-face-font 'mode-line "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-buffer-id "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-emphasis "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-highlight "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-inactive "Iosevka Term-10")
|
||||
;; (set-face-foreground 'mode-line (cdr color))))))
|
||||
|
||||
(defun fancy-mode-line-render (left center right &optional lpad rpad)
|
||||
"Return a string the width of the current window with
|
||||
LEFT, CENTER, and RIGHT spaced out accordingly, LPAD and RPAD,
|
||||
can be used to add a number of spaces to the front and back of the string."
|
||||
(condition-case err
|
||||
(let* ((left (if lpad (concat (make-string lpad ?\s) left) left))
|
||||
(right (if rpad (concat right (make-string rpad ?\s)) right))
|
||||
(width (apply '+ (window-width)
|
||||
(let ((m (window-margins)))
|
||||
(list (or (car m) 0) (or (cdr m) 0)))))
|
||||
(total-length (+ (length left) (length center) (length right) 2)))
|
||||
(when (> total-length width) (setq left "" right ""))
|
||||
(let* ((left-space (/ (- width (length center)) 2))
|
||||
(right-space (- width left-space (length center)))
|
||||
(lspaces (max (- left-space (length left)) 1))
|
||||
(rspaces (max (- right-space (length right)) 1 0)))
|
||||
(concat left (make-string lspaces ?\s)
|
||||
center
|
||||
(make-string rspaces ?\s)
|
||||
right)))
|
||||
(error (format "[%s]: (%s) (%s) (%s)" err left center right))))
|
||||
|
||||
(defun simple-mode-line-render (left right)
|
||||
(let* ((available-width (- (window-width) (length left) 2)))
|
||||
(format (format " %%s %%%ds " available-width) left right)))
|
||||
|
||||
(defun evil-mode-state ()
|
||||
(cond ((evil-normal-state-p) (format "N " ))
|
||||
((evil-visual-state-p) (format "V " ))
|
||||
((evil-insert-state-p) (format "I " ))
|
||||
((evil-emacs-state-p) (format "E " ))
|
||||
((evil-operator-state-p) (format "O " ))
|
||||
((evil-motion-state-p) (format "M " ))
|
||||
((evil-replace-state-p) (format "R " ))))
|
||||
(cond ((evil-normal-state-p) (format " NORMAL " ))
|
||||
((evil-visual-state-p) (format " VISUAL " ))
|
||||
((evil-insert-state-p) (format " INSERT " ))
|
||||
((evil-emacs-state-p) (format " EMACS " ))
|
||||
((evil-operator-state-p) (format " OPERATOR " ))
|
||||
((evil-motion-state-p) (format " MOTION " ))
|
||||
((evil-replace-state-p) (format " REPLACE " ))))
|
||||
|
||||
(defun vc-mode-branch-state ()
|
||||
(let ((bufname (buffer-file-name (current-buffer))))
|
||||
(when bufname
|
||||
(when (vc-working-revision bufname)
|
||||
(concat (format " %s" (magit-get-current-branch))
|
||||
(format " [%s]" (vc-state bufname)))))))
|
||||
(concat
|
||||
(propertize (format " %s" (all-the-icons-octicon "git-branch"))
|
||||
'face `(:height 1.0
|
||||
:family ,(all-the-icons-octicon-family))
|
||||
'display '(raise 0.0))
|
||||
(format " %s [%s]"
|
||||
(propertize (magit-get-current-branch) 'face 'bold)
|
||||
(vc-state bufname)))))))
|
||||
|
||||
(defun powerline-modified ()
|
||||
(let* ((config-alist
|
||||
'(("*" all-the-icons-faicon-family
|
||||
all-the-icons-faicon "chain-broken" :height 1.2 :v-adjust -0.0)
|
||||
("-" all-the-icons-faicon-family
|
||||
all-the-icons-faicon "link" :height 1.2 :v-adjust -0.0)
|
||||
("%" all-the-icons-octicon-family
|
||||
all-the-icons-octicon "lock" :height 1.2 :v-adjust 0.1)))
|
||||
(result (cdr (assoc (format-mode-line "%*") config-alist))))
|
||||
(propertize (apply (cadr result) (cddr result))
|
||||
'face `(:family ,(funcall (car result))))))
|
||||
|
||||
(defun custom-modeline-mode-icon ()
|
||||
(let ((icon (all-the-icons-icon-for-buffer)))
|
||||
(unless (symbolp icon) ;; This implies it's the major mode
|
||||
(format " %s"
|
||||
(propertize
|
||||
icon
|
||||
'face
|
||||
`(:height 1.0 :family ,(all-the-icons-icon-family-for-buffer))
|
||||
'display '(raise 0.0))))))
|
||||
|
||||
(defun powerline-mode-default ()
|
||||
(let ((icon (all-the-icons-icon-for-buffer)))
|
||||
(when (symbolp icon) ;; This implies it's the major mode
|
||||
(propertize
|
||||
(format-mode-line "%m ")
|
||||
'face `(:height 0.8);; :foreground ,(powerline-fg) :background ,(powerline-c1))
|
||||
'display '(raise 0.1)))))
|
||||
|
||||
(defun mode-line-fill (reserve)
|
||||
"Return empty space leaving RESERVE space on the right."
|
||||
(unless reserve
|
||||
(setq reserve 20))
|
||||
(when (and window-system (eq 'right (get-scroll-bar-mode)))
|
||||
(setq reserve (- reserve 3)))
|
||||
(propertize " "
|
||||
'display
|
||||
`((space :align-to (- (+ right right-fringe right-margin)
|
||||
,reserve)))))
|
||||
|
||||
(defun line-count-line ()
|
||||
(concat (propertize
|
||||
(all-the-icons-faicon "rebel")
|
||||
'face `(:height 0.8 :background "#86261c") 'display '(raise 0.2))
|
||||
(propertize
|
||||
(format " %%l/%d "
|
||||
(count-lines (point-min) (point-max)))
|
||||
'face `(:background "#86261c"))))
|
||||
|
||||
(defun powerline-time ()
|
||||
(let* ((hour (string-to-number (format-time-string "%I")))
|
||||
(icon (all-the-icons-wicon (format "time-%s" hour) :height 1.0 :v-adjust 0.0)))
|
||||
(concat
|
||||
(propertize (format-time-string " %H:%M ")
|
||||
'face `(:height 1.0 :background "#86261c"))
|
||||
(propertize (format "%s" icon)
|
||||
'face `(:height 1.0 :family "Weather Icons" :background "#86261c")
|
||||
'display '(raise -0.0))
|
||||
(propertize " · " 'face `(:height 1.0 :background "#86261c")))))
|
||||
|
||||
(setq-default mode-line-format
|
||||
(list
|
||||
mode-line-front-space
|
||||
'((:eval (simple-mode-line-render
|
||||
'((:eval (fancy-mode-line-render
|
||||
;; left
|
||||
(format-mode-line
|
||||
(concat
|
||||
(evil-mode-state)
|
||||
"[%b] [%*]"
|
||||
(powerline-modified)
|
||||
(propertize (evil-mode-state) 'face 'bold)
|
||||
(custom-modeline-mode-icon) ;; %m
|
||||
" %b "
|
||||
(vc-mode-branch-state)))
|
||||
;;center
|
||||
" "
|
||||
;; right
|
||||
(format-mode-line
|
||||
(concat "[%m] "
|
||||
(format-time-string "%H:%M ")
|
||||
battery-mode-line-string "]"
|
||||
" %l/"
|
||||
(number-to-string
|
||||
(count-lines
|
||||
(point-min)
|
||||
(point-max))))))))))
|
||||
(concat
|
||||
;; (format-time-string "%H:%M ⁃ ")
|
||||
(powerline-time)
|
||||
(line-count-line)))
|
||||
0 0)))))
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
'(font . "-ypn-envypn-medium-r-normal--15-150-75-75-c-90-iso8859-1"))
|
||||
(set-frame-font
|
||||
"-ypn-envypn-medium-r-normal--15-150-75-75-c-90-iso8859-1")
|
||||
|
||||
;; (set-face-background 'mode-line "#181818")
|
||||
;; (set-face-font 'mode-line "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-buffer-id "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-emphasis "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-highlight "Iosevka Term-10")
|
||||
;; (set-face-font 'mode-line-inactive "Iosevka Term-10")
|
||||
;; (set-face-foreground 'mode-line "ivory")
|
||||
(setq inhibit-startup-screen t)
|
||||
(setq vc-follow-symlinks t)
|
||||
(global-auto-revert-mode 1)
|
||||
@@ -16,6 +24,8 @@
|
||||
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
||||
(setq scroll-step 1
|
||||
scroll-conservatively 10000) ;; keyboard scroll one line at a time
|
||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.zsh\\'" . sh-mode))
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default tab-width 2)
|
||||
(setq-default c-default-style "linux"
|
||||
@@ -61,8 +71,8 @@
|
||||
(setq-local global-hl-line-mode nil)))
|
||||
|
||||
(defadvice term-handle-exit
|
||||
(after term-kill-buffer-on-exit activate)
|
||||
(kill-buffer))
|
||||
(after term-kill-buffer-on-exit activate)
|
||||
(kill-buffer))
|
||||
|
||||
(defun my-term-paste (&optional string)
|
||||
(interactive)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
|
||||
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
|
||||
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
|
||||
(global-set-key [f8] 'neotree-toggle)
|
||||
(defun gcm-scroll-down ()
|
||||
(interactive)
|
||||
(scroll-up 1))
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
(select-frame frame)
|
||||
(when (window-system frame)
|
||||
(set-frame-parameter
|
||||
(selected-frame) 'internal-border-width 7)
|
||||
(selected-frame) 'internal-border-width 5)
|
||||
(unless my:theme-window-loaded
|
||||
(if my:theme-terminal-loaded
|
||||
(enable-theme my:theme)
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
;; UI
|
||||
`(default ((t (:background ,nrwo-bg :foreground ,nrwo-light0))))
|
||||
`(cursor ((t (:background ,nrwo-light0))))
|
||||
`(mode-line ((t (:box nil :background ,nrwo-dark2 :foreground ,nrwo-light2))))
|
||||
`(mode-line-inactive ((t (:box nil :background ,nrwo-dark1 :foreground ,nrwo-light4))))
|
||||
`(mode-line ((t (:box nil :background ,nrwo-bg :foreground "ivory" :font "Iosevka Term-10"))))
|
||||
`(mode-line-inactive ((t (:box nil :background ,nrwo-dark1 :foreground ,nrwo-light4 :font "Iosevka Term-10"))))
|
||||
`(fringe ((t (:background ,nrwo-bg))))
|
||||
`(linum ((t (:background ,nrwo-bg :foreground ,nrwo-dark4))))
|
||||
`(hl-line ((t (:background ,nrwo-color0))))
|
||||
@@ -78,16 +78,19 @@
|
||||
`(shadow ((t (:foreground ,nrwo-dark4))))
|
||||
|
||||
;; Built-in syntax
|
||||
`(font-lock-builtin-face ((t (:foreground ,nrwo-light0 t))))
|
||||
`(font-lock-builtin-face ((t (:foreground ,nrwo-color9 t))))
|
||||
`(font-lock-constant-face ((t (:foreground ,nrwo-color10 t))))
|
||||
`(font-lock-comment-face ((t (:foreground ,nrwo-dark4))))
|
||||
`(font-lock-function-name-face ((t (:foreground ,nrwo-color15 ))))
|
||||
`(font-lock-keyword-face ((t (:foreground ,nrwo-light0 t))))
|
||||
`(font-lock-keyword-face ((t (:foreground ,nrwo-color10))))
|
||||
`(font-lock-string-face ((t (:foreground ,nrwo-color5))))
|
||||
`(font-lock-variable-name-face ((t (:foreground ,nrwo-color9))))
|
||||
`(font-lock-type-face ((t (:foreground ,nrwo-color12))))
|
||||
`(font-lock-warning-face ((t (:foreground ,nrwo-color15 t))))
|
||||
|
||||
`(neo-dir-link-face ((t (:foreground ,nrwo-color10))))
|
||||
`(neo-root-dir-face ((t (:foreground ,nrwo-dark4))))
|
||||
|
||||
;; whitespace-mode
|
||||
`(whitespace-space ((t (:background ,nrwo-bg :foreground ,nrwo-dark4))))
|
||||
`(whitespace-hspace ((t (:background ,nrwo-bg :foreground ,nrwo-dark4))))
|
||||
|
||||
Reference in New Issue
Block a user