From 388643d07f7678c2c3e3ae9520473d98438d56ed Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Mon, 15 May 2017 14:25:35 +0200 Subject: [PATCH 1/2] Automatic package installation :) --- emacs/.emacs | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs b/emacs/.emacs index d606d1e..02a8ce6 100644 --- a/emacs/.emacs +++ b/emacs/.emacs @@ -1,11 +1,21 @@ (package-initialize) +(defun ensure-packages-installed (packages) + "Ensure packages are installed" + (mapcar + (lambda (package) + (if (package-installed-p package) + nil + (if (y-or-n-p (format "Package %s is missing. Install it? " package)) + (package-install package) + package))) + packages)) + (require 'package) (push '("marmalade" . "http://marmalade-repo.org/packages/") package-archives) (push '("melpa" . "http://melpa.milkbox.net/packages/") package-archives) -(package-initialize) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -30,5 +40,31 @@ ;; If there is more than one, they won't work right. '(default ((t (:inherit nil :stipple nil :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "PfEd" :family "Inconsolata"))))) +;; ensure repo cache is up1date +(or (file-exists-p package-user-dir) + (package-refresh-contents)) + +(ensure-packages-installed '(org evil evil-surround magit evil-magit)) + (require 'evil) (evil-mode t) + +;; Window movement +(global-set-key (kbd "C-x ") 'windmove-up) +(global-set-key (kbd "C-x ") 'windmove-down) +(global-set-key (kbd "C-x ") 'windmove-left) +(global-set-key (kbd "C-x ") 'windmove-right) + +;; Window cycling +(defun cycle-window () + "cycles windows" + (interactive) + (select-window (next-window))) + +(global-set-key (kbd "") 'cycle-window) + +;; Overlay windows +(add-to-list 'display-buffer-alist + '("*Apropos*" display-buffer-same-window)) +(add-to-list 'display-buffer-alist + '("*Help*" display-buffer-same-window)) From 1fec2949eebab412230312adc725f5e0d98e77e8 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Mon, 15 May 2017 18:22:09 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Mehr=20emacs=20spa=C3=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- emacs/.emacs | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs b/emacs/.emacs index 02a8ce6..8364ef1 100644 --- a/emacs/.emacs +++ b/emacs/.emacs @@ -44,17 +44,26 @@ (or (file-exists-p package-user-dir) (package-refresh-contents)) -(ensure-packages-installed '(org evil evil-surround magit evil-magit)) +(ensure-packages-installed '(org evil evil-surround magit evil-magit auto-complete)) +;; Evil mode <3 (require 'evil) (evil-mode t) +;; auto-complete +(require 'auto-complete) +(require 'auto-complete-config) +(ac-config-default) + ;; Window movement (global-set-key (kbd "C-x ") 'windmove-up) (global-set-key (kbd "C-x ") 'windmove-down) (global-set-key (kbd "C-x ") 'windmove-left) (global-set-key (kbd "C-x ") 'windmove-right) +;; Magit +(global-set-key (kbd "C-x g") 'magit-status) + ;; Window cycling (defun cycle-window () "cycles windows" @@ -63,6 +72,37 @@ (global-set-key (kbd "") 'cycle-window) +;; Easy terminal +(defun term-split () + "creates terminal window below" + (interactive) + (select-window (split-window-below -7)) + (term "/bin/zsh")) + +(global-set-key (kbd "C-x t") 'term-split) + +;; Kill term buffer on exit +;; (defun term-handle-exit--close-buffer (&rest args) +;; (when (null (get-buffer-process (current-buffer))) +;; (kill-buffer (current-buffer)))) +;; +;; (advice-add 'term-handle-exit :after #'term-handle-exit--close-buffer) + +;; Latex german +;; (defun latex-german-umlauts () +;; "Sets keys like ä to write \"a" +;; (message "Latex German Umlauts loaded.") +;; (defun local-map (key ins) +;; (local-set-key (kbd key) (lambda () (interactive) `(insert v)))) +;; (local-map "ä" "\"a")) +;; ;;(local-set-key (kbd "ä") (lambda () (interactive) (insert "\"a"))) +;; +;; (add-hook 'latex-mode-hook 'latex-german-umlauts) + +;; Split windows horizontally preferred +(setq split-height-threshold 6) +(setq split-width-threshold 20) + ;; Overlay windows (add-to-list 'display-buffer-alist '("*Apropos*" display-buffer-same-window))