dotfiles

My opinionated dotfiles
git clone git://git.erethon.com/dotfiles
Log | Files | Refs

commit 6717fcf08c74240b0d7ae4b61af3483667355e7a
parent d74db2ddcf76ea44ea7a1e26a5bfa77c485e5997
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Sun, 12 Mar 2017 16:11:05 +0200

emacs: Use org-mode to configure emacs

* Initialize ~/.emacs.d/init.el
* Initialize ~/.emacs.d/configuration.org as an org-mode file
* Remove ~/.emacs

Diffstat:
.emacs | 73-------------------------------------------------------------------------
.emacs.d/configuration.org | 124+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.emacs.d/init.el | 1+
3 files changed, 125 insertions(+), 73 deletions(-)

diff --git a/.emacs b/.emacs @@ -1,73 +0,0 @@ -(menu-bar-mode -1) - -(setq scroll-step 1 - scroll-conservatively 10000) - -(require 'package) -(package-initialize) - -(require 'evil) -(evil-mode 1) -(define-key evil-normal-state-map (kbd "RET") 'org-return) -(define-key evil-normal-state-map (kbd "C-l") 'evil-window-next) -(define-key evil-normal-state-map (kbd "C-j") 'evil-window-down) -(define-key evil-normal-state-map (kbd "C-k") 'evil-window-up) -(define-key evil-normal-state-map (kbd "SPC") 'scroll-up-command) -(define-key evil-normal-state-map (kbd "0") 'back-to-indentation) - -(setq org-return-follows-link t) -(require 'org) -(setq org-log-done t) - -;; Org-Journal settings -(setq org-journal-dir "~/Documents/org/journal") -(load-file "~/.emacs.d/org-journal.el") - -;; Adds a vim-like <leader> key -(add-to-list 'load-path "~/.emacs.d/plugins/evil-leader") -(require 'evil-leader) - -;; Org-mode bindings -(define-key evil-normal-state-map "t" 'org-todo) -(define-key evil-normal-state-map (kbd "TAB") 'org-cycle) -(load-file "~/.emacs.d/vim-agenda.el") - -;; Org-mode settings -(setq org-agenda-files (list "~/Documents/org/index.org" - "~/Documents/org/personal.org" - "~/Documents/org/work.org")) - -;;(setq org-agenda-window-setup (quote current-window)) - -(evil-leader/set-key-for-mode 'org-mode - "n" 'org-next-link - "N" 'org-previous-link - "a" 'org-agenda - "t" 'org-show-todo-tree - "A" 'org-archive-subtree-default) - -(global-evil-leader-mode) -(evil-leader/set-leader ";") - -;; Prompt for y/no instead of yes/no -(fset 'yes-or-no-p 'y-or-n-p) - -;; Enable org-babel for sh and python -(org-babel-do-load-languages - 'org-babel-load-languages - '((sh . t) - (python . t) - (dot . t) - )) - -;; General settings -(add-hook 'before-save-hook 'delete-trailing-whitespace) - -;; Use /tmp for temp and backup files -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) -(setq auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) - -;; (add-to-list 'custom-theme-load-path "~/Code/emacs/monokai-emacs") -;; (load-theme 'monokai t) diff --git a/.emacs.d/configuration.org b/.emacs.d/configuration.org @@ -0,0 +1,124 @@ +* Appearance +** Hide the menu bar on top + +#+BEGIN_SRC emacs-lisp + (menu-bar-mode -1) +#+END_SRC + +** Set theme directory and use monokai + +#+BEGIN_SRC emacs-lisp + (add-to-list 'custom-theme-load-path "~/Code/emacs/monokai-emacs") + (load-theme 'monokai t) +#+END_SRC + +** Use pretty icon for org-ellipsis +#+BEGIN_SRC emacs-lisp + (setq org-ellipsis " ↷") +#+END_SRC + +* Packages +** Initialize packages +#+BEGIN_SRC emacs-lisp + (require 'package) + (package-initialize) + (add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) +#+END_SRC + +* evil mode +** Use evil mode +#+BEGIN_SRC emacs-lisp + (require 'evil) + (evil-mode 1) +#+END_SRC + +** Keybinds +#+BEGIN_SRC emacs-lisp + (define-key evil-normal-state-map (kbd "RET") 'org-return) + (define-key evil-normal-state-map (kbd "C-l") 'evil-window-next) + (define-key evil-normal-state-map (kbd "C-k") 'evil-window-up) + (define-key evil-normal-state-map (kbd "SPC") 'scroll-up-command) + (define-key evil-normal-state-map (kbd "0") 'back-to-indentation) +#+END_SRC + +* org-mode +** List of files to parse for org-agenda +#+BEGIN_SRC emacs-lisp + (setq org-agenda-files (list "~/Documents/org/index.org" + "~/Documents/org/personal.org" + "~/Documents/org/work.org")) +#+END_SRC + +** Follow links with return +#+BEGIN_SRC emacs-lisp + (setq org-return-follows-link t) +#+END_SRC + +** Keybinds +*** Cycle task states with 't' +#+BEGIN_SRC emacs-lisp +(define-key evil-normal-state-map "t" 'org-todo) + +#+END_SRC + +*** Use TAB to expand/collapse sections +#+BEGIN_SRC emacs-lisp + (define-key evil-normal-state-map (kbd "TAB") 'org-cycle) +#+END_SRC + +* org-journal +** Set journal directory +#+BEGIN_SRC emacs-lisp + (setq org-journal-dir "~/Documents/org/journal") +#+END_SRC + +** Load org-journal +#+BEGIN_SRC emacs-lisp + (require 'org-journal) +#+END_SRC + +* Settings +** General settings +*** Set tab to two spaces +#+BEGIN_SRC emacs-lisp + (setq-default tab-width 2) +#+END_SRC + +*** Remove trailing whitespace on save +#+BEGIN_SRC emacs-lisp + (add-hook 'before-save-hook 'delete-trailing-whitespace) +#+END_SRC + +*** Backup file location +#+BEGIN_SRC emacs-lisp + (setq backup-directory-alist + `((".*" . ,"~/tmp/emacs"))) + (setq auto-save-file-name-transforms + `((".*" ,"~/tmp/emacs" t))) +#+END_SRC + +*** Recent files +#+BEGIN_SRC emacs-lisp +(recentf-mode 1) +(setq recentf-max-menu-items 25) +(global-set-key "\C-x\C-r" 'recentf-open-files) +#+END_SRC + +*** Prompt for y/n instead of yes/no +#+BEGIN_SRC emcas-lisp + (fset 'yes-or-no-p 'y-or-n-p) +#+END_SRC + +*** [[https://www.emacswiki.org/emacs/SmoothScrolling][Scroll one line at a time when at the end of the screen]] +#+BEGIN_SRC emacs-lisp + (setq scroll-step 1 + scroll-conservatively 10000) +#+END_SRC + +** Language specific +*** Python +**** Tab width +#+BEGIN_SRC emacs-lisp + (setq python-indent 2) +#+END_SRC diff --git a/.emacs.d/init.el b/.emacs.d/init.el @@ -0,0 +1 @@ +(org-babel-load-file "~/.emacs.d/configuration.org")