summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2023-03-11 17:22:13 -0500
committermattkae <mattkae@protonmail.com>2023-03-11 17:22:13 -0500
commit38893cc42e33fc3ab5b80ef592b66226b9ba91cf (patch)
treed47b5588c892f9f16c3785afe856958d139c5e8d /lisp
parent8ed31715bf05c33918c6926c36f510d838521d6a (diff)
Using use-package everywhere, upgrade to org roam
Diffstat (limited to 'lisp')
-rw-r--r--lisp/cpp.el7
-rw-r--r--lisp/general.el99
-rw-r--r--lisp/go.el5
-rw-r--r--lisp/lisp.el5
-rw-r--r--lisp/markdown.el1
-rw-r--r--lisp/org-custom.el21
-rw-r--r--lisp/python-custom.el3
-rw-r--r--lisp/text.el22
-rw-r--r--lisp/web.el54
9 files changed, 126 insertions, 91 deletions
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))
diff --git a/lisp/go.el b/lisp/go.el
index 2adb035..f24ec5f 100644
--- a/lisp/go.el
+++ b/lisp/go.el
@@ -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