From 355d3e236e1a61986f62ff2df9cc04d281ec1009 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sat, 3 Dec 2022 09:30:55 -0500 Subject: Some better highlighting, org-moder, etc --- examples/test.js | 34 ++++++++++++++++++++++++++++++++++ examples/test.org | 4 ++++ init.el | 4 ++-- lisp/general.el | 30 +++++++++++++++++++++++++++--- lisp/org-custom.el | 4 ++++ 5 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 examples/test.js create mode 100644 examples/test.org diff --git a/examples/test.js b/examples/test.js new file mode 100644 index 0000000..15c71d7 --- /dev/null +++ b/examples/test.js @@ -0,0 +1,34 @@ +/** + Adds to numbers. + + @param x {number} The X input + @param y {number} The Y input + @returns {number} x + y +*/ +function myFunction(x, y = 10) { + return x + y +} + +myFunction() +myFunction() + +class MyBigClass { + constructor(pValue) { + this.mValue = pValue; + } + + getValue() { + return this.mValue; + } + + setValue(pValue) { + this.mValue = pValue; + } +} + +const c = new MyBigClass(10); +c.setValue(11); + +for (let index = 0; index < 30; index++) { + console.log("Here"); +} diff --git a/examples/test.org b/examples/test.org new file mode 100644 index 0000000..c7dc3ea --- /dev/null +++ b/examples/test.org @@ -0,0 +1,4 @@ +* Org +- Hello world +- This is my list +** diff --git a/init.el b/init.el index 518a210..43bbcb2 100644 --- a/init.el +++ b/init.el @@ -36,7 +36,7 @@ ;; Theme (require 'doom-themes) -(load-theme 'doom-material t) +(load-theme 'modus-operandi t) (doom-themes-org-config) ;; (setq debug-on-error t) Uncomment if you would like to debug errors! @@ -65,7 +65,7 @@ '(org-agenda-files (list org-directory)) '(org-directory "~/Documents/org") '(package-selected-packages - '(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 neotree 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))) + '(org-modern 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 neotree 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 diff --git a/lisp/general.el b/lisp/general.el index c4a3d2f..871491c 100644 --- a/lisp/general.el +++ b/lisp/general.el @@ -12,6 +12,9 @@ kept-old-versions 2 version-control t) +;; Auto revert mode to reload disk +(global-auto-revert-mode 1) + ;; menu bars (menu-bar-mode -1) (toggle-scroll-bar -1) @@ -47,6 +50,14 @@ ;; Smart parentheses (smartparens-global-mode 1) +(with-eval-after-load 'smartparens + (sp-with-modes + '(c++-mode c-mode javascript-mode typescript-mode python-mode) + (sp-local-pair "{" nil :post-handlers '(:add ("||\n[i]" "RET"))))) + +;; Show number of matches +(setq isearch-lazy-highlight t) +(setq isearch-lazy-count t) ;; Minimap (require 'minimap) @@ -275,14 +286,27 @@ (use-package tree-sitter :ensure t - :defer t) + :defer t + :config + ;; use treesitter when possible + (global-tree-sitter-mode) + ;; overwrite the default syntax-highlighting (from major modes) + (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode) + :hook + (prog-mode . tree-sitter-mode)) (use-package tree-sitter-langs :ensure t :defer t) -(global-tree-sitter-mode) -(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode) +;; Highlight similar text +(use-package highlight-thing + :config + (setq highlight-thing-what-thing 'region) + (setq highlight-thing-what-thing 'word) + (setq highlight-thing-exclude-thing-under-point t) + (global-highlight-thing-mode) + (setq highlight-thing-delay-seconds 0.0)) ;; Vterm (require 'vterm) diff --git a/lisp/org-custom.el b/lisp/org-custom.el index f00924d..3a4c7e7 100644 --- a/lisp/org-custom.el +++ b/lisp/org-custom.el @@ -71,5 +71,9 @@ (add-hook 'org-mode-hook 'org-custom-hook) +(use-package org-modern + :config + (add-hook 'org-mode-hook #'org-modern-mode)) + (provide 'org-custom) ;;; org-custom.el ends here -- cgit v1.2.1