352 lines
9.7 KiB
Text
352 lines
9.7 KiB
Text
(package-initialize)
|
|
(require 'package)
|
|
|
|
;; Quote
|
|
(setq initial-scratch-message ";; 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")
|
|
|
|
;; Set frame title
|
|
(setq frame-title-format "[%m] %f")
|
|
|
|
;; Default frame size
|
|
(setq initial-frame-alist
|
|
'(
|
|
(width . 110)
|
|
(height . 40)
|
|
))
|
|
|
|
(defun silence ()
|
|
(interactive))
|
|
|
|
|
|
(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])
|
|
'(ansi-color-names-vector
|
|
["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
|
|
'(blink-cursor-mode nil)
|
|
'(custom-enabled-themes (quote (heroku)))
|
|
'(custom-safe-themes
|
|
(quote
|
|
("4f2ede02b3324c2f788f4e0bad77f7ebc1874eff7971d2a2c9b9724a50fb3f65" default)))
|
|
'(global-evil-surround-mode t)
|
|
'(inhibit-startup-screen t)
|
|
'(menu-bar-mode nil)
|
|
'(package-selected-packages
|
|
(quote
|
|
(shell-pop swiper neotree centered-cursor-mode ivy avy heroku-theme auto-complete use-package yasnippet evil-surround org evil-magit magit makefile-runner evil)))
|
|
'(scroll-bar-mode nil)
|
|
'(shell-pop-shell-type
|
|
(quote
|
|
("ansi-term" "*ansi-term*"
|
|
(lambda nil
|
|
(ansi-term shell-pop-term-shell)))))
|
|
'(shell-pop-window-position "top")
|
|
'(shell-pop-window-size 20)
|
|
'(tool-bar-mode nil))
|
|
(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.
|
|
'(neo-dir-link-face ((t (:foreground "#fce94f"))))
|
|
'(neo-expand-btn-face ((t (:foreground "#ffe070"))))
|
|
'(neo-root-dir-face ((t (:foreground "#fff3c6" :weight bold))))
|
|
'(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")))))
|
|
|
|
;; ensure repo cache is up1date
|
|
(or (file-exists-p package-user-dir)
|
|
(package-refresh-contents))
|
|
|
|
;; Install use-package
|
|
(defun ensure-package-installed (package)
|
|
"Ensure packages are installed"
|
|
(if (package-installed-p package)
|
|
nil
|
|
(progn
|
|
(package-refresh-contents)
|
|
(package-install package))))
|
|
|
|
(ensure-package-installed 'use-package)
|
|
|
|
;; *.tex files are Latex-Files
|
|
(add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode))
|
|
|
|
;; Extra Latex keybindings
|
|
(defun my/latex-keybindings ()
|
|
(define-key latex-mode-map (kbd "<f9>") 'recompile))
|
|
(add-hook 'latex-mode-hook 'my/latex-keybindings)
|
|
|
|
;; show parens
|
|
(show-paren-mode t)
|
|
|
|
;; highlight line
|
|
(global-hl-line-mode)
|
|
|
|
;; shackle
|
|
;(defun my/shackle-rules ()
|
|
; (setq shackle-rules
|
|
; '((term-mode :select t :align 'below :size 0.2))))
|
|
;
|
|
;(use-package shackle
|
|
; :ensure t
|
|
; :demand t
|
|
; :config '(my/shackle-rules))
|
|
|
|
;; powerline
|
|
(use-package powerline
|
|
:ensure t
|
|
:demand t)
|
|
|
|
(use-package powerline-evil
|
|
:ensure t
|
|
:demand t
|
|
:config
|
|
(powerline-evil-vim-color-theme))
|
|
|
|
;; theme
|
|
(use-package heroku-theme
|
|
:ensure t)
|
|
|
|
;; Org-mode
|
|
(use-package org
|
|
:ensure t)
|
|
|
|
;; Evil-mode
|
|
(use-package evil
|
|
:ensure t
|
|
:demand t
|
|
:config
|
|
(evil-mode 1)
|
|
(setq evil-ex-substitute-global t)
|
|
(define-key evil-normal-state-map "/" 'swiper)
|
|
(define-key evil-motion-state-map [down-mouse-1] 'silence)
|
|
(define-key evil-motion-state-map [mouse-1] 'silence)
|
|
(setq-default evil-cross-lines t))
|
|
|
|
;; Auto-Complete
|
|
(use-package auto-complete
|
|
:ensure t
|
|
:demand t
|
|
:config (progn
|
|
(require 'auto-complete-config)
|
|
(ac-config-default)))
|
|
|
|
;; ivy
|
|
(use-package ivy
|
|
:ensure t
|
|
:demand t
|
|
:config (progn
|
|
(ivy-mode 1)
|
|
(setq ivy-use-virtual-buffers t)
|
|
(setq ivy-count-format "(%d/%d) ")
|
|
(define-key ivy-minibuffer-map (kbd "<C-return>") 'ivy-immediate-done)))
|
|
|
|
;; swiper
|
|
(use-package swiper
|
|
:ensure t
|
|
:bind ("C-s" . swiper))
|
|
|
|
;; Neotree
|
|
(use-package neotree
|
|
:ensure t
|
|
:bind ("C-x n" . neotree-show)
|
|
:config
|
|
(setq neo-theme 'ascii)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "+") 'neotree-create-node)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "d") 'neotree-delete-node)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "c") 'neotree-rename-node)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
|
|
(evil-define-key 'normal neotree-mode-map (kbd "DEL") 'neotree-select-up-node))
|
|
|
|
;; Cursor centered
|
|
(use-package centered-cursor-mode
|
|
:ensure t
|
|
:demand t
|
|
:disabled
|
|
:config (global-centered-cursor-mode))
|
|
|
|
;; Yasnippet
|
|
(use-package yasnippet
|
|
:ensure t
|
|
:demand t
|
|
:config (yas-global-mode 1))
|
|
|
|
;; avy
|
|
(use-package avy
|
|
:ensure t
|
|
:demand t
|
|
:disabled
|
|
:bind ("C-s" . avy-goto-word-0)
|
|
:config (progn
|
|
(setq avy-keys '(?a ?s ?d ?f ?g ?q ?w ?e ?r ?t ?y ?x ?c ?v ?z ?u ?i ?o ?p ?h ?j ?k ?l ?b ?n ?m))))
|
|
|
|
;; Magit
|
|
(use-package magit
|
|
:ensure t
|
|
:bind ("C-x g" . magit-status))
|
|
|
|
;; Easy terminal
|
|
(setq my/default-shell (or (executable-find "zsh") (executable-find "bash")))
|
|
|
|
(use-package shell-pop
|
|
:ensure t
|
|
:bind ("C-x t" . shell-pop)
|
|
:config
|
|
(setq-default shell-pop-term-shell my/default-shell))
|
|
|
|
;; tabbing (doesn't really work yet)
|
|
(setq-default indent-tabs-mode t)
|
|
(setq-default tab-width 4)
|
|
(setq-default LateX-indent-level 4)
|
|
|
|
;; Activate line numbers
|
|
(global-linum-mode t)
|
|
|
|
;; compilation buffer
|
|
; Set buffer scrolling
|
|
(setq compilation-scroll-output 'first-error)
|
|
(setq compilation-window-height 10)
|
|
|
|
;(defun my/compilation-bury-buffer-without-error (buffer string)
|
|
; (cond ((string-match "finished" string)
|
|
; (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))))
|
|
;
|
|
;(setq compilation-finish-function 'my/compilation-bury-buffer-without-error)
|
|
|
|
;(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)
|
|
|
|
;; Window movement
|
|
; Old keys
|
|
(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)
|
|
|
|
; New keys
|
|
(global-set-key (kbd "<M-up>") 'windmove-up)
|
|
(global-set-key (kbd "<M-down>") 'windmove-down)
|
|
(global-set-key (kbd "<M-left>") 'windmove-left)
|
|
(global-set-key (kbd "<M-right>") 'windmove-right)
|
|
|
|
(defun cycle-window ()
|
|
"cycles windows"
|
|
(interactive)
|
|
(select-window (next-window)))
|
|
|
|
(global-set-key (kbd "<C-tab>") 'cycle-window)
|
|
|
|
;; Exit prompt
|
|
(defun foreach (alist func)
|
|
(while alist
|
|
(progn
|
|
(funcall func (car alist))
|
|
(setq alist (cdr alist)))))
|
|
|
|
;(defun emacs-exit-prompt ()
|
|
; (foreach
|
|
; (buffer-list)
|
|
; (lambda (buffer)
|
|
; (cond
|
|
; ((string-match "^\\*.*\\*$" (buffer-name buffer)) nil)
|
|
; ((null (buffer-modified-p buffer)) nil)
|
|
; (t nil)))))
|
|
|
|
;; Latex german
|
|
(quail-define-package "latex-german" "UTF-8" "LaGe" t
|
|
"Transforms umlauts to the better latex notation.
|
|
ä -> \"a
|
|
ö -> \"o
|
|
ü -> \"u
|
|
Ä -> \"A
|
|
Ö -> \"O
|
|
Ü -> \"U
|
|
ß -> \"s"
|
|
nil t nil nil nil nil nil nil nil nil t)
|
|
(quail-define-rules
|
|
("ä" ["\"a"])
|
|
("ö" ["\"o"])
|
|
("ü" ["\"u"])
|
|
("Ä" ["\"A"])
|
|
("Ö" ["\"O"])
|
|
("Ü" ["\"U"])
|
|
("ß" ["\"s"])
|
|
)
|
|
|
|
(add-hook 'latex-mode-hook (lambda ()
|
|
(set-input-method "latex-german")
|
|
(local-set-key "\"" 'self-insert-command)))
|
|
|
|
;; Split windows horizontally preferred
|
|
(setq split-height-threshold 6)
|
|
(setq split-width-threshold 20)
|
|
|
|
;; Overlay windows (What does it do?)
|
|
(add-to-list 'display-buffer-alist
|
|
'("*Apropos*" display-buffer-same-window))
|
|
(add-to-list 'display-buffer-alist
|
|
'("*Help*" display-buffer-in-side-window))
|
|
(add-to-list 'display-buffer-alist
|
|
'("*compilation*" (display-buffer-reuse-window display-buffer-in-side-window) (side . bottom) (size . 0.2)))
|
|
|
|
;; Change all prompts to y or n
|
|
(fset 'yes-or-no-p 'y-or-n-p)
|
|
|
|
;; Insert time, german format
|
|
(defun datetime-german ()
|
|
(interactive)
|
|
(insert (format-time-string "%d.%m.%Y %H:%M")))
|
|
|
|
(global-set-key (kbd "C-c C-d") 'datetime-german)
|
|
|
|
;; Comment fun
|
|
|
|
;(defun extend-comment ()
|
|
; (interactive)
|
|
; (if (looking-back "//" (line-beginning-position))
|
|
; (progn
|
|
; (newline-and-indent)
|
|
; (insert "Hallo Welt"))
|
|
; (newline-and-indent)))
|
|
|
|
;; Show in binary and decimal
|
|
|
|
;(defun hex-popup ()
|
|
; (interactive)
|
|
; (let (hexStr p1 p2)
|
|
; (save-excursion
|
|
; (search-backward-regexp "[^0-9A-Fa-f]" nil t)
|
|
; (forward-char)
|
|
; (setq p1 (point))
|
|
; (search-forward-regexp "[^0-9A-Fa-f]" nil t)
|
|
; (backward-char)
|
|
; (setq p2 (point)))
|
|
; (setq hexStr (buffer-substring-no-properties p1 p2))
|
|
; (message "The hex number is: '%s' '%d' '%d'" hexStr p1 p2)))
|