From 70ee1e9219fd62ac0ef0fa2b188155e08646996c Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 3 Jun 2020 20:00:56 +0200 Subject: Taking another run at using Orgmode for note taking --- config.nix | 1 + gui/conf/init.el | 160 +++++++++++++++++++++++++++++++++++++++++++++++------ gui/conf/xmonad.hs | 2 +- gui/default.nix | 2 + gui/emacs.nix | 18 +++--- 5 files changed, 157 insertions(+), 26 deletions(-) diff --git a/config.nix b/config.nix index 1dd1750..94a00ed 100644 --- a/config.nix +++ b/config.nix @@ -1,3 +1,4 @@ { + allowUnsupportedSystem = true; allowUnfree = true; } diff --git a/gui/conf/init.el b/gui/conf/init.el index 27d5f8f..8b4757e 100644 --- a/gui/conf/init.el +++ b/gui/conf/init.el @@ -1,37 +1,161 @@ (setq inhibit-startup-message t) (setq initial-scratch-message nil) -(setq backup-directory-alist `(("." . "~/.emacs.d/backup"))) +(setq backup-directory-alist `((".*" . "~/.emacs.d/backup"))) -(require 'package) -(package-initialize) -(eval-when-compile (require 'use-package)) +(setq user-full-name "Adrian Kummerlaender" + user-mail-address "adrian@kummerlaender.eu") -(load-theme 'leuven) (set-frame-font "Iosevka 11" nil t) (menu-bar-mode -1) (toggle-scroll-bar -1) (tool-bar-mode -1) (global-visual-line-mode t) -(use-package org) +(require 'package) +(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) +(package-initialize) + +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +(eval-when-compile (require 'use-package)) + +(use-package evil + :ensure t + :init + (setq evil-search-module 'evil-search) + :config + (evil-mode 1)) + +(use-package evil-leader + :ensure t + :config + (global-evil-leader-mode 1) + (evil-leader/set-leader ",")) + +(use-package poet-theme + :ensure t + :config + (load-theme 'poet-dark t)) + +(use-package darkroom + :ensure t + :config + (setq darkroom-text-scale-increase 0)) + +(use-package pdf-tools + :defer t + :mode "\\.pdf$" + :config (pdf-tools-install)) + +(use-package mixed-pitch + :ensure t + :hook + (text-mode . mixed-pitch-mode)) + +(custom-theme-set-faces + 'user + '(variable-pitch ((t (:family "Source Sans Pro")))) + '(fixed-pitch ((t ( :family "Iosevka"))))) -(setq org-agenda-files (list "~/org/org.org")) +(setq browse-url-browser-function 'eww-browse-url) -(use-package evil) -(use-package evil-leader) -(use-package evil-org) +(use-package nix-buffer + :ensure t) -(global-evil-leader-mode) -(evil-leader/set-leader ",") -(evil-mode 1) +(use-package org + :ensure t + :config + (setq org-fontify-whole-heading-line t) + (setq org-adapt-indentation nil) + (setq org-hide-emphasis-markers t) + (setq org-default-notes-file "~/org/inbox.org") + (setq org-agenda-files '("~/org"))) -(add-hook 'org-mode-hook 'evil-org-mode) -(evil-org-set-key-theme '(navigation insert textobjects additional todo)) +(setq org-todo-keywords + '((sequence "TODO(t)" "|" "DONE(d)") + (sequence "EXAM(e)" "|" "DONE(d)"))) -(setq org-fontify-whole-heading-line t) -(setq org-adapt-indentation nil) +(add-hook 'org-mode-hook 'visual-line-mode) + +(custom-theme-set-faces + 'user + '(org-level-1 ((t (:family "Source Serif Pro" :weight regular :height 1.4 )))) + '(org-level-2 ((t (:family "Source Serif Pro" :weight regular :height 1.3)))) + '(org-level-3 ((t (:family "Source Serif Pro" :weight regular :height 1.1)))) + '(org-level-4 ((t (:family "Source Serif Pro" :weight regular :height 1.0)))) + '(org-document-title ((t (:family "Source Serif Pro" :height 2.0))))) + +(use-package org-bullets + :ensure t + :config + (setq org-bullets-bullet-list '("◉" "○")) + (add-hook 'org-mode-hook #'org-bullets-mode)) + +(use-package deft + :ensure t + :config + (setq deft-extensions '("org")) + (setq deft-default-extension "org") + (setq deft-directory "~/org") + (setq deft-text-mode 'org-mode) + (setq deft-use-filter-string-for-filename t) + (setq deft-org-mode-title-prefix t) + (setq deft-file-naming-rules + '((noslash . "_") + (nospace . "_") + (case-fn . downcase)))) + +(use-package evil-org + :ensure t + :config + (add-hook 'org-mode-hook 'evil-org-mode) + (evil-org-set-key-theme '(navigation insert textobjects additional todo))) (evil-define-key 'normal org-mode-map "J" 'org-next-visible-heading - "K" 'org-previous-visible-heading) + "K" 'org-previous-visible-heading + (kbd "") 'org-open-at-point) + +(use-package ivy + :ensure t + :config + (setq ivy-use-virtual-buffers t) + (ivy-mode 1)) + +(use-package swiper :ensure t) +(use-package counsel :ensure t) + +(defun go-to-deft () + (interactive) + (deft) + (evil-insert-state)) + +(define-key evil-normal-state-map (kbd "C-b") 'ivy-switch-buffer) +(define-key evil-normal-state-map (kbd "C-f") 'counsel-find-file) +(define-key evil-normal-state-map (kbd "C-n") 'go-to-deft) +(define-key evil-normal-state-map (kbd "M-") 'next-buffer) + +(defun switch-to-last-buffer () + (interactive) + (switch-to-buffer nil)) + +(define-key evil-normal-state-map (kbd "") 'switch-to-last-buffer) + +(evil-define-key 'normal eww-mode-map + "o" 'eww + "H" 'eww-back-url + "L" 'eww-forward-url) + +(org-babel-do-load-languages + 'org-babel-load-languages + '((python . t) + (shell . t) + (C . t))) + +(setq org-confirm-babel-evaluate nil) + +(evil-leader/set-key + "e" 'org-babel-execute-src-block) diff --git a/gui/conf/xmonad.hs b/gui/conf/xmonad.hs index f5e8893..3f92f69 100644 --- a/gui/conf/xmonad.hs +++ b/gui/conf/xmonad.hs @@ -118,7 +118,7 @@ scratchpads host = (customFloating $ hideScreenBorder host sideBarLeft) , NS "messaging" "telegram-desktop" ((className =? "TelegramDesktop") <&&> (title /=? "Media viewer")) (customFloating $ hideScreenBorder host sideBarRight) - , NS "notes" "emacs --title=notemacs ~/org/org.org" (title =? "notemacs") + , NS "notes" "emacs --title=notemacs ~/org/inbox.org" (title =? "notemacs") (customFloating $ hideScreenBorder host dropDownLarge) ] diff --git a/gui/default.nix b/gui/default.nix index 8640143..2cbd113 100644 --- a/gui/default.nix +++ b/gui/default.nix @@ -17,6 +17,8 @@ in { ./apps/dev.nix ]; + fonts.fontconfig.enable = true; + # hidpi specific xorg flags xresources.extraConfig = pkgs.lib.mkIf hidpi '' Xft.dpi: 160 diff --git a/gui/emacs.nix b/gui/emacs.nix index e2773f0..6a4d10f 100644 --- a/gui/emacs.nix +++ b/gui/emacs.nix @@ -5,16 +5,20 @@ enable = true; extraPackages = (epkgs: (with epkgs.melpaStablePackages; [ - use-package - leuven-theme ]) ++ (with epkgs.melpaPackages; [ - evil - evil-leader - evil-org + pdf-tools ]) ++ (with epkgs.elpaPackages; [ - org ])); }; - home.file.".emacs.d/init.el".source = ./conf/init.el; + home.packages = with pkgs; [ + source-sans-pro + source-serif-pro + ]; + + # see https://github.com/rycee/home-manager/issues/589#issuecomment-466594137 + home.activation.linkInitEl = config.lib.dag.entryAfter ["writeBoundary"] '' + mkdir -p ~/.emacs.d + ln -s ${toString ./conf/init.el} ~/.emacs.d/init.el + ''; } -- cgit v1.2.3