2017-05-15 01:35:31 +02:00
|
|
|
(require 'package)
|
2017-10-15 13:49:23 +02:00
|
|
|
(package-initialize)
|
2017-10-14 00:31:57 +02:00
|
|
|
(require 'cl)
|
2017-05-15 01:35:31 +02:00
|
|
|
|
2017-10-17 12:00:00 +02:00
|
|
|
(setq gc-cons-threshold (* 16 1024 1024))
|
|
|
|
(setq gc-cons-percentage 0.3)
|
|
|
|
|
2017-10-16 10:07:55 +02:00
|
|
|
;; Change all prompts to y or n
|
|
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
2017-10-18 19:06:46 +02:00
|
|
|
;; my prompt
|
|
|
|
(defun my/yes-or-whatever-p (prompt)
|
|
|
|
(string= "yes"
|
|
|
|
(downcase
|
|
|
|
(read-from-minibuffer
|
2017-11-05 22:16:41 +01:00
|
|
|
(concat prompt "(type yes) ")))))
|
|
|
|
|
2017-10-18 19:06:46 +02:00
|
|
|
;; Ask if you want to quit emacs
|
|
|
|
(setq confirm-kill-emacs 'my/yes-or-whatever-p)
|
|
|
|
|
2017-05-27 01:10:53 +02:00
|
|
|
;; Nope function
|
|
|
|
(defun nope ()
|
|
|
|
(interactive)
|
|
|
|
(message "Nope!"))
|
2017-10-14 12:16:36 +02:00
|
|
|
(defun silence ()
|
|
|
|
(interactive))
|
2017-05-27 01:10:53 +02:00
|
|
|
|
2017-10-14 00:31:57 +02:00
|
|
|
;; Helper function
|
|
|
|
(defun string-ends-with-p (string suffix)
|
|
|
|
"Return t if STRING ends with SUFFIX."
|
|
|
|
(and (string-match (rx-to-string `(: ,suffix eos) t)
|
|
|
|
string)
|
|
|
|
t))
|
|
|
|
|
2017-05-18 00:49:00 +02:00
|
|
|
;; Quote
|
2017-10-10 19:00:30 +02:00
|
|
|
(setq initial-scratch-message
|
|
|
|
(concat ";; Simplicity and elegance are unpopular because\n"
|
|
|
|
";; they require hard work and discipline to achieve\n"
|
|
|
|
";; and education to be appreciated.\n"
|
|
|
|
";;\n"
|
|
|
|
";; - Dijkstra\n\n"))
|
2017-05-18 00:49:00 +02:00
|
|
|
|
2017-05-20 01:42:12 +02:00
|
|
|
;; Set frame title
|
2017-10-15 15:17:03 +02:00
|
|
|
(setq frame-title-format "%b (%m)")
|
2017-05-20 01:42:12 +02:00
|
|
|
|
2017-11-05 22:17:03 +01:00
|
|
|
;; Rebind C-x 2 and 3
|
|
|
|
(global-set-key (kbd "C-x 2")
|
|
|
|
(lambda ()
|
|
|
|
(interactive)
|
|
|
|
(select-window (split-window-vertically))))
|
|
|
|
(global-set-key (kbd "C-x 3")
|
|
|
|
(lambda ()
|
|
|
|
(interactive)
|
|
|
|
(select-window (split-window-horizontally))))
|
2017-09-25 11:44:50 +02:00
|
|
|
|
2017-05-18 01:48:46 +02:00
|
|
|
;; Default frame size
|
|
|
|
(setq initial-frame-alist
|
2017-10-05 09:31:11 +02:00
|
|
|
'(
|
|
|
|
(width . 110)
|
|
|
|
(height . 40)
|
|
|
|
))
|
2017-05-18 01:48:46 +02:00
|
|
|
|
2017-09-23 12:56:54 +02:00
|
|
|
;; Use cperl-mode instead of perl-mode
|
|
|
|
(defalias 'perl-mode 'cperl-mode)
|
|
|
|
|
2017-10-12 20:18:44 +02:00
|
|
|
;; Disable use of abbrev in cperl-mode (what the heck...)
|
|
|
|
(add-hook 'cperl-mode-hook
|
|
|
|
(lambda () (setq-local local-abbrev-table nil)))
|
|
|
|
|
2017-10-14 12:33:47 +02:00
|
|
|
;; Treat - as part of work in elisp
|
|
|
|
(add-hook 'emacs-lisp-mode-hook
|
|
|
|
(lambda () (modify-syntax-entry ?- "w")))
|
2017-06-15 12:04:19 +02:00
|
|
|
|
2017-10-13 22:50:50 +02:00
|
|
|
;; Enable backup
|
2017-10-13 18:04:40 +02:00
|
|
|
(setq make-backup-files t)
|
2017-10-18 22:57:42 +02:00
|
|
|
(setq version-control t
|
|
|
|
backup-by-copying t
|
|
|
|
backup-directory-alist '(("." . "~/.saves"))
|
|
|
|
delete-old-versions t
|
|
|
|
kept-new-versions 6
|
|
|
|
kept-old-versions 2)
|
2017-10-13 18:04:40 +02:00
|
|
|
|
2017-10-15 08:45:11 +02:00
|
|
|
(setq-default grep-command
|
|
|
|
(concat
|
|
|
|
"grep "
|
|
|
|
"-rnH "
|
|
|
|
"--binary-files=without-match "
|
|
|
|
"--exclude-dir=.git "))
|
|
|
|
|
2017-10-13 22:50:50 +02:00
|
|
|
;; Scroll behaviour
|
2017-10-18 22:57:42 +02:00
|
|
|
(setq scroll-step 1
|
|
|
|
scroll-margin 5
|
|
|
|
scroll-conservatively 9999)
|
2017-10-13 22:50:50 +02:00
|
|
|
|
|
|
|
;; Auto-fill in text
|
|
|
|
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
|
|
|
(setq-default fill-column 80)
|
2017-06-15 12:04:19 +02:00
|
|
|
|
2017-10-18 22:54:09 +02:00
|
|
|
;; Allow "/" for search in package-menu
|
|
|
|
(define-key package-menu-mode-map (kbd "/") 'swiper)
|
|
|
|
|
2017-05-15 01:35:31 +02:00
|
|
|
(push '("melpa" . "http://melpa.milkbox.net/packages/") package-archives)
|
|
|
|
|
|
|
|
(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.
|
|
|
|
'(ansi-color-faces-vector
|
|
|
|
[default default default italic underline success warning error])
|
2017-05-16 19:24:48 +02:00
|
|
|
'(ansi-color-names-vector
|
|
|
|
["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
|
2017-05-15 01:35:31 +02:00
|
|
|
'(blink-cursor-mode nil)
|
2017-09-26 17:57:55 +02:00
|
|
|
'(cperl-close-paren-offset -2)
|
|
|
|
'(cperl-electric-parens nil)
|
2017-10-06 11:24:09 +02:00
|
|
|
'(cperl-electric-parens-mark nil)
|
2017-09-26 17:57:55 +02:00
|
|
|
'(cperl-indent-level 2)
|
|
|
|
'(cperl-indent-parens-as-block t)
|
2017-10-06 11:24:09 +02:00
|
|
|
'(cperl-under-as-char t)
|
2017-05-16 19:24:48 +02:00
|
|
|
'(custom-enabled-themes (quote (heroku)))
|
|
|
|
'(custom-safe-themes
|
|
|
|
(quote
|
2017-10-14 13:06:14 +02:00
|
|
|
("4f2ede02b3324c2f788f4e0bad77f7ebc1874eff7971d2a2c9b9724a50fb3f65" default)))
|
2017-10-03 20:36:55 +02:00
|
|
|
'(dired-listing-switches "-lh")
|
2017-05-15 01:35:31 +02:00
|
|
|
'(inhibit-startup-screen t)
|
|
|
|
'(package-selected-packages
|
|
|
|
(quote
|
2017-10-14 13:06:14 +02:00
|
|
|
(evil-indent-plus company delight evil-org org-bullets counsel powerline-evil powerline origami projectile terminal-here swiper neotree ivy heroku-theme use-package yasnippet evil-surround org evil-magit magit makefile-runner evil))))
|
2017-05-15 01:35:31 +02:00
|
|
|
(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.
|
2017-10-11 23:33:07 +02:00
|
|
|
'(company-preview ((t (:foreground "black"))))
|
|
|
|
'(company-preview-common ((t (:inherit company-preview))))
|
|
|
|
'(company-preview-search ((t (:inherit company-preview))))
|
|
|
|
'(company-scrollbar-bg ((t (:background "dim gray"))))
|
|
|
|
'(company-scrollbar-fg ((t (:background "gray"))))
|
|
|
|
'(company-template-field ((t (:foreground "dark orange"))))
|
|
|
|
'(company-tooltip ((t (:background "dim gray" :foreground "black"))))
|
|
|
|
'(company-tooltip-annotation ((t (:foreground "gray19"))))
|
|
|
|
'(company-tooltip-common ((t (:inherit company-preview))))
|
|
|
|
'(company-tooltip-selection ((t (:background "dark gray"))))
|
2017-10-08 16:10:53 +02:00
|
|
|
'(ivy-current-match ((t (:foreground "gold"))))
|
|
|
|
'(minibuffer-prompt ((t (:foreground "dark orange" :weight bold))))
|
2017-05-20 18:03:06 +02:00
|
|
|
'(neo-dir-link-face ((t (:foreground "#fce94f"))))
|
|
|
|
'(neo-expand-btn-face ((t (:foreground "#ffe070"))))
|
2017-05-22 11:22:46 +02:00
|
|
|
'(neo-root-dir-face ((t (:foreground "#fff3c6" :weight bold))))
|
2017-10-08 20:52:44 +02:00
|
|
|
'(org-ellipsis ((t (:foreground "LightGoldenrod"))))
|
2017-05-22 11:22:46 +02:00
|
|
|
'(powerline-active1 ((t (:inherit mode-line))))
|
|
|
|
'(powerline-active2 ((t (:inherit mode-line))))
|
|
|
|
'(powerline-evil-emacs-face ((t (:inherit powerline-evil-base-face :background "gray30" :foreground "white"))))
|
|
|
|
'(powerline-evil-insert-face ((t (:inherit powerline-evil-base-face :background "forest green"))))
|
|
|
|
'(powerline-evil-motion-face ((t (:inherit powerline-evil-base-face :background "white" :foreground "black"))))
|
|
|
|
'(powerline-evil-normal-face ((t (:inherit powerline-evil-base-face :background "white" :foreground "grey22"))))
|
|
|
|
'(powerline-evil-replace-face ((t (:inherit powerline-evil-base-face :background "dark red")))))
|
2017-05-15 01:35:31 +02:00
|
|
|
|
2017-10-12 20:19:26 +02:00
|
|
|
;; Disable unnecessary UI
|
2017-10-12 20:55:58 +02:00
|
|
|
(when window-system
|
|
|
|
(scroll-bar-mode -1)
|
2017-10-13 08:37:47 +02:00
|
|
|
(tool-bar-mode -1))
|
|
|
|
(menu-bar-mode -1)
|
2017-10-12 20:19:26 +02:00
|
|
|
|
2017-11-02 14:56:47 +01:00
|
|
|
;; Lua options
|
|
|
|
(setq-default lua-indent-level 2)
|
|
|
|
|
2017-10-17 12:45:13 +02:00
|
|
|
;; Buffer cleanup
|
|
|
|
(defun buffer-cleanup-whitespace ()
|
|
|
|
"Remove trailing whitespaces upon save"
|
|
|
|
(let ((whitespace-style '(empty trailing)))
|
|
|
|
(whitespace-cleanup)))
|
|
|
|
(add-hook 'before-save-hook 'buffer-cleanup-whitespace)
|
2017-11-05 22:17:20 +01:00
|
|
|
(add-hook 'prog-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(setq show-trailing-whitespace t)))
|
2017-10-17 12:45:13 +02:00
|
|
|
|
2017-05-15 14:25:35 +02:00
|
|
|
;; ensure repo cache is up1date
|
|
|
|
(or (file-exists-p package-user-dir)
|
|
|
|
(package-refresh-contents))
|
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
;; Install use-package
|
|
|
|
(defun ensure-package-installed (package)
|
|
|
|
"Ensure packages are installed"
|
|
|
|
(if (package-installed-p package)
|
2017-10-05 09:31:11 +02:00
|
|
|
nil
|
|
|
|
(progn
|
|
|
|
(package-refresh-contents)
|
|
|
|
(package-install package))))
|
2017-05-17 20:43:49 +02:00
|
|
|
|
|
|
|
(ensure-package-installed 'use-package)
|
|
|
|
|
2017-05-19 20:42:54 +02:00
|
|
|
;; *.tex files are Latex-Files
|
2017-05-20 02:07:33 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode))
|
2017-05-19 20:42:54 +02:00
|
|
|
|
2017-05-20 20:39:29 +02:00
|
|
|
;; Extra Latex keybindings
|
|
|
|
(defun my/latex-keybindings ()
|
|
|
|
(define-key latex-mode-map (kbd "<f9>") 'recompile))
|
|
|
|
(add-hook 'latex-mode-hook 'my/latex-keybindings)
|
|
|
|
|
2017-05-19 23:55:58 +02:00
|
|
|
;; show parens
|
|
|
|
(show-paren-mode t)
|
|
|
|
|
2017-05-20 02:07:33 +02:00
|
|
|
;; highlight line
|
|
|
|
(global-hl-line-mode)
|
|
|
|
|
2017-11-05 22:18:40 +01:00
|
|
|
;; Calendar week starts on Monday
|
|
|
|
(setq calendar-week-start-day 1)
|
|
|
|
|
2017-10-12 20:19:26 +02:00
|
|
|
;; No tabs - tabs are evil
|
2017-10-18 16:11:30 +02:00
|
|
|
(setq-default indent-tabs-mode nil)
|
2017-05-22 17:49:28 +02:00
|
|
|
|
2017-10-11 12:54:14 +02:00
|
|
|
(use-package delight
|
|
|
|
:ensure t
|
|
|
|
:demand t)
|
|
|
|
|
2017-10-09 18:21:40 +02:00
|
|
|
(use-package let-alist
|
|
|
|
:ensure t
|
|
|
|
:demand t)
|
|
|
|
|
2017-05-22 11:22:46 +02:00
|
|
|
;; powerline
|
|
|
|
(use-package powerline
|
|
|
|
:ensure t
|
|
|
|
:demand t)
|
|
|
|
|
|
|
|
(use-package powerline-evil
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
|
|
|
:config
|
|
|
|
(powerline-evil-vim-color-theme))
|
|
|
|
|
2017-05-18 00:49:00 +02:00
|
|
|
;; theme
|
|
|
|
(use-package heroku-theme
|
|
|
|
:ensure t)
|
|
|
|
|
2017-10-14 00:31:57 +02:00
|
|
|
;; Open .org files in org directory
|
|
|
|
(defun my/counsel-org-agenda ()
|
|
|
|
"Open .org files in org directory"
|
|
|
|
(interactive)
|
|
|
|
(find-file (concat (file-name-as-directory org-directory)
|
|
|
|
(ivy-read "Org files: "
|
|
|
|
(remove-if-not
|
|
|
|
(lambda (e) (string-ends-with-p e ".org"))
|
|
|
|
(directory-files org-directory))))))
|
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
;; Org-mode
|
|
|
|
(use-package org
|
2017-10-06 17:04:17 +02:00
|
|
|
:ensure t
|
2017-10-08 16:10:53 +02:00
|
|
|
:config
|
2017-10-15 15:10:32 +02:00
|
|
|
(setq org-directory "~/org/")
|
|
|
|
(setq org-agenda-files (concat org-directory "agenda"))
|
|
|
|
(setq org-default-notes-file (concat org-directory "notes.org"))
|
|
|
|
(global-set-key (kbd "C-c c") 'org-capture)
|
|
|
|
(setq org-capture-templates
|
|
|
|
'( ("t" "Todo" entry (file+headline org-default-notes-file "Todos")
|
|
|
|
"* TODO %U %?\n ")
|
|
|
|
("f" "Fix me" entry (file+headline "~/org/fixmes.org" "Fixmes")
|
|
|
|
"* TODO %?\n %a\n %i") ))
|
2017-10-14 00:31:57 +02:00
|
|
|
(global-set-key (kbd "<f12>") 'my/counsel-org-agenda)
|
2017-10-15 17:16:35 +02:00
|
|
|
(setq org-todo-keywords '((sequence "TODO" "WORK" "BLOC" "REVI" "|" "ABAN" "DONE")))
|
2017-10-08 16:10:53 +02:00
|
|
|
(setq org-todo-keyword-faces
|
|
|
|
'(("TODO" . "firebrick2")
|
2017-10-15 17:16:35 +02:00
|
|
|
("WORK" . "yellow")
|
|
|
|
("BLOC" . "orange red")
|
|
|
|
("REVI" . "dodger blue")
|
|
|
|
("ABAN" . "slate blue")
|
2017-10-08 20:52:44 +02:00
|
|
|
("DONE" . "green3")))
|
|
|
|
(setq org-ellipsis " ▼")
|
|
|
|
(dolist (face '(org-level-1
|
|
|
|
org-level-2
|
|
|
|
org-level-3
|
|
|
|
org-level-4
|
|
|
|
org-level-5))
|
|
|
|
(set-face-attribute face nil :weight 'semi-bold :height 1.0))
|
2017-10-10 22:19:47 +02:00
|
|
|
(dolist (kv '(("t" . "TODO")
|
2017-10-15 17:16:35 +02:00
|
|
|
("w" . "WORK")
|
|
|
|
("b" . "BLOC")
|
|
|
|
("r" . "REVI")
|
|
|
|
("a" . "ABAN")
|
2017-10-10 22:19:47 +02:00
|
|
|
("d" . "DONE")))
|
|
|
|
(define-key org-mode-map (kbd (concat "C-c t " (car kv))) `(lambda () (interactive) (org-todo ,(cdr kv)))))
|
2017-10-08 20:52:44 +02:00
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(linum-mode 0)
|
2017-10-09 18:21:40 +02:00
|
|
|
(setq-local line-spacing 0.2)
|
|
|
|
(setq-local fill-column 80)
|
|
|
|
(auto-fill-mode 1))))
|
2017-10-08 20:52:44 +02:00
|
|
|
|
|
|
|
;; Org Bullets
|
|
|
|
(use-package org-bullets
|
|
|
|
:ensure t
|
2017-10-16 10:19:53 +02:00
|
|
|
:after org
|
2017-10-08 20:52:44 +02:00
|
|
|
:config
|
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
(lambda () (org-bullets-mode 1))))
|
2017-05-17 20:43:49 +02:00
|
|
|
|
|
|
|
;; Evil-mode
|
2017-10-05 21:58:27 +02:00
|
|
|
(defun my/evil-go-back ()
|
|
|
|
(interactive)
|
|
|
|
(evil--jump-backward 1))
|
|
|
|
|
|
|
|
(defun my/evil-go-forward ()
|
|
|
|
(interactive)
|
|
|
|
(evil--jump-forward 1))
|
|
|
|
|
2017-10-06 11:24:09 +02:00
|
|
|
(defun my/kill-current-buffer ()
|
|
|
|
(interactive)
|
|
|
|
(kill-buffer (current-buffer)))
|
|
|
|
|
2017-10-14 01:18:46 +02:00
|
|
|
(defun my/kill-window-or-buffer ()
|
2017-10-13 22:50:50 +02:00
|
|
|
"Closes current window if not last"
|
|
|
|
(interactive)
|
|
|
|
(if (one-window-p (selected-window))
|
2017-10-14 01:18:46 +02:00
|
|
|
(kill-buffer (current-buffer)) ;; If last window, just kill buffer
|
|
|
|
(delete-window (selected-window)))) ;; else delete window
|
2017-10-13 22:50:50 +02:00
|
|
|
|
2017-10-14 12:40:09 +02:00
|
|
|
(defun my/swiper-thing-at-point (thing)
|
|
|
|
(interactive)
|
|
|
|
(swiper (format "\\<%s\\>"
|
|
|
|
(thing-at-point thing))))
|
|
|
|
|
2017-11-02 14:57:11 +01:00
|
|
|
(defun my/evil-yank-till-eol ()
|
|
|
|
(interactive)
|
|
|
|
(evil-yank-characters (point) (point-at-eol)))
|
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
(use-package evil
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
2017-05-18 20:07:04 +02:00
|
|
|
:config
|
|
|
|
(evil-mode 1)
|
2017-05-21 20:51:52 +02:00
|
|
|
(setq evil-ex-substitute-global t)
|
2017-05-22 17:49:28 +02:00
|
|
|
(define-key evil-normal-state-map "/" 'swiper)
|
2017-10-14 01:18:46 +02:00
|
|
|
(evil-ex-define-cmd "q" 'my/kill-window-or-buffer)
|
2017-10-13 22:50:50 +02:00
|
|
|
(evil-ex-define-cmd "wq" (lambda ()
|
|
|
|
(interactive)
|
|
|
|
(save-buffer)
|
2017-10-14 01:18:46 +02:00
|
|
|
(my/kill-window-or-buffer)))
|
2017-10-05 21:58:27 +02:00
|
|
|
(define-key evil-normal-state-map "gb" 'my/evil-go-back)
|
|
|
|
(define-key evil-normal-state-map "gn" 'my/evil-go-forward)
|
2017-11-02 14:57:11 +01:00
|
|
|
(define-key evil-normal-state-map "Y" 'my/evil-yank-till-eol)
|
2017-06-15 14:33:58 +02:00
|
|
|
(define-key evil-motion-state-map [down-mouse-1] 'silence)
|
|
|
|
(define-key evil-motion-state-map [mouse-1] 'silence)
|
2017-10-14 12:42:45 +02:00
|
|
|
(define-key evil-insert-state-map (kbd "<up>") 'nope)
|
|
|
|
(define-key evil-insert-state-map (kbd "<down>") 'nope)
|
|
|
|
(define-key evil-insert-state-map (kbd "<left>") 'nope)
|
|
|
|
(define-key evil-insert-state-map (kbd "<right>") 'nope)
|
2017-10-14 12:40:09 +02:00
|
|
|
(define-key evil-normal-state-map (kbd "#")
|
|
|
|
(lambda () (interactive) (my/swiper-thing-at-point 'word)))
|
|
|
|
(define-key evil-normal-state-map (kbd "*")
|
|
|
|
(lambda () (interactive) (my/swiper-thing-at-point 'symbol)))
|
2017-06-15 14:33:58 +02:00
|
|
|
(setq-default evil-cross-lines t))
|
2017-05-17 20:43:49 +02:00
|
|
|
|
2017-10-14 12:42:01 +02:00
|
|
|
;; Evil-indent-textobject, but better
|
|
|
|
(use-package evil-indent-plus
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
|
|
|
:config
|
|
|
|
(evil-indent-plus-default-bindings))
|
2017-10-14 13:00:23 +02:00
|
|
|
|
|
|
|
;; Evil-org
|
2017-10-08 16:10:53 +02:00
|
|
|
(use-package evil-org
|
|
|
|
:ensure t
|
2017-10-16 10:19:53 +02:00
|
|
|
:after org
|
2017-10-16 23:41:39 +02:00
|
|
|
:delight
|
2017-10-08 16:10:53 +02:00
|
|
|
:config
|
|
|
|
(add-hook 'org-mode-hook 'evil-org-mode)
|
|
|
|
(add-hook 'evil-org-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(evil-org-set-key-theme '(navigation insert shift todo heading)))))
|
2017-10-06 17:04:17 +02:00
|
|
|
|
2017-10-12 20:19:26 +02:00
|
|
|
(use-package evil-surround
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
|
|
|
:config
|
|
|
|
(global-evil-surround-mode t))
|
|
|
|
|
2017-09-19 10:56:03 +02:00
|
|
|
(use-package projectile
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
2017-10-11 12:54:14 +02:00
|
|
|
:delight '(:eval (concat " Project[" (projectile-project-name) "]"))
|
|
|
|
:config
|
|
|
|
(projectile-global-mode t)
|
|
|
|
(setq projectile-completion-system 'ivy))
|
2017-09-19 10:56:03 +02:00
|
|
|
|
2017-10-11 23:33:07 +02:00
|
|
|
;; Company mode
|
|
|
|
(use-package company
|
2017-05-17 20:43:49 +02:00
|
|
|
:ensure t
|
|
|
|
:demand t
|
2017-10-12 20:55:58 +02:00
|
|
|
:delight
|
2017-10-11 12:54:14 +02:00
|
|
|
:config
|
2017-10-11 23:36:03 +02:00
|
|
|
(global-company-mode)
|
2017-10-12 10:13:03 +02:00
|
|
|
(setq company-global-modes '(not git-commit-mode))
|
|
|
|
(setq company-minimum-prefix-length 2)
|
|
|
|
(setq company-idle-delay 0.5))
|
2017-10-11 23:33:07 +02:00
|
|
|
|
|
|
|
;; Auto-Complete
|
|
|
|
;;(use-package auto-complete
|
|
|
|
;; :ensure t
|
|
|
|
;; :demand t
|
|
|
|
;; :delight
|
|
|
|
;; :disabled
|
|
|
|
;; :config
|
|
|
|
;; (require 'auto-complete-config)
|
2017-10-12 20:19:26 +02:00
|
|
|
;; (setq ac-ignore-case nil)
|
2017-10-11 23:33:07 +02:00
|
|
|
;; (setq ac-sources '(ac-source-filename
|
|
|
|
;; ac-source-functions
|
|
|
|
;; ac-source-yasnippet
|
|
|
|
;; ac-source-variables
|
|
|
|
;; ac-source-symbols
|
|
|
|
;; ac-source-features
|
|
|
|
;; ac-source-words-in-all-buffer
|
|
|
|
;; ac-source-dictionary))
|
|
|
|
;; (global-auto-complete-mode))
|
2017-05-16 19:24:48 +02:00
|
|
|
|
2017-10-04 22:03:01 +02:00
|
|
|
;; folding
|
2017-10-16 10:21:40 +02:00
|
|
|
;; (use-package origami
|
|
|
|
;; :ensure t
|
|
|
|
;; :demand t
|
|
|
|
;; :config (progn
|
|
|
|
;; (setq origami-show-fold-header t)
|
|
|
|
;; (define-key evil-normal-state-map "z" 'origami-toggle-node)
|
|
|
|
;; (global-origami-mode)))
|
2017-10-04 22:03:01 +02:00
|
|
|
|
2017-05-19 00:16:17 +02:00
|
|
|
;; ivy
|
2017-10-05 21:58:27 +02:00
|
|
|
(defun my/save-imenu-jump (item)
|
|
|
|
"WIP: Tells evil-jump to save position before jumping via imenu (or counsel-imenu)"
|
|
|
|
(evil--jumps-push))
|
|
|
|
|
2017-10-18 22:55:06 +02:00
|
|
|
;; Prevents opening directories in dired when pressing TAB
|
|
|
|
(defun my/ivy-dont-tab-dir (orig &rest args)
|
|
|
|
(when (> (length ivy-text) 0)
|
|
|
|
(apply orig args)))
|
|
|
|
|
2017-05-18 00:49:00 +02:00
|
|
|
(use-package ivy
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
2017-10-11 12:54:14 +02:00
|
|
|
:delight
|
2017-10-09 22:06:42 +02:00
|
|
|
:config
|
|
|
|
(ivy-mode 1)
|
|
|
|
(setq ivy-use-virtual-buffers t)
|
|
|
|
(setq ivy-count-format "(%d/%d) ")
|
|
|
|
(advice-add 'imenu :before 'my/save-imenu-jump)
|
2017-10-12 20:19:26 +02:00
|
|
|
(define-key ivy-minibuffer-map (kbd "<C-return>") 'ivy-immediate-done)
|
2017-10-18 22:55:06 +02:00
|
|
|
(set-face-attribute 'ivy-current-match nil :foreground "gold")
|
|
|
|
(advice-add 'ivy--directory-done :around #'my/ivy-dont-tab-dir))
|
2017-05-18 00:49:00 +02:00
|
|
|
|
2017-10-05 08:59:33 +02:00
|
|
|
(use-package counsel
|
|
|
|
:ensure t
|
|
|
|
:demand t
|
2017-10-09 22:06:42 +02:00
|
|
|
:config
|
|
|
|
(global-set-key (kbd "C-c l") 'counsel-locate)
|
|
|
|
(global-set-key (kbd "C-c m") 'counsel-imenu)
|
|
|
|
(global-set-key (kbd "C-c _") 'counsel-git-grep))
|
2017-10-05 08:59:33 +02:00
|
|
|
|
2017-09-19 10:56:03 +02:00
|
|
|
;; Quickly open external terminal
|
|
|
|
(use-package terminal-here
|
|
|
|
:ensure t
|
2017-10-16 10:19:53 +02:00
|
|
|
:bind ("C-x t" . terminal-here-launch))
|
2017-09-19 10:56:03 +02:00
|
|
|
|
2017-05-20 18:03:06 +02:00
|
|
|
;; swiper
|
|
|
|
(use-package swiper
|
|
|
|
:ensure t
|
2017-10-16 10:19:53 +02:00
|
|
|
:demand t
|
2017-05-20 18:03:06 +02:00
|
|
|
:bind ("C-s" . swiper))
|
|
|
|
|
2017-05-19 20:42:54 +02:00
|
|
|
;; Neotree
|
|
|
|
(use-package neotree
|
|
|
|
:ensure t
|
|
|
|
:bind ("C-x n" . neotree-show)
|
|
|
|
:config
|
2017-05-20 01:42:12 +02:00
|
|
|
(setq neo-theme 'ascii)
|
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "+") 'neotree-create-node)
|
2017-05-20 13:55:46 +02:00
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
|
2017-05-20 01:42:12 +02:00
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "d") 'neotree-delete-node)
|
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "c") 'neotree-rename-node)
|
2017-05-19 20:42:54 +02:00
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
|
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
|
2017-05-25 03:45:30 +02:00
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
|
|
|
|
(evil-define-key 'normal neotree-mode-map (kbd "DEL") 'neotree-select-up-node))
|
2017-05-19 20:42:54 +02:00
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
;; Yasnippet
|
|
|
|
(use-package yasnippet
|
2017-05-18 01:48:46 +02:00
|
|
|
:ensure t
|
2017-05-17 20:43:49 +02:00
|
|
|
:demand t
|
2017-10-11 12:54:14 +02:00
|
|
|
:delight yas-minor-mode
|
2017-05-17 20:43:49 +02:00
|
|
|
:config (yas-global-mode 1))
|
2017-05-15 14:25:35 +02:00
|
|
|
|
2017-10-10 22:19:25 +02:00
|
|
|
;; avy - Disabled because it makes emacs laggy :(
|
2017-10-16 10:21:40 +02:00
|
|
|
;;(use-package avy
|
|
|
|
;; :ensure t
|
|
|
|
;; :demand t
|
|
|
|
;; :bind ("C-c f" . avy-goto-line)
|
|
|
|
;; :disabled
|
|
|
|
;; :config
|
|
|
|
;; (setq avy-keys '(?w ?a ?s ?d ?q ?e))
|
|
|
|
;; (dolist (face avy-lead-faces)
|
|
|
|
;; (set-face-attribute face nil :background "gray28" :foreground "light blue" :weight 'bold)))
|
2017-05-18 00:49:00 +02:00
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
;; Magit
|
|
|
|
(use-package magit
|
2017-05-18 00:49:00 +02:00
|
|
|
:ensure t
|
2017-10-10 15:19:56 +02:00
|
|
|
:bind ("C-x g" . magit-status)
|
|
|
|
:config
|
2017-10-17 11:40:14 +02:00
|
|
|
;; Use insert mode in commit window
|
|
|
|
(evil-set-initial-state 'git-commit-mode 'insert)
|
|
|
|
;; Magit fullscreen
|
|
|
|
(defadvice magit-status (around magit-fullscreen activate)
|
|
|
|
(window-configuration-to-register :magit-fullscreen)
|
|
|
|
ad-do-it
|
|
|
|
(delete-other-windows))
|
|
|
|
(defun magit-quit-fullscreen ()
|
|
|
|
(interactive)
|
|
|
|
(kill-buffer)
|
|
|
|
(jump-to-register :magit-fullscreen))
|
|
|
|
(define-key magit-status-mode-map (kbd "q") 'magit-quit-fullscreen))
|
2017-05-15 14:25:35 +02:00
|
|
|
|
2017-10-11 12:54:14 +02:00
|
|
|
;; Undo-Tree
|
|
|
|
(use-package undo-tree
|
2017-10-14 12:56:33 +02:00
|
|
|
:delight
|
|
|
|
:config
|
|
|
|
(global-undo-tree-mode)
|
|
|
|
(add-hook 'global-undo-tree-mode-hook
|
|
|
|
(lambda () (linum-mode -1))))
|
2017-10-11 12:54:14 +02:00
|
|
|
|
2017-10-16 23:41:39 +02:00
|
|
|
;; delight
|
|
|
|
(delight 'abbrev-mode)
|
|
|
|
|
2017-10-14 13:00:23 +02:00
|
|
|
;; tabbing
|
2017-05-17 20:43:49 +02:00
|
|
|
(setq-default tab-width 4)
|
|
|
|
(setq-default LateX-indent-level 4)
|
2017-10-14 12:57:36 +02:00
|
|
|
;; (add-hook 'latex-mode-hook
|
|
|
|
;; (lambda () (setq indent-tabs-mode t)))
|
2017-05-16 08:12:04 +02:00
|
|
|
|
2017-05-18 20:07:04 +02:00
|
|
|
;; Activate line numbers
|
|
|
|
(global-linum-mode t)
|
|
|
|
|
|
|
|
;; compilation buffer
|
|
|
|
; Set buffer scrolling
|
|
|
|
(setq compilation-scroll-output 'first-error)
|
|
|
|
(setq compilation-window-height 10)
|
|
|
|
|
2017-05-24 19:18:06 +02:00
|
|
|
;(defun my/compilation-bury-buffer-without-error (buffer string)
|
|
|
|
; (cond ((string-match "finished" string)
|
2017-10-05 09:31:11 +02:00
|
|
|
; (message "Build maybe successful: closing window.")
|
|
|
|
; (run-with-timer 3 nil
|
|
|
|
; 'delete-window
|
|
|
|
; (get-buffer-window buffer t)))
|
|
|
|
; (t (message "Compilation exited abnormaly: %s" string))))
|
2017-05-24 19:18:06 +02:00
|
|
|
;
|
|
|
|
;(setq compilation-finish-function 'my/compilation-bury-buffer-without-error)
|
2017-10-05 08:59:21 +02:00
|
|
|
|
2017-05-24 19:18:06 +02:00
|
|
|
;(defun my/setup-compilation-window ()
|
|
|
|
; (when (not (get-buffer-window "*compilation*"))
|
|
|
|
; (save-selected-window
|
|
|
|
; (save-excursion
|
|
|
|
; (let* ((w (split-window-vertically))
|
|
|
|
; (h (window-height w)))
|
|
|
|
; (select-window w)
|
|
|
|
; (switch-to-buffer "*compilation*")
|
|
|
|
; (shrink-window (- h compilation-window-height)))))))
|
|
|
|
;(add-hook 'compilation-mode-hook 'my/setup-compilation-window)
|
2017-05-18 20:07:04 +02:00
|
|
|
|
2017-10-14 13:00:23 +02:00
|
|
|
;; Move between windows
|
2017-05-20 18:03:06 +02:00
|
|
|
(global-set-key (kbd "C-x <up>") 'windmove-up)
|
|
|
|
(global-set-key (kbd "C-x <down>") 'windmove-down)
|
|
|
|
(global-set-key (kbd "C-x <left>") 'windmove-left)
|
|
|
|
(global-set-key (kbd "C-x <right>") 'windmove-right)
|
2017-05-20 01:42:12 +02:00
|
|
|
|
2017-09-26 17:57:55 +02:00
|
|
|
; Whitespace mode toggle
|
2017-10-14 12:58:16 +02:00
|
|
|
(global-set-key (kbd "C-x C-l") 'whitespace-mode)
|
|
|
|
(defalias 'wsm 'whitespace-mode)
|
2017-09-26 17:57:55 +02:00
|
|
|
|
2017-05-15 14:25:35 +02:00
|
|
|
(defun cycle-window ()
|
|
|
|
"cycles windows"
|
|
|
|
(interactive)
|
|
|
|
(select-window (next-window)))
|
|
|
|
|
2017-10-14 13:01:05 +02:00
|
|
|
;; (defun check-for-open-buffers ()
|
|
|
|
;; (interactive)
|
|
|
|
;; (or (dolist
|
|
|
|
;; (buffer (buffer-list))
|
|
|
|
;; (cond
|
|
|
|
;; ((string-match "^\\*.*\\*$" (buffer-name buffer))
|
|
|
|
;; nil)
|
|
|
|
;; ((null (buffer-modified-p buffer))
|
|
|
|
;; nil)
|
|
|
|
;; (t
|
|
|
|
;; (yes-or-no-p (format "Buffer %s is open. Exit anyway?" (buffer-name buffer))))))))
|
2017-10-05 08:59:21 +02:00
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
;; Latex german
|
|
|
|
(quail-define-package "latex-german" "UTF-8" "LaGe" t
|
2017-10-05 09:31:11 +02:00
|
|
|
"Transforms umlauts to the better latex notation.
|
2017-05-17 20:43:49 +02:00
|
|
|
ä -> \"a
|
|
|
|
ö -> \"o
|
|
|
|
ü -> \"u
|
|
|
|
Ä -> \"A
|
|
|
|
Ö -> \"O
|
|
|
|
Ü -> \"U
|
|
|
|
ß -> \"s"
|
2017-10-05 09:31:11 +02:00
|
|
|
nil t nil nil nil nil nil nil nil nil t)
|
2017-05-17 20:43:49 +02:00
|
|
|
(quail-define-rules
|
|
|
|
("ä" ["\"a"])
|
|
|
|
("ö" ["\"o"])
|
|
|
|
("ü" ["\"u"])
|
|
|
|
("Ä" ["\"A"])
|
|
|
|
("Ö" ["\"O"])
|
|
|
|
("Ü" ["\"U"])
|
|
|
|
("ß" ["\"s"])
|
|
|
|
)
|
|
|
|
|
|
|
|
(add-hook 'latex-mode-hook (lambda ()
|
2017-10-05 09:31:11 +02:00
|
|
|
(set-input-method "latex-german")
|
|
|
|
(local-set-key "\"" 'self-insert-command)))
|
2017-05-15 18:22:09 +02:00
|
|
|
|
2017-09-29 17:53:40 +02:00
|
|
|
;; Treat _ as part of word in some modes
|
|
|
|
(defun treat-underscore ()
|
|
|
|
(modify-syntax-entry ?_ "w"))
|
2017-10-06 11:24:09 +02:00
|
|
|
(add-hook 'prog-mode-hook 'treat-underscore)
|
2017-09-29 17:53:40 +02:00
|
|
|
|
2017-05-15 18:22:09 +02:00
|
|
|
;; Split windows horizontally preferred
|
|
|
|
(setq split-height-threshold 6)
|
|
|
|
(setq split-width-threshold 20)
|
|
|
|
|
2017-05-17 20:43:49 +02:00
|
|
|
;; Overlay windows (What does it do?)
|
2017-05-15 14:25:35 +02:00
|
|
|
(add-to-list 'display-buffer-alist
|
2017-10-05 09:31:11 +02:00
|
|
|
'("*Apropos*" display-buffer-same-window))
|
2017-05-15 14:25:35 +02:00
|
|
|
(add-to-list 'display-buffer-alist
|
2017-10-05 09:31:11 +02:00
|
|
|
'("*Help*" display-buffer-in-side-window))
|
2017-10-05 21:58:27 +02:00
|
|
|
(add-to-list 'display-buffer-alist
|
|
|
|
'("*evil-jumps*" display-buffer-in-side-window))
|
2017-05-24 19:18:06 +02:00
|
|
|
(add-to-list 'display-buffer-alist
|
2017-10-05 09:31:11 +02:00
|
|
|
'("*compilation*" (display-buffer-reuse-window display-buffer-in-side-window) (side . bottom) (size . 0.2)))
|
2017-10-14 12:58:44 +02:00
|
|
|
(add-to-list 'display-buffer-alist
|
|
|
|
'("*undo-tree*" (display-buffer-reuse-window display-buffer-in-side-window)
|
|
|
|
(side . right) (size . 0.2)))
|
2017-05-17 20:43:49 +02:00
|
|
|
|
2017-05-19 23:55:58 +02:00
|
|
|
|
2017-10-06 08:36:41 +02:00
|
|
|
;; Insert time, german format
|
|
|
|
(defun time-german ()
|
|
|
|
(interactive)
|
|
|
|
(insert (format-time-string "%H:%M")))
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c C-d") 'time-german)
|
2017-05-20 01:42:12 +02:00
|
|
|
|
2017-10-11 12:54:14 +02:00
|
|
|
;; Load local emacs settings
|
|
|
|
(let ((local-config (concat user-emacs-directory "init.local")))
|
|
|
|
(when (file-exists-p (concat local-config ".el"))
|
|
|
|
(load local-config)))
|