|
|
@ -1,14 +1,9 @@
|
|
|
|
* Benchmark
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(use-package benchmark-init
|
|
|
|
|
|
|
|
:ensure t
|
|
|
|
|
|
|
|
:config
|
|
|
|
|
|
|
|
(add-hook 'after-init-hook 'benchmark-init/deactivate))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* macros
|
|
|
|
* macros
|
|
|
|
** definteractive
|
|
|
|
** definteractive
|
|
|
|
Wrappers around functions and lambdas so I don't have to type
|
|
|
|
Wrappers around functions and lambdas so I don't have to type
|
|
|
|
(interactive) all the damn time
|
|
|
|
(interactive) all the damn time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I have ~prettify-symbols-mode~ set ~lambdainteractive~ to Λ (capital lambda) because it's cute.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defmacro definteractive (name &rest body)
|
|
|
|
(defmacro definteractive (name &rest body)
|
|
|
|
`(defun ,name ,(car body)
|
|
|
|
`(defun ,name ,(car body)
|
|
|
@ -19,179 +14,53 @@ Wrappers around functions and lambdas so I don't have to type
|
|
|
|
`(lambda ,(car body) (interactive) ,@(cdr body)))
|
|
|
|
`(lambda ,(car body) (interactive) ,@(cdr body)))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** local-keybind
|
|
|
|
** local-keybind
|
|
|
|
Hide unecessary lambda when calling (local-set-key) for
|
|
|
|
Hide unecessary lambda when calling (local-set-key) for org-mode
|
|
|
|
org-modefunctions
|
|
|
|
functions
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(defmacro local-keybind (key value)
|
|
|
|
(defmacro local-keybind (key value)
|
|
|
|
`(lambda () (local-set-key (kbd ,key) (quote ,value))))
|
|
|
|
`(lambda () (local-set-key (kbd ,key) (quote ,value))))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
* org
|
|
|
|
|
|
|
|
** edit/reload config.org
|
|
|
|
|
|
|
|
Saves config.org if it's open then reloads the file.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/config-reload ()
|
|
|
|
|
|
|
|
(when (get-buffer "config.org")
|
|
|
|
|
|
|
|
(with-current-buffer "config.org" (save-buffer)))
|
|
|
|
|
|
|
|
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c x r") 'manx/config-reload)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c x e") (lambdainteractive ()(find-file "~/.emacs.d/config.org")))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** misc
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-src-window-setup 'current-window)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; I read somewhere that Company breaks things?
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook 'company-mode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Don't indent whole file with org-mode
|
|
|
|
|
|
|
|
(eval-after-load "org-mode" (local-set-key (kbd "s-i") nil))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Snippets
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-structure-template-alist
|
|
|
|
|
|
|
|
(append
|
|
|
|
|
|
|
|
'(("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC")
|
|
|
|
|
|
|
|
("js" "#+BEGIN_SRC javascript\n?\n#+END_SRC"))
|
|
|
|
|
|
|
|
org-structure-template-alist))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** html export
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-html-doctype "html5")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(definteractive manx/save-org-to-html()
|
|
|
|
|
|
|
|
(when (equal major-mode 'org-mode)
|
|
|
|
|
|
|
|
(save-buffer)
|
|
|
|
|
|
|
|
(org-html-export-to-html)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
|
|
|
|
(local-keybind "C-c s h" manx/save-org-to-html))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Links
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/delete-org-link ()
|
|
|
|
|
|
|
|
(if (org-in-regexp org-bracket-link-regexp 1)
|
|
|
|
|
|
|
|
(apply 'delete-region (list (match-beginning 0) (match-end 0)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook (local-keybind "C-c o l" manx/delete-org-link))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** Inline Images
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-image-actual-width 150)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(definteractive manx/org-insert-link ()
|
|
|
|
|
|
|
|
(org-insert-link)
|
|
|
|
|
|
|
|
(org-redisplay-inline-images))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* emacs gui
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
|
|
|
|
(line-number-mode 1)
|
|
|
|
|
|
|
|
(column-number-mode 1)
|
|
|
|
|
|
|
|
(display-battery-mode 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-unset-key (kbd "C-z"))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* functions
|
|
|
|
|
|
|
|
** text
|
|
|
|
|
|
|
|
*** forward whitespace
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(global-set-k'ey (kbd "<M-right>") 'forward-whitespace)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** kill whole word
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/kill-whole-word ()
|
|
|
|
|
|
|
|
(backward-word)
|
|
|
|
|
|
|
|
(kill-word 1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c k w") 'manx/kill-whole-word)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** kill whole line
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/kill-whole-line()
|
|
|
|
|
|
|
|
(move-beginning-of-line nil)
|
|
|
|
|
|
|
|
(kill-whole-line))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c k l") 'manx/kill-whole-line)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** revert buffer
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c r b") 'revert-buffer)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** Format whole file
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/format-whole-buffer()
|
|
|
|
|
|
|
|
(save-excursion
|
|
|
|
|
|
|
|
(indent-region (point-min) (point-max) nil)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "s-i") 'manx/format-whole-buffer)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** colour under cursor
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(defun what-face (pos)
|
|
|
|
|
|
|
|
(interactive "d")
|
|
|
|
|
|
|
|
(let ((face (or (get-char-property (pos) 'read-face-name)
|
|
|
|
|
|
|
|
(get-char-property (pos) 'face))))
|
|
|
|
|
|
|
|
(if face (message "Face: %s" face) (message "No face at %d" pos))))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** buffers
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x k") (lambdainteractive () (kill-buffer (current-buffer))))
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-M-s-k") (lambdainteractive () (mapc 'kill-buffer (buffer-list))))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** frames
|
|
|
|
|
|
|
|
*** transpose-frame
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
;; This is only used here for now but we should still more it some
|
|
|
|
|
|
|
|
;; time
|
|
|
|
|
|
|
|
(add-to-list 'load-path "~/.emacs.d/scripts/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(require 'transpose-frame)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c f t") 'transpose-frame)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c f i") 'flip-frame)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c f o") 'flop-frame)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** split and follow
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(defmacro manx/split-and-follow (direction)
|
|
|
|
|
|
|
|
`(progn
|
|
|
|
|
|
|
|
,direction
|
|
|
|
|
|
|
|
(balance-windows)
|
|
|
|
|
|
|
|
(other-window 1)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below))))
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x 2") (lambdainteractive () (manx/split-and-follow (split-window-horizontally))))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* use-package
|
|
|
|
* use-package
|
|
|
|
|
|
|
|
** use-package config
|
|
|
|
|
|
|
|
Always ensure packages are installed. Log to ~*Messages*~.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq use-package-always-ensure t
|
|
|
|
(setq use-package-always-ensure t
|
|
|
|
use-package-verbose t)
|
|
|
|
use-package-verbose t)
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** diminish
|
|
|
|
** diminish
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package diminish)
|
|
|
|
(use-package diminish)
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** keychain-environment
|
|
|
|
** company
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package keychain-environment
|
|
|
|
(use-package company
|
|
|
|
:bind ("C-c r e" . 'keychain-refresh-environment)
|
|
|
|
:diminish 'company-mode
|
|
|
|
:init (keychain-refresh-environment))
|
|
|
|
:bind (:map company-mode-map
|
|
|
|
|
|
|
|
("C-c /" . 'yas-expand))
|
|
|
|
|
|
|
|
:custom
|
|
|
|
|
|
|
|
(company-idle-delay 0)
|
|
|
|
|
|
|
|
(company-minimum-prefix-length 3)
|
|
|
|
|
|
|
|
:init (add-hook 'after-init-hook 'global-company-mode))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** exwm
|
|
|
|
** prog
|
|
|
|
|
|
|
|
*** c#
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(unless (display-graphic-p)
|
|
|
|
(use-package csharp-mode
|
|
|
|
(use-package exwm
|
|
|
|
:defer t
|
|
|
|
:bind ("s-k" . 'exwm-workspace-delete)
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
(use-package omnisharp
|
|
|
|
(require 'exwm-config)
|
|
|
|
:defer t
|
|
|
|
(require 'exwm-systemtray)
|
|
|
|
:config
|
|
|
|
(exwm-systemtray-enable)))
|
|
|
|
(add-hook 'csharp-mode-hook 'omnisharp-mode)
|
|
|
|
|
|
|
|
(add-to-list 'company-backends 'company-omnisharp)))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** nginx
|
|
|
|
*** elixir
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(use-package elixir-mode
|
|
|
|
|
|
|
|
:defer t
|
|
|
|
|
|
|
|
:config (use-package alchemist))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** nginx
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package nginx-mode
|
|
|
|
(use-package nginx-mode
|
|
|
|
:custom
|
|
|
|
:custom
|
|
|
@ -199,35 +68,37 @@ Saves config.org if it's open then reloads the file.
|
|
|
|
(nginx-indent-level 2)
|
|
|
|
(nginx-indent-level 2)
|
|
|
|
:config (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/" . nginx-mode)))
|
|
|
|
:config (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/" . nginx-mode)))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** company
|
|
|
|
*** slime
|
|
|
|
|
|
|
|
sbcl is in a werid place on Gentoo.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package company
|
|
|
|
(use-package slime
|
|
|
|
:diminish 'company-mode
|
|
|
|
:defer t
|
|
|
|
:bind (:map company-mode-map
|
|
|
|
|
|
|
|
("C-c /" . 'yas-expand))
|
|
|
|
|
|
|
|
:custom
|
|
|
|
:custom
|
|
|
|
(company-idle-delay 0)
|
|
|
|
(slime-lisp-implementations
|
|
|
|
(company-minimum-prefix-length 3)
|
|
|
|
'((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core")
|
|
|
|
:init (add-hook 'after-init-hook 'global-company-mode))
|
|
|
|
:env ("SBCL_HOME=/usr/lib64/sbcl/"))))
|
|
|
|
|
|
|
|
:diminish 'slime-mode
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
|
|
|
(use-package slime-company)
|
|
|
|
|
|
|
|
(add-hook 'lisp-mode-hook 'slime-mode)
|
|
|
|
|
|
|
|
(slime-setup '(slime-fancy slime-company)))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** c#
|
|
|
|
** keychain-environment
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package csharp-mode
|
|
|
|
(use-package keychain-environment
|
|
|
|
:defer t
|
|
|
|
:bind ("C-c r e" . 'keychain-refresh-environment)
|
|
|
|
:config
|
|
|
|
:init (keychain-refresh-environment))
|
|
|
|
(use-package omnisharp
|
|
|
|
#+END_SRC
|
|
|
|
:defer t
|
|
|
|
** htmlize
|
|
|
|
:config
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(add-hook 'csharp-mode-hook 'omnisharp-mode)
|
|
|
|
(use-package htmlize)
|
|
|
|
(add-to-list 'company-backends 'company-omnisharp)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** spaceline
|
|
|
|
** spaceline
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package spaceline
|
|
|
|
(use-package spaceline
|
|
|
|
|
|
|
|
:custom (powerline-default-seperator (quote arrow))
|
|
|
|
:init
|
|
|
|
:init
|
|
|
|
(require 'spaceline-config)
|
|
|
|
(require 'spaceline-config)
|
|
|
|
(setq powerline-default-seperator (quote arrow))
|
|
|
|
|
|
|
|
(spaceline-spacemacs-theme)
|
|
|
|
(spaceline-spacemacs-theme)
|
|
|
|
:config (spaceline-toggle-buffer-size-off))
|
|
|
|
:config (spaceline-toggle-buffer-size-off))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
@ -246,20 +117,6 @@ Saves config.org if it's open then reloads the file.
|
|
|
|
|
|
|
|
|
|
|
|
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
|
|
|
|
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** slime
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(use-package slime
|
|
|
|
|
|
|
|
:defer t
|
|
|
|
|
|
|
|
:custom
|
|
|
|
|
|
|
|
(slime-lisp-implementations
|
|
|
|
|
|
|
|
'((sbcl ("sbcl" "--core" "/usr/lib64/sbcl/sbcl.core")
|
|
|
|
|
|
|
|
:env ("SBCL_HOME=/usr/lib64/sbcl/"))))
|
|
|
|
|
|
|
|
:diminish 'slime-mode
|
|
|
|
|
|
|
|
:init
|
|
|
|
|
|
|
|
(use-package slime-company)
|
|
|
|
|
|
|
|
(add-hook 'lisp-mode-hook 'slime-mode)
|
|
|
|
|
|
|
|
(slime-setup '(slime-fancy slime-company)))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** switch window
|
|
|
|
** switch window
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package switch-window
|
|
|
|
(use-package switch-window
|
|
|
@ -269,37 +126,31 @@ Saves config.org if it's open then reloads the file.
|
|
|
|
(switch-window-threshold 2)
|
|
|
|
(switch-window-threshold 2)
|
|
|
|
:bind ([remap other-window] . switch-window))
|
|
|
|
:bind ([remap other-window] . switch-window))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** elixir
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(use-package elixir-mode
|
|
|
|
|
|
|
|
:defer t
|
|
|
|
|
|
|
|
:config (use-package alchemist))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** yasnippet
|
|
|
|
** yasnippet
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package yasnippet
|
|
|
|
(use-package yasnippet
|
|
|
|
:diminish 'yas-minor-mode
|
|
|
|
:diminish 'yas-minor-mode
|
|
|
|
:hook ((html-mode
|
|
|
|
:hook ((html-mode
|
|
|
|
LaTeX-mode
|
|
|
|
LaTeX-mode
|
|
|
|
emacs-lisp-mode
|
|
|
|
emacs-lisp-mode
|
|
|
|
lisp-mode)
|
|
|
|
lisp-mode)
|
|
|
|
. yas-minor-mode)
|
|
|
|
. yas-minor-mode)
|
|
|
|
:init
|
|
|
|
:init ;; These are computationally expensive, so init.
|
|
|
|
(use-package yasnippet-snippets)
|
|
|
|
(use-package yasnippet-snippets)
|
|
|
|
(yas-reload-all))
|
|
|
|
(yas-reload-all))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** minor modes
|
|
|
|
** minor modes
|
|
|
|
*** hungry delete
|
|
|
|
*** hungry delete
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package hungry-delete
|
|
|
|
(use-package hungry-delete
|
|
|
|
:diminish 'hungry-delete-mode
|
|
|
|
:diminish 'hungry-delete-mode
|
|
|
|
:config (global-hungry-delete-mode 1))
|
|
|
|
:config (global-hungry-delete-mode 1))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
*** which key
|
|
|
|
*** which key
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(use-package which-key
|
|
|
|
(use-package which-key
|
|
|
|
:diminish 'which-key-mode
|
|
|
|
:diminish 'which-key-mode
|
|
|
|
:config (which-key-mode))
|
|
|
|
:config (which-key-mode))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
*** avy
|
|
|
|
*** avy
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
@ -317,20 +168,122 @@ Saves config.org if it's open then reloads the file.
|
|
|
|
(use-package popup-kill-ring
|
|
|
|
(use-package popup-kill-ring
|
|
|
|
:bind ("M-y" . popup-kill-ring))
|
|
|
|
:bind ("M-y" . popup-kill-ring))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
* ido
|
|
|
|
** ido
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq ido-enable-flex-matching t
|
|
|
|
(setq ido-enable-flex-matching t
|
|
|
|
ido-create-new-buffer 'always
|
|
|
|
ido-create-new-buffer 'always
|
|
|
|
ido-everywhere 1)
|
|
|
|
ido-everywhere 1)
|
|
|
|
|
|
|
|
|
|
|
|
(use-package ido-vertical-mode
|
|
|
|
(use-package ido-vertical-mode
|
|
|
|
:bind ("C-l" . 'ido-reread-directory)
|
|
|
|
:bind ("C-l" . 'ido-reread-directory)
|
|
|
|
:custom
|
|
|
|
:custom (ido-vertical-define-keys 'C-n-and-C-p-only)
|
|
|
|
(ido-vertical-define-keys 'C-n-and-C-p-only)
|
|
|
|
|
|
|
|
:config
|
|
|
|
:config
|
|
|
|
(ido-vertical-mode 1)
|
|
|
|
(ido-vertical-mode 1)
|
|
|
|
(ido-mode 1))
|
|
|
|
(ido-mode 1))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* org
|
|
|
|
|
|
|
|
** edit/reload config
|
|
|
|
|
|
|
|
Also saves config if open.
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/config-reload ()
|
|
|
|
|
|
|
|
(when (get-buffer "config.org")
|
|
|
|
|
|
|
|
(with-current-buffer "config.org" (save-buffer)))
|
|
|
|
|
|
|
|
(org-babel-load-file (concat user-emacs-directory "config.org")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c x r") 'manx/config-reload)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c x e") (lambdainteractive () (find-file (concat user-emacs-directory "config.org"))))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** misc
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-src-window-setup 'current-window)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; I read somewhere that Company breaks things?
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook 'company-mode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Don't indent whole file with org-mode
|
|
|
|
|
|
|
|
(eval-after-load "org-mode" (local-set-key (kbd "s-i") nil))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** html export
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-html-doctype "html5")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(definteractive manx/save-org-to-html()
|
|
|
|
|
|
|
|
(when (equal major-mode 'org-mode)
|
|
|
|
|
|
|
|
(save-buffer)
|
|
|
|
|
|
|
|
(org-html-export-to-html)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
|
|
|
|
(local-keybind "C-c s h" manx/save-org-to-html))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Links
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/delete-org-link ()
|
|
|
|
|
|
|
|
(if (org-in-regexp org-bracket-link-regexp 1)
|
|
|
|
|
|
|
|
(apply 'delete-region (list (match-beginning 0) (match-end 0)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook (local-keybind "C-c o l" manx/delete-org-link))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** Inline Images
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(setq org-image-actual-width 150)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(definteractive manx/org-insert-link ()
|
|
|
|
|
|
|
|
(org-insert-link)
|
|
|
|
|
|
|
|
(org-redisplay-inline-images))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* functions
|
|
|
|
|
|
|
|
** text
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(definteractive manx/kill-word ()
|
|
|
|
|
|
|
|
(backward-word)
|
|
|
|
|
|
|
|
(kill-word 1))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(definteractive manx/kill-line()
|
|
|
|
|
|
|
|
(move-beginning-of-line nil)
|
|
|
|
|
|
|
|
(kill-whole-line))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(definteractive manx/format-whole-buffer()
|
|
|
|
|
|
|
|
(save-excursion
|
|
|
|
|
|
|
|
(indent-region (point-min) (point-max) nil)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "<M-right>") 'forward-whitespace)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c r b") 'revert-buffer)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c k w") 'manx/kill-word)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c k l") 'manx/kill-line)
|
|
|
|
|
|
|
|
(global-set-key (kbd "s-i") 'manx/format-whole-buffer)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** buffers
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x k") (lambdainteractive () (kill-buffer (current-buffer))))
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-M-s-k") (lambdainteractive () (mapc 'kill-buffer (buffer-list))))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** frames
|
|
|
|
|
|
|
|
*** transpose-frame
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
;; This is only used here for now but we should still more it some
|
|
|
|
|
|
|
|
;; time
|
|
|
|
|
|
|
|
(add-to-list 'load-path "~/.emacs.d/scripts/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(require 'transpose-frame)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c f t") 'transpose-frame)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c f i") 'flip-frame)
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c f o") 'flop-frame)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** split and follow
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(defmacro manx/split-and-follow (direction)
|
|
|
|
|
|
|
|
`(progn
|
|
|
|
|
|
|
|
,direction
|
|
|
|
|
|
|
|
(balance-windows)
|
|
|
|
|
|
|
|
(other-window 1)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below))))
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-x 2") (lambdainteractive () (manx/split-and-follow (split-window-horizontally))))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
* misc
|
|
|
|
* misc
|
|
|
|
** unix line endings
|
|
|
|
** unix line endings
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
@ -350,41 +303,48 @@ Saves config.org if it's open then reloads the file.
|
|
|
|
(prefer-coding-system 'utf-8)
|
|
|
|
(prefer-coding-system 'utf-8)
|
|
|
|
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
|
|
|
|
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** terminal
|
|
|
|
|
|
|
|
*** Make bash implicit terminal
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(defvar my-term-shell "/bin/bash")
|
|
|
|
|
|
|
|
(defadvice ansi-term (before force-bash)
|
|
|
|
|
|
|
|
(interactive (list my-term-shell)))
|
|
|
|
|
|
|
|
(ad-activate 'ansi-term)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(global-set-key (kbd "<s-return>") 'ansi-term)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** minor things
|
|
|
|
** minor things
|
|
|
|
|
|
|
|
Things for GUI and basic config, like electric pairs and highlighting
|
|
|
|
|
|
|
|
parens.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(line-number-mode 1)
|
|
|
|
|
|
|
|
(column-number-mode 1)
|
|
|
|
|
|
|
|
(display-battery-mode 1)
|
|
|
|
(show-paren-mode 1)
|
|
|
|
(show-paren-mode 1)
|
|
|
|
(electric-pair-mode t)
|
|
|
|
(electric-pair-mode t)
|
|
|
|
(global-hl-line-mode t)
|
|
|
|
(global-hl-line-mode t)
|
|
|
|
(global-prettify-symbols-mode t)
|
|
|
|
|
|
|
|
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
|
|
|
|
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
|
|
|
|
(setq scroll-conservatively 100
|
|
|
|
(setq scroll-conservatively 100
|
|
|
|
x-select-enable-clipboard t
|
|
|
|
select-enable-clipboard t
|
|
|
|
vc-follow-symlinks t)
|
|
|
|
vc-follow-symlinks t)
|
|
|
|
|
|
|
|
|
|
|
|
(setq backup-directory-alist
|
|
|
|
(setq backup-directory-alist
|
|
|
|
`(("." . ,(concat user-emacs-directory "autosaves"))))
|
|
|
|
`(("." . ,(concat user-emacs-directory "autosaves"))))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** docView auto reload
|
|
|
|
(global-unset-key (kbd "C-z")) ;; Fuck unix
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
** indentation
|
|
|
|
** indentation
|
|
|
|
|
|
|
|
tabs > spaces.
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default tab-width 2
|
|
|
|
(setq-default tab-width 2
|
|
|
|
indent-tabs-mode t)
|
|
|
|
indent-tabs-mode t)
|
|
|
|
(defvaralias 'css-indent-offset 'tab-width)
|
|
|
|
(defvaralias 'css-indent-offset 'tab-width)
|
|
|
|
|
|
|
|
(defvaralias 'js-indent-level 'tab-width)
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
** Prettify symbols
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(global-prettify-symbols-mode t)
|
|
|
|
|
|
|
|
(add-hook 'emacs-lisp-mode-hook
|
|
|
|
|
|
|
|
(lambda ()
|
|
|
|
|
|
|
|
(push
|
|
|
|
|
|
|
|
'("lambdainteractive" . ?Λ)
|
|
|
|
|
|
|
|
prettify-symbols-alist)))
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
* auto-minor-mode
|
|
|
|
* auto-minor-mode
|
|
|
|
auto-mode-alist for minor modes.
|
|
|
|
auto-mode-alist for minor modes.
|
|
|
@ -401,52 +361,45 @@ For example, used with sensitive-mode to not create backups
|
|
|
|
the checking happens for all pairs in auto-minor-mode-alist"
|
|
|
|
the checking happens for all pairs in auto-minor-mode-alist"
|
|
|
|
(when buffer-file-name
|
|
|
|
(when buffer-file-name
|
|
|
|
(let ((name (file-name-sans-versions buffer-file-name))
|
|
|
|
(let ((name (file-name-sans-versions buffer-file-name))
|
|
|
|
(remote-id (file-remote-p buffer-file-name))
|
|
|
|
(remote-id (file-remote-p buffer-file-name))
|
|
|
|
(case-fold-search auto-mode-case-fold)
|
|
|
|
(case-fold-search auto-mode-case-fold)
|
|
|
|
(alist auto-minor-mode-alist))
|
|
|
|
(alist auto-minor-mode-alist))
|
|
|
|
;; Remove remote file name identification.
|
|
|
|
;; Remove remote file name identification.
|
|
|
|
(when (and (stringp remote-id)
|
|
|
|
(when (and (stringp remote-id)
|
|
|
|
(string-match-p (regexp-quote remote-id) name))
|
|
|
|
(string-match-p (regexp-quote remote-id) name))
|
|
|
|
(setq name (substring name (match-end 0))))
|
|
|
|
(setq name (substring name (match-end 0))))
|
|
|
|
(while (and alist (caar alist) (cdar alist))
|
|
|
|
(while (and alist (caar alist) (cdar alist))
|
|
|
|
(if (string-match-p (caar alist) name)
|
|
|
|
(if (string-match-p (caar alist) name)
|
|
|
|
(funcall (cdar alist) 1))
|
|
|
|
(funcall (cdar alist) 1))
|
|
|
|
(setq alist (cdr alist))))))
|
|
|
|
(setq alist (cdr alist))))))
|
|
|
|
|
|
|
|
|
|
|
|
(add-hook 'find-file-hook #'enable-minor-mode-based-on-extension)
|
|
|
|
(add-hook 'find-file-hook #'enable-minor-mode-based-on-extension)
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|
* sensitive-minor-mode
|
|
|
|
* sensitive-minor-mode
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(define-minor-mode sensitive-minor-mode
|
|
|
|
(define-minor-mode sensitive-minor-mode
|
|
|
|
"For sensitive files like password lists.
|
|
|
|
"For sensitive files like password lists.
|
|
|
|
It disables backup creation and auto saving.
|
|
|
|
It disables backup creation and auto saving.
|
|
|
|
|
|
|
|
|
|
|
|
With no argument, this command toggles the mode.
|
|
|
|
With no argument, this command toggles the mode.
|
|
|
|
Non-null prefix argument turns on the mode.
|
|
|
|
Non-null prefix argument turns on the mode.
|
|
|
|
Null prefix argument turns off the mode."
|
|
|
|
Null prefix argument turns off the mode."
|
|
|
|
nil ;; Initial
|
|
|
|
:init-value nil
|
|
|
|
"Sensitive" ;; Modeline
|
|
|
|
:lighter " Sensitive"
|
|
|
|
nil ;; Bindings
|
|
|
|
:keymap nil
|
|
|
|
(if (symbol-value sensitive-minor-mode)
|
|
|
|
(if (symbol-value sensitive-minor-mode)
|
|
|
|
(progn
|
|
|
|
(progn
|
|
|
|
(setq make-backup-files nil)
|
|
|
|
(setq make-backup-files nil)
|
|
|
|
(auto-save-mode -1))
|
|
|
|
(auto-save-mode -1))
|
|
|
|
(setq-local make-backup-files t)
|
|
|
|
(setq-local make-backup-files t)
|
|
|
|
(auto-save-mode 1)))
|
|
|
|
(auto-save-mode 1)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Regexps of sensitive files.
|
|
|
|
;; Regexps of sensitive files.
|
|
|
|
(setq auto-minor-mode-alist
|
|
|
|
(setq auto-minor-mode-alist
|
|
|
|
(append
|
|
|
|
(append
|
|
|
|
'(("stream/manifest/.*\\.json$" . sensitive-minor-mode)
|
|
|
|
'(("stream/manifest/.*\\.json$" . sensitive-minor-mode)
|
|
|
|
(".emacs.d/snippets/\\*$" . sensitive-minor-mode)
|
|
|
|
(".emacs.d/snippets/\\*$" . sensitive-minor-mode)
|
|
|
|
("nginx/sites-(enabled|available)/*" . sensitive-minor-mode))
|
|
|
|
("nginx/sites-(enabled|available)/*" . sensitive-minor-mode))
|
|
|
|
auto-minor-mode-alist))
|
|
|
|
auto-minor-mode-alist))
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Prettify symbols
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
|
|
|
|
(add-hook 'emacs-lisp-mode-hook
|
|
|
|
|
|
|
|
(lambda ()
|
|
|
|
|
|
|
|
(push
|
|
|
|
|
|
|
|
'("lambdainteractive" . ?Λ) prettify-symbols-alist)))
|
|
|
|
|
|
|
|
#+END_SRC
|
|
|
|
#+END_SRC
|
|
|
|