From da0a28682fd52fadc587ab214ba443585229b5bf Mon Sep 17 00:00:00 2001 From: Julian T Date: Wed, 28 Aug 2019 18:44:08 +0200 Subject: Restartet emacs, changed vim color theme --- emacs/.emacs | 204 +++++++++++++++++++++-------------------------------------- 1 file changed, 72 insertions(+), 132 deletions(-) (limited to 'emacs/.emacs') diff --git a/emacs/.emacs b/emacs/.emacs index 3e61926..77e8843 100644 --- a/emacs/.emacs +++ b/emacs/.emacs @@ -1,116 +1,76 @@ - (require 'package) -(setq package-enable-at-startup nil) -(add-to-list 'load-path "~/.emacs.d/load") -(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) -(add-to-list 'package-archives - '("melpa" . "http://melpa.milkbox.net/packages/") t) -(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) +(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") -(package-initialize ) +(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/"))) -(eval-when-compile - (require 'use-package)) +(package-initialize) -(use-package auto-package-update - :ensure t - :config - (setq auto-package-update-delete-old-versions t)) +(defvar my-packages '( auto-complete + evil + evil-surround + org + org-evil + go-mode + dired-narrow + ace-window + magit + yaml-mode)) -;; -;; Evil mode -;; -(defun save-and-quit () - "Save the document and exit buffer" - (interactive) - (save-buffer (current-buffer)) - (kill-this-buffer)) +(setq evil-want-C-u-scroll t) - ; TODO find out what this is -(setq evil-want-integration nil) -(setq evil-want-keybinding nil) - -(use-package evil - :ensure t - :init - (setq evil-want-C-u-scroll t) - :config - (evil-ex-define-cmd "b[utterfly]" 'bufferfly) - (evil-ex-define-cmd "q[uit]" 'kill-this-buffer) - (evil-ex-define-cmd "wq" 'save-and-quit) - (evil-ex-define-cmd "describe-function" 'describe-function) - (evil-mode 1)) - -(use-package evil-collection - :config - (evil-collection-init)) - -(use-package org-evil - :ensure t - ) - -(use-package evil-surround - :ensure t - :config - (global-evil-surround-mode 1)) - -(use-package nlinum-relative - :ensure - :config - ;; something else you want - (nlinum-relative-setup-evil) - (add-hook 'prog-mode-hook 'nlinum-relative-mode)) - -(use-package evil-magit - :ensure t) - -;; -;; General config -;; -(use-package calfw - :ensure t) -(use-package calfw-ical - :ensure t) -(use-package calfw-org - :ensure t) - -(defun open-calendar () - (interactive) - (cfw:open-calendar-buffer :contents-sources - (list - (cfw:org-create-source "Green") - ) - ) - ) +(dolist (p my-packages) + (unless (package-installed-p p) + (package-refresh-contents) + (package-install p)) + (add-to-list 'package-selected-packages p)) + + +;; Use up to 20mb before running garbage collector +(setq gc-cons-threshold 20000000) -(setq backup-directory-alist `(("." . "~/.saves"))) +;; Use tmp as backup dir +(setq backup-directory-alist + `((".*" . ,temporary-file-directory))) +(setq auto-save-file-name-transforms + `((".*" ,temporary-file-directory t))) -(setq initial-buffer-choice nil) -(setq org-support-shift-select t) +(setq vc-follow-symlinks t) +(setq confirm-kill-emacs 'y-or-n-p) -(setq c-default-style "k&r" - c-basic-offset 4) +;; Use a to goto dired directory +(put 'dired-find-alternate-file 'disabled nil) +;; Direc fuzzy searching, use g to go back to file listing +(require 'dired) +(define-key dired-mode-map (kbd "/") 'dired-narrow-fuzzy) +(fset 'yes-or-no-p 'y-or-n-p) +(global-auto-revert-mode t) +(display-time-mode t) +(tool-bar-mode 0) -(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode)) +(ac-config-default) +(setq save-place-file "~/.emacs.d/saveplace") +(setq-default save-place t) +(require 'saveplace) -(add-hook 'python-mode-hook 'jedi:setup) -(setq jedi:complete-on-dot t) ; optional +(when (fboundp 'windmove-default-keybindings) + (windmove-default-keybindings)) +(evil-mode t) +(global-set-key (kbd "M-x") 'execute-extended-command) + +(require 'evil-surround) +(global-evil-surround-mode 1) (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. - '(company-c-headers-path-user - (quote - ("." "~/Documents/aausat6/software/lib/libcsp/include" "~/Documents/aausat6/software/stm32f/libopencm3/include" "~/Documents/aausat6/software/lib/libfreertosv10/Source/include"))) '(custom-enabled-themes (quote (tango-dark))) - '(package-selected-packages - (quote - (company-ycmd ycmd company-c-headers evil-magit magit company auto-complete-config auto-complete evil-collection evil use-package)))) + '(package-selected-packages (quote (yaml-mode magit evil-surround evil auto-complete)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. @@ -118,53 +78,33 @@ ;; If there is more than one, they won't work right. ) -(defun show-file-name () - "Show the current filename" - (interactive) - (message (buffer-file-name)) ) - -(defun goto-startup-screen () - "Show the startup screen" +(defun save-and-quit () + "Save the document and exit buffer" (interactive) - (display-startup-screen) ) - -(setq org-directory "~/Syncthing/OrgNotes") -(setq org-default-notes-file (concat org-directory "/notes.org")) - -(use-package magit - :ensure t ) + (save-buffer (current-buffer)) + (kill-this-buffer)) +(evil-ex-define-cmd "q[uit]" 'kill-this-buffer) +(evil-ex-define-cmd "wq" 'save-and-quit) +(evil-ex-define-cmd "describe-function" 'describe-function) -;; -;; Auto-complete (AC) -;; -(use-package auto-complete - :ensure t - :config - (ac-config-default) -) -(require 'auto-complete-config) +(defun my-jump-advice (oldfun &rest args) + (let ((old-pos (point))) + (apply oldfun args) + (when (> (abs (- (line-number-at-pos old-pos) (line-number-at-pos (point)))) + 1) + (evil-set-jump old-pos)))) -(use-package company-c-headers - :ensure t - ) -(use-package company - :ensure t) +(advice-add 'evil-next-line :around #'my-jump-advice) +(advice-add 'evil-previous-line :around #'my-jump-advice) -(add-hook 'global-init-hook 'global-company-mode) -(add-to-list 'company-backends 'company-c-headers) +(global-set-key (kbd "M-w") 'ace-window) -;; -;; Keybindings -;; +(evil-add-command-properties #'evil-scroll-down :jump t) +(evil-add-command-properties #'evil-scroll-up :jump t) -;; Leader Keybinding -(defvar leader-map (make-sparse-keymap) - "Keymap for evil leader key") -(define-key evil-normal-state-map (kbd "SPC") leader-map) +;; Go mode -(define-key leader-map "b" 'switch-to-buffer) -(define-key leader-map "t" 'term) -(define-key leader-map "o" 'org-capture) +(add-hook 'before-save-hook 'gofmt-before-save) -- cgit v1.2.3