dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

config.org (4699B)


      1 * Bootstrap
      2 ** Auto-compile this config file
      3    #+begin_src emacs-lisp
      4      (defun tangle-init ()
      5        "If the current buffer is 'init.org' the code-blocks are
      6      tangled, and the tangled file is compiled."
      7        (when (equal (buffer-file-name)
      8 		    (expand-file-name (concat user-emacs-directory "initconfig.org")))
      9 	 ;; Avoid running hooks when tangling.
     10 	 (let ((prog-mode-hook nil))
     11 	   (org-babel-tangle)
     12 	   (byte-compile-file (concat user-emacs-directory "config.el")))))
     13 
     14      (add-hook 'after-save-hook 'tangle-init)   
     15    #+end_src
     16 
     17 ** Garbage collection
     18    Garbage-collect on focus-out, Emacs /should/ feel snappier.
     19 
     20    #+BEGIN_SRC emacs-lisp
     21      (add-hook 'focus-out-hook #'garbage-collect)
     22    #+END_SRC
     23 
     24 * Theming
     25   Load the themes (from Doom emacs).
     26 
     27   #+BEGIN_SRC emacs-lisp
     28     (unless (package-installed-p 'doom-themes)
     29       (package-refresh-contents)
     30       (package-install 'doom-themes))
     31 
     32     (use-package doom-themes
     33       :config
     34       ;; Global settings (defaults)
     35       (setq doom-themes-enable-bold t    ; if nil, bold is universally disabled
     36 	    doom-themes-enable-italic t) ; if nil, italics is universally disabled
     37 
     38       ;; Enable flashing mode-line on errors
     39       (doom-themes-visual-bell-config)
     40 
     41       ;; Enable custom neotree theme (all-the-icons must be installed!)
     42       (doom-themes-neotree-config)
     43       ;; or for treemacs users
     44       (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
     45       (doom-themes-treemacs-config)
     46 
     47       ;; Corrects (and improves) org-mode's native fontification.
     48       (doom-themes-org-config))
     49   #+END_SRC
     50 
     51   Choose a theme depending on the system theme:
     52 
     53   #+begin_src emacs-lisp
     54     (if (file-exists-p "~/.config/dark-theme")
     55 	(load-theme 'doom-one t)
     56       (load-theme 'doom-one-light t))
     57   #+end_src
     58 
     59 * Packages
     60 ** emacs-which-key
     61    Minor mode for Emacs that displays the key bindings following your currently entered incomplete command (a prefix) in a popup.
     62 
     63    #+BEGIN_SRC emacs-lisp
     64      (unless (package-installed-p 'which-key)
     65        (package-refresh-contents)
     66        (package-install 'which-key))
     67      (which-key-mode)
     68    #+END_SRC
     69 ** helm
     70    Install if not installed:
     71 
     72    #+BEGIN_SRC emacs-lisp
     73      (unless (package-installed-p 'helm)
     74        (package-refresh-contents)
     75        (package-install 'helm))
     76    #+END_SRC
     77 
     78    Configure:
     79 
     80    #+BEGIN_SRC emacs-lisp
     81      (use-package helm
     82        :defer nil
     83        :custom
     84        (helm-M-x-always-save-history t)
     85        (helm-display-function 'pop-to-buffer)
     86        (savehist-additional-variables '(extended-command-history))
     87        (history-delete-duplicates t)
     88        :custom-face
     89        (helm-non-file-buffer ((t (:inherit font-lock-comment-face))))
     90        (helm-ff-file-extension ((t (:inherit default))))
     91        (helm-buffer-file ((t (:inherit default))))
     92        :bind
     93        (("M-x" . helm-M-x)
     94 	("C-x C-f" . helm-find-files)
     95 	("C-x C-b" . helm-buffers-list)
     96 	("C-x b" . helm-buffers-list)
     97 	("C-x C-r" . helm-recentf)
     98 	("C-x C-i" . helm-imenu)
     99 	("M-y" . helm-show-kill-ring))
    100        :config
    101        (helm-mode)
    102        (savehist-mode))
    103    #+END_SRC
    104    
    105    I'd also like helm in a popup frame so:
    106 ** org
    107    In org mode, I want to use bullets instead of stars.
    108    Also, I add a few expansions 
    109    #+BEGIN_SRC emacs-lisp
    110      (use-package org
    111        :config
    112        (unless (package-installed-p 'org-bullets)
    113 	 (package-refresh-contents)
    114 	 (package-install 'org-bullets))
    115        (require 'org-bullets)
    116        (require 'org-tempo)
    117 
    118        :hook
    119        (org-mode . (lambda () (org-bullets-mode 1))))
    120    #+END_SRC
    121 ** exec-path-from-shell
    122    In macOS, the path is not set correctly in the GUI app. This fixes it.
    123    #+begin_src emacs-lisp
    124      (when (memq window-system '(mac ns x))
    125        (exec-path-from-shell-initialize))
    126    #+end_src
    127 ** lean-mode
    128    Shift completion for lean-mode and company-lean:
    129 
    130    #+begin_src emacs-lisp
    131      (global-set-key (kbd "S-SPC") #'company-complete)
    132    #+end_src
    133 * Defaults
    134 ** Appearance
    135    Highlight the current line
    136 
    137    #+BEGIN_SRC emacs-lisp
    138      (global-hl-line-mode)
    139      (show-paren-mode 1)
    140    #+END_SRC
    141 
    142    Disable some UI elements:
    143 
    144    #+BEGIN_SRC emacs-lisp
    145      (when window-system
    146      (scroll-bar-mode 0) ; Disable scrollbar
    147      (tool-bar-mode 0)); Disable toolbar
    148    #+END_SRC
    149    
    150    Line numbers
    151 
    152    #+begin_src emacs-lisp
    153      (global-linum-mode 1)
    154    #+end_src
    155 
    156 ** Backup files
    157    By default, backup files (those with a tilde) are saved in the same directory as the currently edited file.
    158    This setting puts them in ~/.local/share/emacs/saves.
    159 
    160    #+begin_src emacs-lisp
    161      (setq backup-directory-alist '(("." . "~/.local/share/emacs/saves")))
    162      (setq backup-by-copying t)
    163    #+end_src