compile on daemon start/terminal theme
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -4,4 +4,6 @@ lisp/
|
||||
auto-save-list/
|
||||
recentf
|
||||
themes/
|
||||
network-security.data
|
||||
network-security.data
|
||||
*.elc
|
||||
*.*~
|
||||
17
init.el
17
init.el
@@ -1,8 +1,15 @@
|
||||
;;(package-initialize)
|
||||
|
||||
(load "~/.emacs.d/my-loadpackages.el")
|
||||
(defun byte-compile-init-dir ()
|
||||
"Byte-compile all your dotfiles."
|
||||
(interactive)
|
||||
(byte-recompile-directory user-emacs-directory 0))
|
||||
|
||||
(byte-compile-init-dir)
|
||||
(load "~/.emacs.d/my-loadpackages.elc")
|
||||
(add-hook 'after-init-hook '(lambda ()
|
||||
(load "~/.emacs.d/my-noexternals.el")
|
||||
(load "~/.emacs.d/my-setkeys.el")
|
||||
(load "~/.emacs.d/my-modeline.el")
|
||||
(load "~/.emacs.d/my-linum.el")))
|
||||
(load "~/.emacs.d/my-noexternals.elc")
|
||||
(load "~/.emacs.d/my-setkeys.elc")
|
||||
(load "~/.emacs.d/my-modeline.elc")
|
||||
(load "~/.emacs.d/my-linum.elc")
|
||||
(load "~/.emacs.d/my-themes.elc")))
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
(defvar linum-current-line 1 "Current line number.")
|
||||
(defvar linum-format-fmt "" " ")
|
||||
(defvar linum-format "" " ")
|
||||
|
||||
(defface linum-current-line
|
||||
`((t :inherit linum
|
||||
@@ -28,13 +30,12 @@
|
||||
(if (= line linum-current-line)
|
||||
'linum-current-line
|
||||
'linum)))
|
||||
(concat
|
||||
(propertize (format linum-format-fmt line) 'face face)
|
||||
"")))
|
||||
(propertize (format linum-format-fmt line) 'face face)))
|
||||
|
||||
(unless window-system
|
||||
(setq linum-format 'linum-format-func))
|
||||
|
||||
(add-hook 'find-file-hook (lambda ()
|
||||
(linum-mode 1)))
|
||||
(add-hook 'eshell-mode-hook (lambda ()
|
||||
(linum mode -1)))
|
||||
(linum-mode -1)))
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
(load "~/.emacs.d/my-packages.el")
|
||||
(load "~/.emacs.d/my-packages.elc")
|
||||
|
||||
(require 'use-package)
|
||||
|
||||
(use-package ivy
|
||||
:init
|
||||
(setq ivy-use-virtual-buffers t
|
||||
ivy-count-format ""
|
||||
ivy-display-style nil)
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
(use-package projectile)
|
||||
(use-package cl)
|
||||
@@ -17,34 +21,12 @@
|
||||
evil-motion-state-tag "M"
|
||||
evil-replace-state-tag "R"
|
||||
evil-want-fine-undo 'fine )
|
||||
:config
|
||||
(evil-mode 1))
|
||||
(use-package magit)
|
||||
(use-package evil-magit
|
||||
:init
|
||||
(setq evil-magit-state 'normal))
|
||||
(use-package neotree
|
||||
;;(setq neo-theme 'file-icons
|
||||
:init
|
||||
(setq neo-theme 'ascii
|
||||
neo-show-updir-line nil
|
||||
neo-window-width 25
|
||||
neo-smart-open t
|
||||
neo-persist-show nil)
|
||||
:config
|
||||
(add-hook 'neotree-mode-hook
|
||||
(lambda () (setq-local mode-line-format nil)))
|
||||
(add-hook 'neotree-mode-hook
|
||||
(lambda () (setq-local tab-width 2)))
|
||||
(advice-add 'display-buffer :around
|
||||
'(lambda (f &rest args)
|
||||
(let ((neotree? (get-buffer-window " *NeoTree*")))
|
||||
(when neotree? (neotree-hide))
|
||||
(apply f args)
|
||||
(select-window
|
||||
(apply 'get-buffer-window args))
|
||||
(when neotree? (neotree-projectile))
|
||||
(select-window
|
||||
(apply 'get-buffer-window args))))))
|
||||
(use-package fill-column-indicator
|
||||
:init
|
||||
(setq fci-rule-column 80))
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
;; change mode-line color by evil state
|
||||
(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)
|
||||
'("gray12" . "ivory"))
|
||||
'("gray17" . "ivory"))
|
||||
((evil-insert-state-p)
|
||||
'("firebrick" . "ivory"))
|
||||
((evil-visual-state-p)
|
||||
@@ -16,19 +20,38 @@
|
||||
(t default-color))))
|
||||
(set-face-background 'mode-line (car color))
|
||||
(set-face-foreground 'mode-line (cdr color))))))
|
||||
;; (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))))))
|
||||
|
||||
(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 "%s " evil-normal-state-tag))
|
||||
((evil-visual-state-p) (format "%s " evil-visual-state-tag))
|
||||
((evil-insert-state-p) (format "%s " evil-insert-state-tag))
|
||||
((evil-emacs-state-p) (format "%s " evil-emacs-state-tag))
|
||||
((evil-operator-state-p) (format "%s " evil-operator-state-tag))
|
||||
((evil-motion-state-p) (format "%s " evil-motion-state-tag))
|
||||
((evil-replace-state-p) (format "%s " evil-replace-state-tag))))
|
||||
(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 " ))))
|
||||
|
||||
(defun vc-mode-branch-state ()
|
||||
(let ((bufname (buffer-file-name (current-buffer))))
|
||||
|
||||
@@ -13,47 +13,16 @@
|
||||
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
||||
(setq scroll-step 1
|
||||
scroll-conservatively 10000) ;; keyboard scroll one line at a time
|
||||
;; theme
|
||||
(defvar my:theme 'gruvbox)
|
||||
(defvar my:theme-window-loaded nil)
|
||||
(defvar my:theme-terminal-loaded nil)
|
||||
(if (daemonp)
|
||||
(add-hook
|
||||
'after-make-frame-functions(lambda (frame)
|
||||
(select-frame frame)
|
||||
(when (window-system frame)
|
||||
(set-frame-parameter
|
||||
(selected-frame) 'internal-border-width 10)
|
||||
(add-to-list 'default-frame-alist
|
||||
'(height . 42))
|
||||
(add-to-list 'default-frame-alist
|
||||
'(width . 84))
|
||||
(unless my:theme-window-loaded
|
||||
(if my:theme-terminal-loaded
|
||||
(enable-theme my:theme)
|
||||
(load-theme my:theme t))
|
||||
(setq my:theme-window-loaded t))
|
||||
(unless my:theme-terminal-loaded
|
||||
(if my:theme-window-loaded
|
||||
(enable-theme my:theme)
|
||||
(load-theme my:theme t))
|
||||
(setq my:theme-terminal-loaded t)))))
|
||||
(progn
|
||||
(load-theme my:theme t)
|
||||
(if (display-graphic-p)
|
||||
(setq my:theme-window-loaded t)
|
||||
(setq my:theme-terminal-loaded t)))
|
||||
(set-frame-parameter (selected-frame) 'internal-border-width 10)
|
||||
(add-to-list 'default-frame-alist '(height . 42))
|
||||
(add-to-list 'default-frame-alist '(width . 84)))
|
||||
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq default-tab-width 2)
|
||||
(setq tab-width 2)
|
||||
(defvaralias 'c-basic-offset 'tab-width)
|
||||
(defvaralias 'cperl-indent-level 'tab-width)
|
||||
(setq backup-by-copying t ; don't clobber symlinks
|
||||
backup-directory-alist
|
||||
'(("." . "~/.saves")) ; don't litter my fs tree
|
||||
undo-tree-history-directory-alist
|
||||
'(("." . "~/.undo-tree"))
|
||||
delete-old-versions t
|
||||
kept-new-versions 6
|
||||
kept-old-versions 2
|
||||
@@ -62,9 +31,33 @@
|
||||
`((".*" . ,temporary-file-directory)))
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,temporary-file-directory t)))
|
||||
(setq undo-tree-auto-save-history t)
|
||||
(global-hl-line-mode 1)
|
||||
(blink-cursor-mode 0)
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
(setq vc-mode 1)
|
||||
(display-time-mode 1)
|
||||
(display-battery-mode 1)
|
||||
|
||||
(defun remove-elc-on-save ()
|
||||
"If you're saving an elisp file, likely the .elc is no longer valid."
|
||||
(add-hook 'after-save-hook
|
||||
(lambda ()
|
||||
(if (file-exists-p (concat buffer-file-name "c"))
|
||||
(delete-file (concat buffer-file-name "c"))))
|
||||
nil
|
||||
t))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
|
||||
|
||||
(add-hook 'eshell-mode-hook (lambda ()
|
||||
(setq-local global-hl-line-mode nil)))
|
||||
|
||||
(add-hook 'term-mode-hook (lambda ()
|
||||
(setq-local global-hl-line-mode nil)))
|
||||
|
||||
(defun my-term-paste (&optional string)
|
||||
(interactive)
|
||||
(process-send-string
|
||||
(get-buffer-process (current-buffer))
|
||||
(if string string (current-kill 0))))
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
(normal-top-level-add-subdirs-to-load-path))
|
||||
(package-initialize)
|
||||
|
||||
(unless (package-installed-p 'use-package) ; unless it is already installed
|
||||
(package-refresh-contents) ; updage packages archive
|
||||
(package-install 'use-package)) ; and install the most recent version of use-package
|
||||
|
||||
(require 'use-package) ; guess what this one does too ?
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
|
||||
@@ -8,15 +8,6 @@
|
||||
(global-set-key (kbd "<f1> l") 'counsel-load-library)
|
||||
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
|
||||
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
|
||||
(global-set-key [f8] 'neotree-toggle)
|
||||
(add-hook 'neotree-mode-hook
|
||||
(lambda ()
|
||||
(define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter)
|
||||
(define-key evil-normal-state-local-map (kbd "SPC") 'neotree-enter)
|
||||
(define-key evil-normal-state-local-map (kbd "q") 'neotree-hide)
|
||||
(define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter)))
|
||||
(define-key evil-normal-state-map [escape] 'keyboard-quit)
|
||||
(define-key evil-visual-state-map [escape] 'keyboard-quit)
|
||||
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
|
||||
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
|
||||
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
|
||||
|
||||
51
my-themes.el
Normal file
51
my-themes.el
Normal file
@@ -0,0 +1,51 @@
|
||||
(defvar my:theme 'gruvbox)
|
||||
(defvar my:theme-window-loaded nil)
|
||||
(defvar my:theme-terminal-loaded nil)
|
||||
(if (daemonp)
|
||||
(add-hook
|
||||
'after-make-frame-functions
|
||||
(lambda (frame)
|
||||
(select-frame frame)
|
||||
(when (window-system frame)
|
||||
(set-frame-parameter
|
||||
(selected-frame) 'internal-border-width 10)
|
||||
(unless my:theme-window-loaded
|
||||
(if my:theme-terminal-loaded
|
||||
(enable-theme my:theme)
|
||||
(load-theme my:theme t))
|
||||
(setq my:theme-window-loaded t))
|
||||
(unless my:theme-terminal-loaded
|
||||
(if my:theme-window-loaded
|
||||
(enable-theme my:theme)
|
||||
(load-theme my:theme t))
|
||||
(setq my:theme-terminal-loaded t)))))
|
||||
(progn
|
||||
(load-theme my:theme t)
|
||||
(if (display-graphic-p)
|
||||
(setq my:theme-window-loaded t)
|
||||
(setq my:theme-terminal-loaded t)))
|
||||
(set-frame-parameter (selected-frame) 'internal-border-width 10))
|
||||
|
||||
(custom-set-faces
|
||||
;; term
|
||||
'(term-color-black
|
||||
((t (:foreground "#525252"))))
|
||||
'(term-color-red
|
||||
((t (:foreground "#ff4936"))))
|
||||
'(term-color-green
|
||||
((t (:foreground "#bb3627"))))
|
||||
'(term-color-yellow
|
||||
((t (:foreground "#86261c"))))
|
||||
'(term-color-blue
|
||||
((t (:foreground "#0fd9ff"))))
|
||||
'(term-color-magenta
|
||||
((t (:foreground "#0ba2be"))))
|
||||
'(term-color-cyan
|
||||
((t (:foreground "#076678"))))
|
||||
'(term-color-white
|
||||
((t (:foreground "#bfbfbf")))))
|
||||
|
||||
(add-hook 'before-make-frame-hook
|
||||
#'(lambda ()
|
||||
(add-to-list 'default-frame-alist '(height . 42))
|
||||
(add-to-list 'default-frame-alist '(width . 84))))
|
||||
Reference in New Issue
Block a user