From 41677e914bbb3795829c8cb9adb30262575568f4 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 16 Jun 2018 17:54:23 +0200 Subject: Basic Emacs setup. --- init.el | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 init.el diff --git a/init.el b/init.el new file mode 100644 index 0000000..0a75770 --- /dev/null +++ b/init.el @@ -0,0 +1,58 @@ +;; Add MELPA package repo +(require 'package) +;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired +;;(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) +(add-to-list 'package-archives (cons "melpa-stable" "https://stable.melpa.org/packages/") t) + +;; Added by Package.el. This must come before configurations of +;; installed packages. Don't delete this line. If you don't want it, +;; just comment it out by adding a semicolon to the start of the line. +;; You may delete these explanatory comments. +(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. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(custom-enabled-themes (quote (wombat))) + '(custom-safe-themes + (quote + ("6383f86cac149fb10fc5a2bac6e0f7985d9af413c4be356cab4bfea3c08f3b42" default))) + '(display-line-numbers t) + '(global-display-line-numbers-mode t) + '(menu-bar-mode nil) + '(package-selected-packages + (quote + (adoc-mode magit rust-mode ergoemacs-mode flatui-dark-theme))) + '(tool-bar-mode nil) + '(truncate-lines t)) + +(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. + '(minibuffer-prompt ((t (:background "white" :foreground "color-16" :weight bold))))) + +;; Some nice functions +(defun smart-line-beginning () + "Move point to the beginning of text on the current line; if that is already +the current position of point, then move it to the beginning of the line." + (interactive) + (let ((pt (point))) + (beginning-of-line-text) + (when (eq pt (point)) + (beginning-of-line)))) + +;; Rebind keys for a bit friendlier experience +(global-set-key (kbd "C-s") 'save-buffer) +(global-set-key (kbd "C-f") 'isearch-forward) +(global-set-key [home] 'smart-line-beginning) +(global-set-key (kbd "C-") 'forward-to-word) +(global-set-key (kbd "C-h") 'backward-kill-word) +(global-set-key (kbd "C-z") 'undo) +(global-set-key (kbd "C-w") 'kill-this-buffer) +(global-set-key (kbd "C-c s") 'magit-status) + +(add-hook 'before-save-hook 'whitespace-cleanup) -- cgit v1.2.3