commit 3ac62aad33e3ef809cb386c86dedd5261f22e242
parent d3b847215036990cf51afadb2458ea0ed3bcabd7
Author: Ryan <39655546+Ma11ock@users.noreply.github.com>
Date: Tue, 12 Nov 2019 20:22:55 -0800
Create speconf.org
Diffstat:
A | speconf.org | | | 579 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 579 insertions(+), 0 deletions(-)
diff --git a/speconf.org b/speconf.org
@@ -0,0 +1,579 @@
+#+TITLE: Ryan Jeffrey's Emacs config
+#+AUTHOR: Ryan Jeffrey
+#+EMAIL: pwishie@gmail.com
+#+OPTIONS: num:nil
+
+* Emacs
+** init
+#+BEGIN_SRC emacs-lisp
+
+(eval-when-compile
+ (require 'use-package))
+
+(defalias 'yes-or-no-p 'y-or-n-p)
+
+#+END_SRC
+** font and theme
+#+BEGIN_SRC emacs-lisp
+
+ (add-to-list 'default-frame-alist
+ '(font . "Fira Code:antialias=true:size=18:style=Regular"))
+
+ (add-to-list 'load-path "~/.emacs.d/themes/")
+
+ (load-theme 'dracula t)
+
+ (global-set-key (kbd "S-<right>") 'next-buffer)
+ (global-set-key (kbd "S-<left>") 'previous-buffer)
+
+ (set-frame-parameter (selected-frame) 'alpha '(80 . 50))
+ (add-to-list 'default-frame-alist '(alpha . (80 . 50)))
+
+#+END_SRC
+** Ivy-mode
+#+BEGIN_SRC emacs-lisp
+ (ivy-mode 1)
+ (setq ivy-use-virtual-buffers t)
+ (setq enable-recursive-minibuffers t)
+ ;; enable this if you want `swiper' to use it
+ ;; (setq search-default-mode #'char-fold-to-regexp)
+ (global-set-key "\C-s" 'swiper)
+ (global-set-key (kbd "<f6>") 'ivy-resume)
+ (global-set-key (kbd "M-x") 'counsel-M-x)
+ (global-set-key (kbd "<f5> f") 'counsel-describe-function)
+ (global-set-key (kbd "<f5> v") 'counsel-describe-variable)
+ (global-set-key (kbd "<f5> l") 'counsel-find-library)
+ (global-set-key (kbd "<f5> i") 'counsel-info-lookup-symbol)
+ (global-set-key (kbd "<f5> u") 'counsel-unicode-char)
+ (global-set-key (kbd "s-c g") 'counsel-git)
+ (global-set-key (kbd "s-c j") 'counsel-git-grep)
+ (global-set-key (kbd "s-c k") 'counsel-ag)
+ (global-set-key (kbd "s-x l") 'counsel-locate)
+ (global-set-key (kbd "s-S-o") 'counsel-rhythmbox)
+ (define-key minibuffer-local-map (kbd "s-r") 'counsel-minibuffer-history)
+#+END_SRC
+
+** Misc
+#+BEGIN_SRC emacs-lisp
+
+(put 'upcase-region 'disabled nil)
+(electric-pair-mode t)
+(show-paren-mode 1)
+(setq-default indent-tabs-mode nil)
+(setq-default tab-width 4)
+(setq column-number-mode t)
+(display-time-mode 1)
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+(setq ring-bell-function 'ignore)
+(blink-cursor-mode 0)
+(set-language-environment "UTF-8")
+(setq redisplay-dont-pause t)
+#+END_SRC
+
+** Filename-mode associations
+#+BEGIN_SRC emacs-lisp
+
+(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
+(add-to-list 'auto-mode-alist '("\\.fish\\'" . fish-mode))
+(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
+
+#+END_SRC
+** joestar
+#+BEGIN_SRC emacs-lisp
+
+ (use-package joestar
+ :init
+ (progn
+ (defvar undo-tree-map
+ (let ((map (make-sparse-keymap)))
+ ;; remap `undo' and `undo-only' to `undo-tree-undo'
+ (define-key map [remap undo] 'undo-tree-undo)
+ (define-key map [remap undo-only] 'undo-tree-undo)
+ ;; bind standard undo bindings (since these match redo counterparts)
+ (define-key map (kbd "C-/") 'undo-tree-undo)
+ (define-key map "\C-_" 'undo-tree-undo)
+ ;; redo doesn't exist normally, so define our own keybindings
+ (define-key map (kbd "C-?") 'undo-tree-redo)
+ (define-key map (kbd "M-_") 'undo-tree-redo)
+ ;; just in case something has defined `redo'...
+ (define-key map [remap redo] 'undo-tree-redo)
+ ;; we use "C-x u" for the undo-tree visualizer
+ (define-key map (kbd "s-x u") 'undo-tree-visualize)
+ ;; bind register commands
+ (define-key map (kbd "s-x r u") 'undo-tree-save-state-to-register)
+ (define-key map (kbd "s-x r U") 'undo-tree-restore-state-from-register)
+ ;; set keymap
+ (setq undo-tree-map map))))
+ :load-path
+ "~/.emacs.d/joestar/"
+ :config
+ (joestar-mode t))
+(dolist (hook '(prog-mode-hook text-mode-hook help-mode-hook dired-mode-hook
+ conf-mode))
+ (add-hook hook #'joestar-mode))
+
+#+END_SRC
+** org
+#+BEGIN_SRC emacs-lisp
+
+(use-package org-indent-mode
+ :config
+ (org-indent-mode t)
+ :hook org-mode)
+
+#+END_SRC
+* IDE
+** company-mode and flycheck
+#+BEGIN_SRC emacs-lisp
+
+ (use-package flycheck-mode
+ :config
+
+ (flycheck-mode t)
+ (define-key flycheck-mode-map flycheck-keymap-prefix nil)
+ (setq flycheck-keymap-prefix (kbd \"s-s f\"))
+ (define-key flycheck-mode-map flycheck-keymap-prefix
+ flycheck-command-map)
+
+ :hook (prog-mode))
+
+
+; (use-package auto-complete
+; :config (ac-config-default))
+
+
+(require 'company)
+
+(add-hook 'after-init-hook 'global-company-mode)
+
+(add-to-list 'company-backends 'company-c-headers)
+
+
+#+END_SRC
+** all programming languages
+*** comments
+#+BEGIN_SRC emacs-lisp
+
+(require 'rebox2)
+(rebox-register-template
+ 75
+ 999
+ '("?*************?"
+ "?* box123456 *?"
+ "?*************?"))
+
+#+END_SRC
+*** todos
+#+BEGIN_SRC emacs-lisp
+
+ (use-package fic-mode
+ :config
+ (fic-mode t)
+ :hook prog-mode)
+
+#+END_SRC
+** C/C++
+*** style and font-lock
+#+BEGIN_SRC emacs-lisp
+
+(setq c-default-style "bsd"
+ c-basic-offset 4)
+
+(require 'modern-cpp-font-lock)
+(modern-c++-font-lock-global-mode t)
+
+(add-hook 'prog-mode-hook 'yas-minor-mode)
+#+END_SRC
+*** irony
+#+BEGIN_SRC emacs-lisp
+
+(require 'irony)
+
+(add-hook 'c++-mode-hook 'irony-mode)
+(add-hook 'c-mode-hook 'irony-mode)
+(add-hook 'objc-mode-hook 'irony-mode)
+
+(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
+
+(eval-after-load 'flycheck
+ '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
+
+(eval-after-load 'company
+ '(add-to-list 'company-backends 'company-irony))
+
+
+#+END_SRC
+** lisp
+#+BEGIN_SRC emacs-lisp
+
+(use-package slime
+:init
+ (setq inferior-lisp-program "/opt/sbcl/bin/sbcl")
+ (setq slime-contribs '(slime-fancy))
+ (load (expand-file-name "~/quicklisp/slime-helper.el"))
+ ;; Replace "sbcl" with the path to your implementation
+ (setq inferior-lisp-program "sbcl"))
+
+(setq geiser-active-implementations '(guile))
+
+#+END_SRC
+** Misc
+
+#+BEGIN_SRC emacs-lisp
+
+ (require 'neotree) ;;
+ (global-set-key [f8] 'neotree-toggle)
+
+ ;; (custom-set-faces
+ ;; ;; ...
+ ;; '(company-preview ((t (:background "black" :foreground "red"))))
+ ;; '(company-preview-common ((t (:foreground "red"))))
+ ;; '(company-preview-search ((t (:inherit company-preview))))
+ ;; '(company-scrollbar-bg ((t (:background "brightwhite"))))
+ ;; '(company-scrollbar-fg ((t (:background "red"))))
+ ;; '(company-template-field ((t (:background "magenta" :foreground "black"))))
+ ;; '(company-tooltip ((t (:background "brightwhite" :foreground "black"))))
+ ;; '(company-tooltip-annotation ((t (:background "brightwhite" :foreground "black"))))
+ ;; '(company-tooltip-annotation-selection ((t (:background "color-253"))))
+ ;; '(company-tooltip-common ((t (:background "brightwhite" :foreground "red"))))
+ ;; '(company-tooltip-common-selection ((t (:background "color-253" :foreground "red"))))
+ ;; '(company-tooltip-mouse ((t (:foreground "black"))))
+ ;; '(company-tooltip-search ((t (:background "brightwhite" :foreground "black"))))
+ ;; '(company-tooltip-selection ((t (:background "color-253" :foreground
+ ;; "black"))))
+ ;; ;; ...
+ ;; )
+
+
+#+END_SRC
+** scripts
+*** Perl
+#+BEGIN_SRC emacs-lisp
+
+(fset 'perl-mode 'cperl-mode)
+(setq cperl-indent-level 4)
+(setq cperl-extra-newline-before-brace t
+ cperl-brace-offset -2
+ cperl-merge-trailing-else nil)
+
+(add-hook 'perl-mode-hook (lambda ()
+ (set (make-local-variable 'rebox-style-loop) '(75 11))
+ (set (make-local-variable 'rebox-min-fill-column) 79)
+ (rebox-mode 1)))
+
+#+END_SRC
+*** Ruby
+#+BEGIN_SRC emacs-lisp
+
+(add-hook 'ruby-mode-hook 'robe-mode)
+(add-hook 'robe-mode-hook 'ac-robe-setup)
+
+#+END_SRC
+** golang
+#+BEGIN_SRC emacs-lisp
+
+(defun set-exec-path-from-shell-PATH ()
+ (let ((path-from-shell (replace-regexp-in-string
+ "[ \t\n]*$"
+ ""
+ (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
+ (setenv "PATH" path-from-shell)
+ (setq eshell-path-env path-from-shell) ; for eshell users
+ (setq exec-path (split-string path-from-shell path-separator))))
+
+(when window-system (set-exec-path-from-shell-PATH))
+
+(setenv "GOPATH" "/home/ryan/CSProjects/goproj/")
+
+(add-to-list 'exec-path "/home/ryan/CSProjects/goproj/bin/")
+(add-hook 'before-save-hook 'gofmt-before-save)
+
+(defun my-go-mode-hook ()
+ ; Call Gofmt before saving
+ (add-hook 'before-save-hook 'gofmt-before-save)
+ ; Godef jump key binding
+ (local-set-key (kbd "M-.") 'godef-jump)
+ (local-set-key (kbd "M-*") 'pop-tag-mark)
+ )
+ (add-hook 'go-mode-hook 'my-go-mode-hook)
+
+(defun auto-complete-for-go ()
+ (auto-complete-mode 1))
+(add-hook 'go-mode-hook 'auto-complete-for-go)
+
+(with-eval-after-load 'go-mode
+ (require 'go-autocomplete))
+
+(defun my-go-mode-hook ()
+ ; Call Gofmt before saving
+ (add-hook 'before-save-hook 'gofmt-before-save)
+ ; Customize compile command to run go build
+ (if (not (string-match "go" compile-command))
+ (set (make-local-variable 'compile-command)
+ "go build -v && go test -v && go vet"))
+ ; Godef jump key binding
+ (local-set-key (kbd "M-.") 'godef-jump)
+ (local-set-key (kbd "M-*") 'pop-tag-mark)
+)
+(add-hook 'go-mode-hook 'my-go-mode-hook)
+
+(defun my-go-mode-hook ()
+ ; Use goimports instead of go-fmt
+ (setq gofmt-command "goimports")
+ ; Call Gofmt before saving
+ (add-hook 'before-save-hook 'gofmt-before-save)
+ ; Customize compile command to run go build
+ (if (not (string-match "go" compile-command))
+ (set (make-local-variable 'compile-command)
+ "go build -v && go test -v && go vet"))
+ ; Godef jump key binding
+ (local-set-key (kbd "M-.") 'godef-jump)
+ (local-set-key (kbd "M-*") 'pop-tag-mark)
+)
+(add-hook 'go-mode-hook 'my-go-mode-hook)
+
+#+END_SRC
+** rust
+#+BEGIN_SRC emacs-lisp
+
+ (require 'rust-mode)
+ (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
+ (setq company-tooltip-align-annotations t)
+
+ (add-hook 'rust-mode-hook 'cargo-minor-mode)
+
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ ;; (use-package racer-mode ;;
+ ;; :init ;;
+ ;; (setq racer-cmd "~/.cargo/bin/racer") ;;
+ ;; (setq racer-rust-src-path "/home/ryan/CSProjects/rust/src/") ;;
+ ;; ;;
+ ;; :config ;;
+ ;; (racer-mode t) ;;
+ ;; (define-key racer-mode-map (kbd "C-x 5 .") nil) ;;
+ ;; (define-key racer-mode-map (kbd "C-x 4 .") nil) ;;
+ ;; ;;
+ ;; :hook ;;
+ ;; (rust-mode)) ;;
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ (add-hook 'rust-mode-hook #'eldoc-mode)
+ (add-hook 'rust-mode-hook #'company-mode)
+
+ (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
+
+#+END_SRC
+** java
+#+BEGIN_SRC emacs-lisp
+(require 'eclim)
+(require 'eclimd)
+(require 'gradle-mode)
+(require 'company-emacs-eclim)
+(require 'company)
+
+(defun java-mode-init()
+ (auto-complete-mode nil)
+ (gradle-mode 1)
+ (setq c-default-style "bsd")
+ (eclim-mode 1)
+ (company-mode 1)
+ (company-emacs-eclim-setup))
+
+(add-hook 'java-mode-hook 'java-mode-init)
+
+#+END_SRC
+** web
+#+BEGIN_SRC emacs-lisp
+
+(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
+(add-hook 'css-mode-hook 'emmet-mode) ;; enable Emmet's css abbreviation.
+(add-hook 'emmet-mode-hook (lambda () (setq emmet-indentation 4))) ;; indent 2 spaces.
+(setq emmet-self-closing-tag-style "/") ;; default "/"
+
+
+
+#+END_SRC
+* Text-editor
+** spellcheck
+#+BEGIN_SRC emacs-lisp
+
+(setq ispell-program-name "hunspell")
+(setq ispell-local-dictionary "en_US")
+(setq ispell-local-dictionary-alist
+ '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))
+
+ #+END_SRC
+** line numbers
+#+BEGIN_SRC emacs-lisp
+
+(setq linum-relative-backend 'display-line-numbers-mode)
+(require 'linum-relative)
+(linum-relative-on)
+
+#+END_SRC
+** sudo edit
+#+BEGIN_SRC emacs-lisp
+
+(defun er-sudo-edit (&optional arg)
+ "Edit currently visited file as root With a prefix ARG prompt for a file to visit. Will also prompt for a file to visit if current buffer is not visiting a file."
+ (interactive "P")
+ (if (or arg (not buffer-file-name))
+ (find-file (concat "/sudo:root@localhost:"
+ (ido-read-file-name "Find file(as root): ")))
+ (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
+
+#+END_SRC
+** ligatures
+#+BEGIN_SRC emacs-lisp
+
+(defun pretty-greek ()
+ "Prettify greek symbols."
+ (let ((greek '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta" "theta" "iota" "kappa" "lambda" "mu" "nu" "xi" "omicron" "pi" "rho" "sigma_final" "sigma" "tau" "upsilon" "phi" "chi" "psi" "omega")))
+ (loop for word in greek
+ for code = 97 then (+ 1 code)
+ do (let ((greek-char (make-char 'greek-iso8859-7 code)))
+ (font-lock-add-keywords nil
+ `((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[a-zA-Z]")
+ (0 (progn (decompose-region (match-beginning 2) (match-end 2))
+ nil)))))
+ (font-lock-add-keywords nil
+ `((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[^a-zA-Z]")
+ (0 (progn (compose-region (match-beginning 2) (match-end 2)
+ ,greek-char)
+ nil))))))))) (add-hook 'lisp-mode-hook 'pretty-greek)
+(add-hook 'emacs-lisp-mode-hook 'pretty-greek)
+
+(defun my/create-basic-ligatures ()
+ "Create basic ligatures."
+ (prettify-symbols-mode t)
+ ;; boolean and math symbols
+ (push '(">=" . ?≥) prettify-symbols-alist)
+ (push '("<=" . ?≤) prettify-symbols-alist)
+ (push '("!=" . ?≠) prettify-symbols-alist)
+
+ (pretty-greek))
+
+(defun my/create-advanced-ligatures ()
+ "Create more invasive ligatures."
+ (my/create-basic-ligatures)
+ (push '("<-" . ?←) prettify-symbols-alist)
+ (push '("->" . ?→) prettify-symbols-alist))
+
+(setq backup-directory-alist `(("." . "~/.saves")))
+
+
+#+END_SRC
+** misc
+#+BEGIN_SRC emacs-lisp
+
+;; tell emacs not to use the clipboard
+;(setq x-select-enable-clipboard nil)
+
+#+END_SRC
+** latex
+#+BEGIN_SRC emacs-lisp
+
+ (setq auto-revert-interval 0.5)
+ (require 'company-auctex)
+ (company-auctex-init)
+
+ (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
+
+ (setq auctex-latexmk-inherit-TeX-PDF-mode t)
+ (require 'auctex-latexmk)
+ (auctex-latexmk-setup)
+
+#+END_SRC
+** highlighting
+#+BEGIN_SRC emacs-lisp
+
+ ;; (defface font-lock-control-face
+ ;; '((t :foreground "#FF0000"))
+ ;; "Font Lock mode face used for function calls."
+ ;; :group 'font-lock-highlighting-faces)
+
+ ;; ;; (font-lock-add-keywords
+ ;; ;; 'c-mode
+ ;; ;; '(("\\<{}\\>"
+ ;; ;; 1 'font-lock-control-face)))
+
+ ;; (defun ctr-chars-hl ()
+ ;; font-lock-add-keywords nil
+ ;; '(("[-+*/=<>,;:(){}]" (0 font-lock-control-face))))
+
+ ;; (dolist (hook '(python-mode-hook fortran-mode-hook c-mode-common-hook))
+ ;; (add-hook hook #'ctr-chars-hl))
+
+;; rainbow delimeters
+(add-hook 'lisp-mode-hook #'rainbow-delimitets-mode)
+
+
+#+END_SRC
+* emacs-os
+** rss
+#+BEGIN_SRC emacs-lisp
+
+(setq elfeed-db-directory "~/.elrss")
+
+(require 'elfeed)
+(global-set-key (kbd "s-x w") 'elfeed)
+
+;; Load elfeed-org
+(require 'elfeed-org)
+
+;; Initialize elfeed-org
+;; This hooks up elfeed-org to read the configuration when elfeed
+;; is started with =M-x elfeed=
+(elfeed-org)
+
+;; Optionally specify a number of files containing elfeed
+;; configuration. If not set then the location below is used.
+;; Note: The customize interface is also supported.
+(setq rmh-elfeed-org-files (list "~/.emacs.d/elfeed.org"))
+
+#+END_SRC
+** pdf
+#+BEGIN_SRC emacs-lisp
+
+(pdf-tools-install)
+
+#+END_SRC
+* Misc
+** Terminal stuff
+#+BEGIN_SRC emacs-lisp
+
+(add-hook 'term-mode-hook
+ (defun my-term-mode-hook ()
+ (setq bidi-paragraph-direction 'left-to-right)))
+ (setq-default term-suppress-hard-newline t)
+
+#+END_SRC
+*** vterm
+
+#+BEGIN_SRC emacs-lisp
+
+(use-package vterm
+:load-path "/home/ryan/src/emacs-libvterm/"
+:config
+ (let (vterm-install)
+ (require 'vterm)))
+
+#+END_SRC
+** ssh
+#+BEGIN_SRC emacs-lisp
+
+ (require 'ssh)
+ (add-hook 'ssh-mode-hook
+ (lambda ()
+ (setq ssh-directory-tracking-mode t)
+ (shell-dirtrack-mode t)
+ (setq dirtrackp nil)))
+
+#+END_SRC
+** misc
+#+BEGIN_SRC emacs-lisp
+
+(require 'highlight-indentation)
+
+#+END_SRC