diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | examples/test.org | 14 | ||||
-rw-r--r-- | init.el | 70 | ||||
-rw-r--r-- | lisp/cpp.el | 7 | ||||
-rw-r--r-- | lisp/general.el | 99 | ||||
-rw-r--r-- | lisp/go.el | 5 | ||||
-rw-r--r-- | lisp/lisp.el | 5 | ||||
-rw-r--r-- | lisp/markdown.el | 1 | ||||
-rw-r--r-- | lisp/org-custom.el | 21 | ||||
-rw-r--r-- | lisp/python-custom.el | 3 | ||||
-rw-r--r-- | lisp/text.el | 22 | ||||
-rw-r--r-- | lisp/web.el | 54 |
13 files changed, 153 insertions, 158 deletions
@@ -13,4 +13,7 @@ transient recentf url tutorial -.cache
\ No newline at end of file +.cache +.org-id-locations +org-roam.db +bookmarks
\ No newline at end of file @@ -17,7 +17,10 @@ Emacs configuration file - Kill buffer: `C-x k` ## Fonts -- We use the `monaco` font that can be found in your repository. +- I make use of `monaco` and `iosevka`. + +## Org mode +- The configuration assumes that you have an `~/OrgRoam` folder at the root of your home directory. ## Per-language Features diff --git a/examples/test.org b/examples/test.org index 5cf589a..7ec4839 100644 --- a/examples/test.org +++ b/examples/test.org @@ -1,4 +1,16 @@ +#+TITLE: Org Mode Test + * Org - Hello world - This is my list -** TODO +** TODO This is a TODO entry + +#+BEGIN_SRC js + + function x() { + const y = 10; + return y; + } + +#+END_SRC + @@ -11,23 +11,6 @@ ;; https://stackoverflow.com/questions/31079204/emacs-package-install-script-in-init-file (package-initialize) -(setq package-list - '(highlight-indent-guides helm helm-projectile js-doc eslint-fix go-mode highlight-thing tree-sitter-langs tree-sitter eldoc-box company-quickhelp hl-todo python-mode drag-stuff org-bullets git-gutter-fringe git-gutter vterm-toggle vterm minimap good-scroll counsel smartparens xref-js2 eglot json-mode markdown-mode emojify tern rtags cmake-ide cmake-mode tide auctex evil js2-highlight-vars ac-js2 js2-refactor js2-mode all-the-icons req-package projectile org)) - -;; Fetch the list of packages available -(unless package-archive-contents - (package-refresh-contents)) - -; Install the missing packages -(dolist (package package-list) - (let ((has-refreshed 0)) - (unless (package-installed-p package) - (unless (eq has-refreshed 1) - (setq has-refreshed 1) - (package-refresh-contents) - ) - (package-install package)))) - ;; The default is 800 kilobytes. Measured in bytes. (setq gc-cons-threshold (* 50 1000 1000)) @@ -39,10 +22,12 @@ gcs-done))) ;; Theme -(require 'doom-themes) -(load-theme 'doom-one-light t) -(doom-themes-org-config) -; (setq debug-on-error t) ; Uncomment if you would like to debug errors! +(use-package doom-themes + :ensure t + :config + (load-theme 'doom-one-light t) + (doom-themes-org-config) + ) (require 'general) (require 'cpp) @@ -56,49 +41,6 @@ (require 'python-custom) (require 'vc-annotate-lens-mode) -(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. - '(custom-safe-themes - '("ae426fc51c58ade49774264c17e666ea7f681d8cae62570630539be3d06fd964" "1a1ac598737d0fcdc4dfab3af3d6f46ab2d5048b8e72bc22f50271fd6d393a00" "8d8207a39e18e2cc95ebddf62f841442d36fcba01a2a9451773d4ed30b632443" "251ed7ecd97af314cd77b07359a09da12dcd97be35e3ab761d4a92d8d8cf9a71" "f053f92735d6d238461da8512b9c071a5ce3b9d972501f7a5e6682a90bf29725" "da75eceab6bea9298e04ce5b4b07349f8c02da305734f7c0c8c6af7b5eaa9738" "6945dadc749ac5cbd47012cad836f92aea9ebec9f504d32fe89a956260773ca4" "680f62b751481cc5b5b44aeab824e5683cf13792c006aeba1c25ce2d89826426" "2721b06afaf1769ef63f942bf3e977f208f517b187f2526f0e57c1bd4a000350" "70b596389eac21ab7f6f7eb1cf60f8e60ad7c34ead1f0244a577b1810e87e58c" "2853dd90f0d49439ebd582a8cbb82b9b3c2a02593483341b257f88add195ad76" "467dc6fdebcf92f4d3e2a2016145ba15841987c71fbe675dcfe34ac47ffb9195" "512ce140ea9c1521ccaceaa0e73e2487e2d3826cc9d287275550b47c04072bc4" "2078837f21ac3b0cc84167306fa1058e3199bbd12b6d5b56e3777a4125ff6851" "b99e334a4019a2caa71e1d6445fc346c6f074a05fcbb989800ecbe54474ae1b0" "4ff1c4d05adad3de88da16bd2e857f8374f26f9063b2d77d38d14686e3868d8d" "bf948e3f55a8cd1f420373410911d0a50be5a04a8886cabe8d8e471ad8fdba8e" "a138ec18a6b926ea9d66e61aac28f5ce99739cf38566876dc31e29ec8757f6e2" "7a424478cb77a96af2c0f50cfb4e2a88647b3ccca225f8c650ed45b7f50d9525" "adaf421037f4ae6725aa9f5654a2ed49e2cd2765f71e19a7d26a454491b486eb" "be84a2e5c70f991051d4aaf0f049fa11c172e5d784727e0b525565bb1533ec78" "a44e2d1636a0114c5e407a748841f6723ed442dc3a0ed086542dc71b92a87aee" "fa2b58bb98b62c3b8cf3b6f02f058ef7827a8e497125de0254f56e373abee088" "5859f61b502aa335b502b231c86a051210cb5974f74966e620c31be3a966659f" "32a9fa0f3722e679ed77a28aed3ae99161ef54dc27c35fd19e68e0410633960b" default)) - '(git-gutter:added-sign "++") - '(git-gutter:deleted-sign "--") - '(git-gutter:modified-sign " ") - '(org-agenda-files (list org-directory)) - '(org-directory "~/Documents/org") - '(package-selected-packages - '(org-notify helm-posframe treemacs-projectile treemacs highlight-indent-guides helm js-doc eslint-fix eslintd-fix go-mode css-eldoc dashboard highlight-thing tree-sitter-langs tree-sitter eldoc-box company-quickhelp hl-todo python-mode drag-stuff org-bullets git-gutter-fringe git-gutter vterm-toggle vterm minimap good-scroll counsel ## smartparens xref-js2 eglot json-mode markdown-mode emojify tern rtags cmake-ide cmake-mode tide auctex evil js2-highlight-vars ac-js2 js2-refactor js2-mode flycheck-irony company-irony all-the-icons req-package projectile irony org))) - -;;; init.el ends here -(custom-set-faces - ;; custom-set-faces 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. - '(org-block ((t (:inherit fixed-pitch)))) - '(org-code ((t (:inherit (shadow fixed-pitch))))) - '(org-document-info ((t (:foreground "dark orange")))) - '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) - '(org-document-title ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro" :height 1.3 :weight:bold)))) - '(org-indent ((t (:inherit (org-hide fixed-pitch))))) - '(org-level-1 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro" :height 1.5 :weight bold)))) - '(org-level-2 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro" :height 1.3 :weight bold)))) - '(org-level-3 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro" :height 1.1)))) - '(org-level-4 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro" :height 1.0)))) - '(org-level-5 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro")))) - '(org-level-6 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro")))) - '(org-level-7 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro")))) - '(org-level-8 ((t (:inherit default :weight normal :foreground "#000000" :font "Source Sans Pro")))) - '(org-link ((t (:foreground "royal blue" :underline t)))) - '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) - '(org-property-value ((t (:inherit fixed-pitch))) t) - '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))) - '(org-table ((t (:inherit fixed-pitch :foreground "#83a598")))) - '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) -(put 'downcase-region 'disabled nil) (require 'server) (unless (server-running-p) diff --git a/lisp/cpp.el b/lisp/cpp.el index cd644a2..8c7b069 100644 --- a/lisp/cpp.el +++ b/lisp/cpp.el @@ -12,10 +12,13 @@ ;; (electric-indent-mode 0) ) -(require 'eglot) +(use-package eglot + :ensure t + :config + (add-hook 'c-mode-common-hook 'eglot-ensure) + ) (add-hook 'c-mode-common-hook 'setup-c) -(add-hook 'c-mode-common-hook 'eglot-ensure) (defun create-cpp-class() "Create a cpp class." diff --git a/lisp/general.el b/lisp/general.el index 4ab0349..52f276a 100644 --- a/lisp/general.el +++ b/lisp/general.el @@ -73,6 +73,7 @@ ;; Highlight todos (use-package hl-todo + :ensure t :config (global-hl-todo-mode 1) ) @@ -82,8 +83,10 @@ ;; I am using the helm package, of course (use-package helm - :ensure t) -(helm-mode 1) + :ensure t + :config + (helm-mode 1) + ) (use-package helm-posframe :ensure t @@ -91,26 +94,35 @@ (helm-posframe-enable)) ;; Projectile for project navigation -(use-package projectile) -(require 'projectile) -(projectile-mode +1) +(use-package projectile + :ensure t + :config + (projectile-mode +1) + (setq projectile-switch-project-action 'treemacs-add-and-display-current-project-exclusively) + (setq projectile-indexing-method 'native) + (setq projectile-enable-caching t) + (add-to-list 'projectile-globally-ignored-directories "node_modules") + (add-to-list 'projectile-globally-ignored-directories "elpa") + (add-to-list 'projectile-project-root-files "package.json") + ) + (use-package helm-projectile + :ensure t + :bind :config (helm-projectile-on) + (define-key projectile-mode-map (kbd "s-F") 'helm-projectile-grep) + (define-key projectile-mode-map [?\s-o] 'helm-projectile-switch-project) + (define-key projectile-mode-map [?\s-p] 'helm-projectile-find-file) + :after (projectile helm) ) -(define-key projectile-mode-map (kbd "s-F") 'helm-projectile-grep) -(define-key projectile-mode-map [?\s-o] 'helm-projectile-switch-project) -(define-key projectile-mode-map [?\s-p] 'helm-projectile-find-file) -;(setq projectile-indexing-method 'alien) -(setq projectile-indexing-method 'native) -(setq projectile-enable-caching t) -(add-to-list 'projectile-globally-ignored-directories "node_modules") ;; Don't ask to kill when we have an open line number (setq-default confirm-kill-processes nil) ;; Highlight indentation lines (use-package highlight-indent-guides + :ensure t :config (add-hook 'prog-mode-hook 'highlight-indent-guides-mode) (setq highlight-indent-guides-method 'character) @@ -128,8 +140,6 @@ :ensure t :after (treemacs projectile)) -(setq projectile-switch-project-action 'treemacs-add-and-display-current-project-exclusively) - ;; Line highlighting (global-hl-line-mode 1) (set-face-background 'hl-line "unspecified") @@ -156,6 +166,7 @@ ;; Emojis (use-package emojify + :ensure t :config (when (member "Segoe UI Emoji" (font-family-list)) (set-fontset-font @@ -252,15 +263,6 @@ (set-face-underline 'eglot-highlight-symbol-face t) - -;; (use-package eldoc-box -;; :ensure t -;; :defer t) - -;; (add-hook 'emacs-lisp-mode-hook #'eldoc-box-hover-mode t) -;; (add-hook 'css-mode-hook #'eldoc-box-hover-mode t) -;; (add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t) - (use-package tree-sitter :ensure t :defer t @@ -278,6 +280,7 @@ ;; Highlight similar text (use-package highlight-thing + :ensure t :config (setq highlight-thing-what-thing 'region) (setq highlight-thing-what-thing 'word) @@ -286,23 +289,6 @@ (setq highlight-thing-delay-seconds 1.0)) ;; Vterm -(require 'vterm) -(require 'vterm-toggle) -(setq vterm-toggle-fullscreen-p nil) -(add-to-list 'display-buffer-alist - '((lambda (buffer-or-name _) - (let ((buffer (get-buffer buffer-or-name))) - (with-current-buffer buffer - (or (equal major-mode 'vterm-mode) - (string-prefix-p vterm-buffer-name (buffer-name buffer)))))) - (display-buffer-reuse-window display-buffer-at-bottom) - ;;(display-buffer-reuse-window display-buffer-in-direction) - ;;display-buffer-in-direction/direction/dedicated is added in emacs27 - ;;(direction . bottom) - ;;(dedicated . t) ;dedicated is supported in emacs27 - (reusable-frames . visible) - (window-height . 0.2))) -(bind-key* (kbd "M-t") 'vterm-toggle) (defun my-vterm-mode-set-colors() "Set the colors of vterm to match my personal taste." @@ -315,12 +301,38 @@ (face-remap-add-relative 'default '(:background "#232627")) (face-remap-add-relative 'default '(:foreground"#fcfcfc")) ) + +(use-package vterm + :ensure t + ) (add-hook 'vterm-mode-hook 'my-vterm-mode-set-colors) +(use-package vterm-toggle + :ensure t + :config + (setq vterm-toggle-fullscreen-p nil) + (add-to-list 'display-buffer-alist + '((lambda (buffer-or-name _) + (let ((buffer (get-buffer buffer-or-name))) + (with-current-buffer buffer + (or (equal major-mode 'vterm-mode) + (string-prefix-p vterm-buffer-name (buffer-name buffer)))))) + (display-buffer-reuse-window display-buffer-at-bottom) + ;;(display-buffer-reuse-window display-buffer-in-direction) + ;;display-buffer-in-direction/direction/dedicated is added in emacs27 + ;;(direction . bottom) + ;;(dedicated . t) ;dedicated is supported in emacs27 + (reusable-frames . visible) + (window-height . 0.2))) + :after (vterm)) +(bind-key* (kbd "M-t") 'vterm-toggle) + ;; Line movement -(require 'drag-stuff) -(drag-stuff-global-mode) -(drag-stuff-define-keys) +(use-package drag-stuff + :config + (drag-stuff-global-mode) + (drag-stuff-define-keys) + ) ;; Copy the entire buffer. (defun my-copy-all () @@ -329,6 +341,7 @@ (clipboard-kill-ring-save (point-min) (point-max))) (use-package flycheck + :ensure t :config (setq flycheck-check-syntax-automatically '(save mode-enable)) '(flycheck-idle-change-delay 1)) @@ -1,8 +1,11 @@ ;;; Code: -(require 'eglot) +(use-package eglot + :ensure t) (use-package go-mode + :ensure t + :after (eglot) :config (add-hook 'go-mode-hook 'eglot-ensure)) diff --git a/lisp/lisp.el b/lisp/lisp.el index 01199ca..38c8ebe 100644 --- a/lisp/lisp.el +++ b/lisp/lisp.el @@ -1,15 +1,12 @@ ;;; Code: -(require 'eglot) + ;;(add-hook 'emacs-lisp-mode-hook 'eglot-ensure) (defun setup-lisp() "Set up the Lisp auto complete." (company-mode t) ) -(require 'projectile) -(with-eval-after-load 'projectile - (add-to-list 'projectile-globally-ignored-directories "elpa")) (add-hook 'emacs-lisp-mode-hook 'setup-lisp) (provide 'lisp) diff --git a/lisp/markdown.el b/lisp/markdown.el index 9713d36..d3dc030 100644 --- a/lisp/markdown.el +++ b/lisp/markdown.el @@ -4,6 +4,7 @@ "Use the markdown-mode package to provide 'markdown-mode on-demand." t) (use-package markdown-mode + :ensure t :commands (markdown-mode gfm-mode) :mode (("README\\.md\\'" . gfm-mode) ("\\.md\\'" . markdown-mode) diff --git a/lisp/org-custom.el b/lisp/org-custom.el index be6a0c7..e46a070 100644 --- a/lisp/org-custom.el +++ b/lisp/org-custom.el @@ -10,11 +10,9 @@ (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) (let* ((variable-tuple - (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro")) - ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande")) - ((x-list-fonts "Verdana") '(:font "Verdana")) - ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) - (nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro.")))) + (cond ((x-list-fonts "Iosevka") '(:font "Iosevka")) + ((x-list-fonts "Monaco") '(:font "Monaco")) + ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro")))) (base-font-color (face-foreground 'default nil 'default)) (headline `(:inherit default :weight normal :foreground ,base-font-color))) @@ -62,7 +60,7 @@ ) (custom-set-variables - '(org-directory "~/Documents/org") + '(org-directory "~/OrgRoam") '(org-agenda-files (list org-directory))) (setq org-todo-keywords @@ -86,5 +84,16 @@ org-alert-notify-after-event-cutoff 10 alert-default-style 'libnotify)) +(use-package org-roam + :ensure t + :custom + (org-roam-directory "~/OrgRoam") + :bind (("C-c n l" . org-roam-buffer-toggle) + ("C-c n f" . org-roam-node-find) + ("C-c n i" . org-roam-node-insert)) + :config + (org-roam-setup) + ) + (provide 'org-custom) ;;; org-custom.el ends here diff --git a/lisp/python-custom.el b/lisp/python-custom.el index ebb2b81..432ad48 100644 --- a/lisp/python-custom.el +++ b/lisp/python-custom.el @@ -1,6 +1,7 @@ ;;; Code: -(require 'python) +(use-package python + :ensure t) (use-package eglot :ensure t :config diff --git a/lisp/text.el b/lisp/text.el index ab564c5..2438b7d 100644 --- a/lisp/text.el +++ b/lisp/text.el @@ -4,11 +4,6 @@ "Disable word wrap in text mode." ;(perfect-margin-mode 1) (setq word-wrap t) - (require 'flyspell) - (flyspell-mode 1) - (set-face-attribute 'hl-line nil - :box nil) - (set-face-attribute 'flyspell-incorrect-face nil :foreground nil :weight 'normal :underline '(:color "red" :style wave)) (display-line-numbers-mode -1) ) @@ -24,10 +19,21 @@ (add-hook 'text-mode-hook 'my-perfect-margin-mode-hook)) (add-hook 'text-mode-hook 'setup-text-mode) -(require 'ispell) -(setq ispell-program-name (executable-find "hunspell") - ispell-dictionary "en_US") +(use-package ispell + :ensure t + :config + (setq ispell-program-name (executable-find "hunspell") + ispell-dictionary "en_US") + ) +(use-package flyspell + :ensure t + :hook (text-mode . flyspell-mode) + :config + (set-face-attribute 'hl-line nil + :box nil) + (set-face-attribute 'flyspell-incorrect-face nil :foreground nil :weight 'normal :underline '(:color "red" :style wave)) + ) (provide 'text) ;;; text.el ends here diff --git a/lisp/web.el b/lisp/web.el index bb5d4f8..73f3935 100644 --- a/lisp/web.el +++ b/lisp/web.el @@ -22,17 +22,20 @@ (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) (setq-default js-indent-level 2) -(require 'flycheck) -(setq-default flycheck-disabled-checkers - (append flycheck-disabled-checkers - '(javascript-jshint))) -(setq-default flycheck-disabled-checkers - (append flycheck-disabled-checkers - '(json-jsonlist))) -(flycheck-add-mode 'javascript-eslint 'js-mode) -(flycheck-add-mode 'typescript-tslint 'typescript-mode) -(add-hook 'js-mode-hook 'flycheck-mode) -(add-hook 'typescript-mode-hook 'flycheck-mode) +(use-package flycheck + :ensure t + :config + (setq-default flycheck-disabled-checkers + (append flycheck-disabled-checkers + '(javascript-jshint))) + (setq-default flycheck-disabled-checkers + (append flycheck-disabled-checkers + '(json-jsonlist))) + (flycheck-add-mode 'javascript-eslint 'js-mode) + (flycheck-add-mode 'typescript-tslint 'typescript-mode) + (add-hook 'js-mode-hook 'flycheck-mode) + (add-hook 'typescript-mode-hook 'flycheck-mode) + ) ;; TSX (use-package tree-sitter-langs @@ -61,30 +64,29 @@ (add-hook 'flycheck-mode-hook #'my-use-eslint-from-node-modules) ;; Package management -(require 'eglot) +(use-package eglot + :config + (add-hook 'js-mode-hook 'js-eglot-ensure) + (add-hook 'typescript-mode-hook 'eglot-ensure) + (add-hook 'typescript-tsx-mode-hook 'eglot-ensure) + (add-to-list 'eglot-server-programs '(js-mode . ("typescript-language-server" "--stdio"))) + (add-to-list 'eglot-server-programs '(typescript-mode . ("typescript-language-server" "--stdio"))) + (add-to-list 'eglot-server-programs '(typescript-tsx-mode . ("typescript-language-server" "--stdio"))) + ) (defun js-eglot-ensure() "Ensure eglot mode, unless we are in json mode" (when (string= (file-name-extension buffer-file-name) "js") (eglot-ensure)) ) -(add-hook 'js-mode-hook 'js-eglot-ensure) -(add-hook 'typescript-mode-hook 'eglot-ensure) -(add-hook 'typescript-tsx-mode-hook 'eglot-ensure) -(add-to-list 'eglot-server-programs '(js-mode . ("typescript-language-server" "--stdio"))) -(add-to-list 'eglot-server-programs '(typescript-mode . ("typescript-language-server" "--stdio"))) -(add-to-list 'eglot-server-programs '(typescript-tsx-mode . ("typescript-language-server" "--stdio"))) - -;; Ignore certain directories in projectile -(require 'projectile) -(with-eval-after-load 'projectile - (add-to-list 'projectile-globally-ignored-directories "node_modules") - (add-to-list 'projectile-project-root-files "package.json")) ;; CSS eldoc (use-package css-eldoc - :commands turn-on-css-eldoc) + :ensure t + :commands turn-on-css-eldoc + :config + (add-hook 'css-mode-hook 'turn-on-css-eldoc) + ) -(add-hook 'css-mode-hook 'turn-on-css-eldoc) (provide 'web) ;;; web.el ends here |