Skip to content

Instantly share code, notes, and snippets.

@khapota
Created May 8, 2020 03:32
Show Gist options
  • Save khapota/7602048ab57a19df04ebfbf0f1d96109 to your computer and use it in GitHub Desktop.
Save khapota/7602048ab57a19df04ebfbf0f1d96109 to your computer and use it in GitHub Desktop.
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
(setq exec-path (append '("~/bin" "~/.asdf/shims" "/usr/local/bin" "/usr/local/sbin") exec-path))
(add-to-list 'load-path "/Volumes/iMacPro/Src/tern/emacs/")
(autoload 'tern-mode "tern.el" nil t)
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Kan"
user-mail-address "[email protected]")
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
(setq doom-font (font-spec :family "monospace" :size 14))
(setq mac-option-modifier 'super
mac-command-modifier 'meta)
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/Dropbox/org")
(setq org-default-notes-file (concat org-directory "~/Dropbox/notes.org"))
(setq org-tag-alist '(("@WORK" . ?w) ("@HOME" . ?h) ("COMPUTE" . ?l)))
(setq diary-file "~/Dropbox/org/diary")
;; plainuml
;; tell org-mode where to find the plantuml JAR file (specify the JAR file)
(setq org-plantuml-jar-path (expand-file-name "~/bin/plantuml.jar -charset UTF-8"))
;; use plantuml as org-babel language
(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t)))
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
(setq nov-text-width 80)
;; helper function
(defun my-org-confirm-babel-evaluate (lang body)
"Do not ask for confirmation to evaluate code for specified languages."
(member lang '("plantuml")))
;; trust certain code as being safe
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
;; automatically show the resulting image
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)
;; alert
(setq alert-default-style 'notifier)
;; JS
(setq js2-mode-show-parse-errors nil)
(setq js2-mode-show-strict-warnings nil)
(display-time-mode 1)
;; ACE jump
(global-set-key (kbd "C-'") 'avy-goto-char)
(global-set-key (kbd "C--") 'avy-goto-char-2)
;; org notifier
(require 'appt)
(setq appt-time-msg-list nil) ;; clear existing appt list
(setq appt-display-interval '5) ;; warn every 5 minutes from t - appt-message-warning-time
(setq
appt-message-warning-time '15 ;; send first warning 15 minutes before appointment
appt-display-mode-line nil ;; don't show in the modeline
appt-display-format 'window) ;; pass warnings to the designated window function
(setq appt-disp-window-function (function ct/appt-display-native))
(appt-activate 1) ;; activate appointment notification
; (display-time) ;; Clock in modeline
(defun ct/send-notification (title msg)
(let ((notifier-path (executable-find "terminal-notifier")))
(start-process
"Appointment Alert"
"*Appointment Alert*" ; use `nil` to not capture output; this captures output in background
notifier-path
"-message" msg
"-title" title
"-activate" "org.gnu.Emacs")))
(defun ct/appt-display-native (min-to-app new-time msg)
(ct/send-notification
(format "Appointment in %s minutes" min-to-app) ; Title
(format "%s" msg))) ; Message/detail text
;; Agenda-to-appointent hooks
(org-agenda-to-appt) ;; generate the appt list from org agenda files on emacs launch
(run-at-time "24:01" 3600 'org-agenda-to-appt) ;; update appt list hourly
(add-hook 'org-finalize-agenda-hook 'org-agenda-to-appt) ;; update appt list on agenda view
(add-hook 'org-agenda-goto-today 'org-agenda-to-appt);; update appt list on agenda view
(global-set-key (kbd "C-c d") 'osx-dictionary-search-word-at-point)
;; Include entries from diary into agenda
(setq org-agenda-include-diary t)
;; fira font
(defun fira-code-mode--make-alist (list)
"Generate prettify-symbols alist from LIST."
(let ((idx -1))
(mapcar
(lambda (s)
(setq idx (1+ idx))
(let* ((code (+ #Xe100 idx))
(width (string-width s))
(prefix ())
(suffix '(?\s (Br . Br)))
(n 1))
(while (< n width)
(setq prefix (append prefix '(?\s (Br . Bl))))
(setq n (1+ n)))
(cons s (append prefix suffix (list (decode-char 'ucs code))))))
list)))
(defconst fira-code-mode--ligatures
'("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\"
"{-" "[]" "::" ":::" ":=" "!!" "!=" "!==" "-}"
"--" "---" "-->" "->" "->>" "-<" "-<<" "-~"
"#{" "#[" "##" "###" "####" "#(" "#?" "#_" "#_("
".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*"
"/**" "/=" "/==" "/>" "//" "///" "&&" "||" "||="
"|=" "|>" "^=" "$>" "++" "+++" "+>" "=:=" "=="
"===" "==>" "=>" "=>>" "<=" "=<<" "=/=" ">-" ">="
">=>" ">>" ">>-" ">>=" ">>>" "<*" "<*>" "<|" "<|>"
"<$" "<$>" "<!--" "<-" "<--" "<->" "<+" "<+>" "<="
"<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<" "<~"
"<~~" "</" "</>" "~@" "~-" "~=" "~>" "~~" "~~>" "%%"
"x" ":" "+" "+" "*"))
(defvar fira-code-mode--old-prettify-alist)
(defun fira-code-mode--enable ()
"Enable Fira Code ligatures in current buffer."
(setq-local fira-code-mode--old-prettify-alist prettify-symbols-alist)
(setq-local prettify-symbols-alist (append (fira-code-mode--make-alist fira-code-mode--ligatures) fira-code-mode--old-prettify-alist))
(prettify-symbols-mode t))
(defun fira-code-mode--disable ()
"Disable Fira Code ligatures in current buffer."
(setq-local prettify-symbols-alist fira-code-mode--old-prettify-alist)
(prettify-symbols-mode -1))
(define-minor-mode fira-code-mode
"Fira Code ligatures minor mode"
:lighter " Fira Code"
(setq-local prettify-symbols-unprettify-at-point 'right-edge)
(if fira-code-mode
(fira-code-mode--enable)
(fira-code-mode--disable)))
(defun fira-code-mode--setup ()
"Setup Fira Code Symbols"
(set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol"))
(provide 'fira-code-mode)
(add-hook 'after-init-hook #'global-ycmd-mode)
(set-variable 'ycmd-server-command '("python" "/Volumes/iMacPro/Src/ycmd/ycmd"))
;; Noter
(setq org-noter-notes-search-path '("~/Dropbox/org"))
(setq org-noter-default-notes-file-names '("reading_notes.org"))
;; Roam
(use-package! org-roam
:commands (org-roam-insert org-roam-find-file org-roam)
:init
(setq org-roam-directory "~/Dropbox/org/wiki")
(setq org-roam-index-file "index.org")
(setq org-roam-link-title-format "R:%s")
;; ("d" "default" plain (function org-roam--capture-get-point)
;; "%?"
;; :file-name "%<%Y%m%d%H%M%S>-${slug}"
;; :head "#+TITLE: ${title}\n"
;; :unnarrowed t)
(map! :leader
:prefix "n"
:desc "Org-Roam-Insert" "i" #'org-roam-insert
:desc "Org-Roam-Home" "h" #'org-roam-jump-to-index
:desc "Org-Roam-Find" "/" #'org-roam-find-file
:desc "Org-Roam-Buffer" "r" #'org-roam)
:config
(org-roam-mode +1))
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c g k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c g d') to jump to their definition and see how
;; they are implemented.
;; (use-package kubernetes
;; :ensure t
;; :commands (kubernetes-overview))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment