Browse Source

Created new custom theme for emacs.

Also added paren-navigation hotkeys.
Tom Flucke 7 years ago
parent
commit
9aa606c8fa
3 changed files with 162 additions and 50 deletions
  1. 58 0
      .emacs.d/Thomas-Experiement-theme.el
  2. 103 49
      .emacs.d/init.el
  3. 1 1
      .i3/mpdFunctions.sh

+ 58 - 0
.emacs.d/Thomas-Experiement-theme.el

@@ -0,0 +1,58 @@
+(deftheme Thomas-Experiement
+  "Created 2018-08-17.")
+
+(custom-theme-set-faces
+ 'Thomas-Experiement
+ '(cursor ((t (:background "red"))))
+ '(fixed-pitch ((t (:family "Monospace"))))
+ '(variable-pitch ((((type w32)) (:foundry "outline" :family "Arial")) (t (:family "Sans Serif"))))
+ '(escape-glyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown"))))
+ '(homoglyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown"))))
+ '(minibuffer-prompt ((t (:foreground "blue"))))
+ '(highlight ((t (:background "color-88"))))
+ '(region ((t (:background "brightblue"))))
+ '(shadow ((t (:foreground "brightblack"))))
+ '(secondary-selection ((t (:background "brightblack"))))
+ '(trailing-whitespace ((t (:foreground "yellow" :background "cyan"))))
+ '(font-lock-builtin-face ((t (:foreground "cyan"))))
+ '(font-lock-comment-delimiter-face ((t (:foreground "brightyellow"))))
+ '(font-lock-comment-face ((t (:foreground "brightblack"))))
+ '(font-lock-constant-face ((t (:foreground "color-28"))))
+ '(font-lock-doc-face ((t (:foreground "brightblue"))))
+ '(font-lock-function-name-face ((t (:foreground "color-112"))))
+ '(font-lock-keyword-face ((t (:foreground "color-202"))))
+ '(font-lock-negation-char-face ((t (:foreground "green"))))
+ '(font-lock-preprocessor-face ((t (:foreground "color-163" :weight semi-bold))))
+ '(font-lock-regexp-grouping-backslash ((t (:foreground "yellow"))))
+ '(font-lock-regexp-grouping-construct ((t (:foreground "magenta"))))
+ '(font-lock-string-face ((t (:foreground "color-184"))))
+ '(font-lock-type-face ((t (:foreground "color-93"))))
+ '(font-lock-variable-name-face ((t (:foreground "color-41"))))
+ '(font-lock-warning-face ((t (:underline (:color "color-130" :style wave)))))
+ '(button ((t (:inherit (link)))))
+ '(link ((t (:underline (:color foreground-color :style line) :foreground "blue"))))
+ '(link-visited ((t (:underline (:color foreground-color :style line) :foreground "magenta"))))
+ '(fringe ((t (:background "brightgreen"))))
+ '(header-line ((t (:foreground "magenta" :inherit (mode-line)))))
+ '(tooltip ((t (:foreground "black" :background "lightyellow" :inherit (variable-pitch)))))
+ '(mode-line ((t (:box nil :foreground "brightblue" :background "brightyellow"))))
+ '(mode-line-buffer-id ((t (:foreground "green"))))
+ '(mode-line-emphasis ((t (:slant italic :foreground "brightmagenta"))))
+ '(mode-line-highlight ((t (:weight bold :box nil :foreground "magenta"))))
+ '(mode-line-inactive ((t (:box nil :foreground "brightblack" :background "brightgreen"))))
+ '(isearch ((t (:inverse-video t :foreground "yellow" :background "brightgreen"))))
+ '(isearch-fail ((t (:inverse-video t :background "brightgreen" :inherit (font-lock-warning-face)))))
+ '(lazy-highlight ((((class color) (min-colors 88) (background light)) (:background "paleturquoise")) (((class color) (min-colors 88) (background dark)) (:background "paleturquoise4")) (((class color) (min-colors 16)) (:background "turquoise3")) (((class color) (min-colors 8)) (:background "turquoise3")) (t (:underline (:color foreground-color :style line)))))
+ '(match ((t (:inverse-video t :foreground "blue" :background "brightgreen"))))
+ '(next-error ((t (:inherit (region)))))
+ '(query-replace ((t (:inherit (isearch)))))
+ '(ensime-errline-highlight ((t (:inherit nil :foreground "brightred" :underline (:color foreground-color :style wave) :slant italic :weight semi-bold))))
+ '(ensime-warnline-highlight ((t (:inherit font-lock-warning-face))))
+ '(scala-font-lock:var-face ((t (:inherit font-lock-variable-name-face))))
+ '(show-paren-match ((t (:background "blue" :foreground "green"))))
+ '(show-paren-match-expression ((t (:inherit (show-paren-match)))))
+ '(show-paren-mismatch ((t (:background "red" :foreground "white" :underline (:color foreground-color :style wave)))))
+ '(default ((t (:family "default" :foundry "default" :width normal :height 1 :weight normal :slant normal :underline nil :overline nil :strike-through nil :box nil :inverse-video nil :foreground "white" :background "black" :stipple nil :inherit nil))))
+ '(c-annotation-face ((t (:inherit font-lock-preprocessor-face)))))
+
+(provide-theme 'Thomas-Experiement)

+ 103 - 49
.emacs.d/init.el

@@ -1,5 +1,7 @@
 ;; Requires:
 ;; aspell
+;; Optional:
+;; clang
 
 ;; ----------- Default Variables -----------
 ;; Global variables
@@ -13,7 +15,8 @@
 			  show-paren-delay 0.25
               tab-width 4
 	          indent-tabs-mode nil
-              x-select-enable-clipboard t
+              ;x-select-enable-clipboard t
+              ;interprogram-paste-function 'x-cut-buffer-or-selection-value
               backup-directory-alist `(("." . ,backup-directory))
               delete-old-versions t)
 
@@ -22,12 +25,6 @@
 ;; Delete selected text when typing (normal editor behavior)
 (delete-selection-mode t)
 
-(defun mapcar-dot* (f list)
-  (loop for (a . b) on list
-        collect (funcall f a)
-        unless (listp b)
-        collect (funcall f b)))
-
 ;; ------------- Keybindings -------------
 (defun smart-beginning-of-line ()
   "Move point to first non-whitespace character or beginning-of-line.
@@ -45,16 +42,24 @@ If point was already at that position, move point to beginning of line."
 (global-set-key [home] 'smart-beginning-of-line)
 (global-set-key (kbd "C-c /") 'comment-or-uncomment-region)
 (global-set-key (kbd "C-c C-k") 'compile)
+(global-set-key (kbd "M-<left>") 'backward-list)
+(global-set-key (kbd "M-<right>") 'forward-list)
+;; TODO: See if can get working without smartparen lib.
+;; Otherwise, switch to smartparen
+;;(global-set-key (kbd "M-<up>") 'sp-up-sexp)
+;;(global-set-key (kbd "M-<down>") 'sp-down-sexp)
+(global-set-key (kbd "M-<delete>") 'kill-sexp)
 
 ;; ----------- Package Managing -----------
 ;; The package manager
 (require 'package)
 
 ;; Add package sources
-(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
-                         ("org" . "https://orgmode.org/elpa/")
-                         ("melpa" . "https://melpa.org/packages/")
-                         ("melpa-stable" . "https://stable.melpa.org/packages/"))
+(setq package-archives
+      '(("gnu" . "https://elpa.gnu.org/packages/")
+        ("org" . "https://orgmode.org/elpa/")
+        ("melpa" . "https://melpa.org/packages/")
+        ("melpa-stable" . "https://stable.melpa.org/packages/"))
       package-archive-priorities '(("melpa" . 1)))
 (package-initialize)
 
@@ -64,23 +69,23 @@ If point was already at that position, move point to beginning of line."
 (require 'use-package)
 (setq use-package-always-ensure t)
 
-;; ---------- Use X11 clipboard -----------
-(use-package xclip
-  :if (executable-find "xclip")
-  :config (xclip-mode 1))
-
 ;; ---------- Color Themes ----------
+;; TODO: Fix warning underline to always be orange/yellow
 (use-package color-theme
   :init
   ;; TODO: Fixes error about missing directory.  Don't know why.
   (unless (file-exists-p "~/.emacs.d/elpa/color-theme-20070910.1007/themes")
     (make-directory "~/.emacs.d/elpa/color-theme-20070910.1007/themes"))
   :config
-  (color-theme-initialize))
+  (color-theme-initialize)
+  (load-theme 'Thomas-Experiement t))
 
-(use-package base16-theme
-  :requires color-theme
-  :config (load-theme 'base16-tomorrow-night t))
+;; ---------- Use X11 clipboard -----------
+;; TODO: Bug.  Copy to xclip doesn't work.  Paste from does.
+(use-package xclip
+  :if (executable-find "xclip")
+  ;;:config (xclip-mode 1)
+  )
 
 ;; --------- Parentheses Matching ---------
 (show-paren-mode)
@@ -112,8 +117,9 @@ If point was already at that position, move point to beginning of line."
 ;; * Refactoring
 ;; * Error detection
 (use-package scala-mode
+  ;; TODO: Disabled.  Forgot why (Maybe redundant?).  Figure out later.
+  :disabled
   :commands (scala-mode))
-  ;:mode "\\.scala\\'")
 
 (use-package company)
 
@@ -121,22 +127,73 @@ If point was already at that position, move point to beginning of line."
   (use-package ensime
     :requires company
     :hook (scala-mode java-mode)
-    :config (setq ensime-startup-notification nil)
-    :pin melpa-stable))
-
-; --------- C Syntax checker ---------
-(use-package flycheck-irony
-  :hook c-mode)
-;  :mode ("\\.c\\'" "\\.h\\'")
-
-(use-package auto-complete)
-
-(use-package auto-complete-clang-async
-  :requires auto-complete
-  :hook c-mode
-  :mode ("\\.c\\'" "\\.h\\'"))
+    :pin melpa-stable
+    :config
+    (setq ensime-startup-notification nil)
+    (eval-after-load 'ensime-mode
+      '(define-key ensime-mode-map (kbd "C-c i")
+         (lambda () "Generate ensime.sbt file"
+           (interactive)
+           (write-region "ensimeScalaVersion in ThisBuild := \"2.11.8\""
+                                  nil (concat (read-directory-name "SBT Root:") "ensime.sbt")))))))
+
+;; --------- C Syntax checker ---------
+;; TODO: C autocomplete.  Both with clang integration and backup naive method
+;; (use-package irony
+;;   ;;:hook (c-mode c++-mode objc-mode)
+;;   :init
+;;   (add-hook 'c++-mode-hook 'irony-mode)
+;;   (add-hook 'c-mode-hook 'irony-mode)
+;;   (add-hook 'objc-mode-hook 'irony-mode)
+;;   :commands (irony-mode irony-version)
+;;   :config
+;;   (defun my-irony-mode-hook ()
+;;     (define-key irony-mode-map [remap completion-at-point]
+;;       'irony-completion-at-point-async)
+;;     (define-key irony-mode-map [remap complete-symbol]
+;;       'irony-completion-at-point-async))
+;;   (add-hook 'irony-mode-hook 'my-irony-mode-hook)
+;;   (add-hook 'irony-mode-hook irony-cdb-autosetup-compile-options)
+;;   )
+
+;; (use-package company
+;;   :init (add-hook 'after-init-hook 'global-company-mode)
+;;   :config
+;;   (setq company-idle-delay              nil
+;;         company-minimum-prefix-length   2
+;;         company-show-numbers            t
+;;         company-tooltip-limit           20
+;;         company-dabbrev-downcase        nil
+;;         company-backends                '((company-irony company-gtags))
+;;         )
+;;   :bind ("C-;" . company-complete-common)
+;;   )
+
+;; (use-package company-irony
+;;   :requires company)
+
+;; (use-package flycheck-irony
+;;   :hook c-mode)
+;; ;  :mode ("\\.c\\'" "\\.h\\'")
 
 ;; ------------ Web Mode ------------
+;; TODO: Automatic closing tab would be nice
+(defun my-sgml-insert-gt ()
+  "Inserts a `>' character and calls 
+`my-sgml-close-tag-if-necessary', leaving point where it is."
+  (interactive)
+  (insert ">")
+  (save-excursion (my-sgml-close-tag-if-necessary)))
+
+(defun my-sgml-close-tag-if-necessary ()
+  "Calls sgml-close-tag if the tag immediately before point is
+an opening tag that is not followed by a matching closing tag."
+  (when (looking-back "<\\s-*\\([^</> \t\r\n]+\\)[^</>]*>")
+    (let ((tag (match-string 1)))
+      (unless (and (not (sgml-unclosed-tag-p tag))
+           (looking-at (concat "\\s-*<\\s-*/\\s-*" tag "\\s-*>")))
+        (sgml-close-tag)))))
+
 (use-package multi-web-mode
   :init
   (setq mweb-default-major-mode 'html-mode
@@ -144,9 +201,10 @@ If point was already at that position, move point to beginning of line."
                     (js-mode  "<script[^>]*>" "</script>")
                     (css-mode "<style[^>]*>" "</style>"))
         mweb-filename-extensions '("php" "htm" "html" "ctp" "phtml" "php4" "php5"))
-;  :mode (mapcar-dot* (format "\\.%s\\'" ext '("php" "htm" "html" "ctp" "phtml" "php4" "php5")))
   :config
-  (multi-web-global-mode 1))
+  (multi-web-global-mode 1)
+  (eval-after-load "sgml-mode"
+    '(define-key sgml-mode-map ">" 'my-sgml-insert-gt)))
 
 ;; ------------ Git Mode ------------
 (when (version<= "24.4" emacs-version)
@@ -155,7 +213,6 @@ If point was already at that position, move point to beginning of line."
 
 ;; ----------- Rust Mode ------------
 (use-package rust-mode)
-;  :mode ("\\.rs\\'")
 (use-package rust-playground
   :requires rust-mode)
 (use-package cargo
@@ -173,22 +230,23 @@ If point was already at that position, move point to beginning of line."
 
 ;; ---------- C# Mode -------------
 (use-package csharp-mode
+  :disabled ;; TODO: Disabled because compiler warnings with newest version
   :if (version<= "24.4" emacs-version))
-;  :mode ("\\.cs\\'")
 
 ;; ------- Markdown Mode ----------
 (when (version<= "24.4" emacs-version)
   (use-package markdown-mode))
-;    :mode ("\\.markdown\\'" "\\.md\\'")
 
 ;; ---- StackOverflow Client ------
 (use-package sx
+  ;; TODO: I don't even know if this works.  Doesn't seem well maintained
   :disabled)
 
 ;; -------- Spellcheck ------------
 (defun flyspell-detect-ispell-args (&optional run-together)
   (cond ((string-match  "aspell$" ispell-program-name)
-		 (append (list "--sug-mode=ultra" "--lang=en_US") (if run-together '("--run-together" "--run-together-limit=5" "--run-together-min=2"))))
+		 (append (list "--sug-mode=ultra" "--lang=en_US")
+                 (if run-together '("--run-together" "--run-together-limit=5" "--run-together-min=2"))))
 		((string-match "hunspell$" ispell-program-name)
 		 "-d en_US")))
 
@@ -204,7 +262,8 @@ If point was already at that position, move point to beginning of line."
    ((executable-find "hunspell")
 	(setq ispell-program-name "hunspell")
 	(setq ispell-local-dictionary "en_US")
-	(setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))))
+	(setq ispell-local-dictionary-alist
+          '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))))
    (t
 	(setq ispell-program-name nil)))
   (setq-default ispell-extra-args (flyspell-detect-ispell-args t))
@@ -249,17 +308,12 @@ If point was already at that position, move point to beginning of line."
  ;; 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
+ '(custom-safe-themes
    (quote
-<<<<<<< HEAD
-    (company xclip hl-todo comment-tags restclient markdown-mode autopair highlight-parentheses flyspell-correct-popup rust-mode rust-playground slime-volleyball use-package multi-web-mode magit ensime color-theme base16-theme))))
-=======
-    (auto-complete auto-complete-clang-async xclip hl-todo comment-tags restclient markdown-mode autopair highlight-parentheses flyspell-correct-popup rust-mode rust-playground slime-volleyball use-package multi-web-mode magit ensime color-theme base16-theme))))
->>>>>>> 7ce8d5af1ffc98a8f6ac335c67e48bbbd53e8f56
+    ("102c7a106e03ec19e9a31562bc611632fbb4b7f1ca09aca0d2da77e57cb510b0" "eef1aa0f203162ff23ca375cae72922bddff2451d979d9370e79b4357000529d" default))))
 (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.
  )
-

+ 1 - 1
.i3/mpdFunctions.sh

@@ -15,7 +15,7 @@ display_song() {
 		;;
 	esac
 #	time = $(mpc status | sed 1d | head -n1 | awk '{ print $3 }')
-	echo '[{"name": "mpd", "instance": "now playing", "full_text": "'${status}' '$1'", "color": "'${color}'"}]'
+	echo '[{"name": "mpd", "instance": "now playing", "full_text": "'${status}' '$1'", "color": "'${color}'"}] '
 }
 
 (while :; do