      treemacs-filewatch-mode t))
   :bind (("C-c C-o" . treemacs-select-window)))
 
-(use-package treemacs-projectile :straight t :after treemacs projectile)
-(use-package treemacs-magit :straight t :after treemacs magit)
-
-;; optional if you want which-key integration
-(use-package which-key
+
+;; language supports other than programming language
+(progn
+  (use-package meson-mode :straight t :defer t)
+  (use-package terraform-mode :defer t :straight t)
+  (use-package dockerfile-mode :straight t :defer t)
+  (use-package docker-compose-mode :straight t :defer t)
+  (use-package dune :straight t :defer t)
+  (use-package json-mode :straight t :defer t)
+  (use-package hcl-mode :straight t :defer t)
+  (use-package yaml-mode :straight t :defer t)
+  (use-package protobuf-mode :defer t
+    :init
+    (add-to-list 'auto-mode-alist '("\\.proto$" . protobuf-mode))))
+
+;; all major programming modes
+(progn
+  ;; patch for prolog
+  (add-to-list 'auto-mode-alist '("\\.pl$" . prolog-mode))
+
+
+  (straight-use-package 'tree-sitter)
+  (straight-use-package 'tree-sitter-langs)
+
+  ;; add & loads installed tree-sitter shared library
+  (require 'tree-sitter-langs)
+
+  ;; register tree sitter hl mode after tree sitter being loaded
+  (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
+
+  (use-package editorconfig :straight t
+    :config (editorconfig-mode 1)
+    :hook
+    (prog-mode . editorconfig-mode-apply))
+
+  (use-package go-mode :straight t :defer t
+    :hook
+    (go-mode . tree-sitter-mode))
+
+  (use-package tuareg-mode :straight t :defer t
+    :hook
+    (tuareg-mode . tree-sitter-mode))
+
+  (use-package scala-mode :straight t :defer t
+    :hook
+    (scala-mode . tree-sitter-mode))
+
+  (use-package rust-mode :straight t :defer t
+    :hook
+    (rust-mode . tree-sitter-mode))
+
+  (use-package haskell-mode :straight t :defer t)
+
+  (use-package typescript-mode :straight t :defer t
+    :hook
+    (typescript-mode . tree-sitter-mode)
+    :config
+    (add-to-list 'auto-mode-alist '("\\.tsx$" . typescript-mode)))
+
+  (use-package racket-mode :straight t :defer t
+    :init
+    (setq racket-user-command-line-arguments '("-I" "typed/racket")))
+
+  ;; tamarin proover supports
+  (use-package spthy-mode :defer t
+    :init
+    (add-to-list 'auto-mode-alist '("\\.spthy" . spthy-mode))
+    :straight (spthy-mode :type git
+                          :host github :repo "tamarin-prover/tamarin-prover"
+                          :branch "develop"
+                          :files (("etc/spthy-mode.el" . "spthy-mode.el"))))
+
+  ;; tla+ supports
+  (use-package tla+-mode :defer t
+    :init
+    (add-to-list 'auto-mode-alist '("\\.tla\\'" . tla+-mode))
+    :config
+    (setq tla+-tlatools-path "~/.local/share/tlaplus/tla2tools.jar")
+    :straight (tla+-mode :type git
+			 :repo "https://git.sdf.org/bch/tlamode"
+			 :branch "master"
+			 :files (("lisp/tla+-mode.el" . "tla+-mode.el")))))
+
+
+;; package management/envs supports related to programming language
+(progn
+  (use-package rvm :straight t :defer t
+    :hook
+    (ruby-mode . rvm-use-default)))
+
+;; packages related to docs
+(progn
+  (use-package adoc-mode :straight t :defer t
+    :init
+    (add-to-list 'auto-mode-alist '("\\.adoc$" . adoc-mode)))
+
+  (use-package polymode :straight t :defer t)
+  (use-package poly-rst :straight t :defer t)
+  (use-package poly-markdown :straight t :defer t)
+  (use-package poly-org :straight t :defer t))
+
+(use-package browse-at-remote :straight t)
+
+(use-package flycheck :straight t
+  :hook
+  (prog-mode . flycheck-mode))
+
+;; (use-package tree-sitter :straight :defer t)
+;; (use-package tree-sitter-langs :straight :defer t)
+
+(use-package lsp-mode
+  :defer t
   :straight t
-  :config
-  (which-key-mode))
-
-(use-package flycheck-inline :straight t
+  :custom
+  (lsp-rust-server 'rust-analyzer)
+  :config
+  (lsp-register-custom-settings
+   '(("rust-analyzer.procMacro.enable" t t)
+     ("rust-analyzer.cargo.loadOutDirsFromCheck" t t)
+     ("gopls.completeUnimported" t t)
+     ("gopls.staticcheck" t t)
+     ("gopls.experimentalDiagnosticsDelay" "250ms" t)
+     ("gopls.experimentalPackageCacheKey" t t)
+     ("gopls.experimentalWorkspaceModule" t t)))
+  (lsp-register-client
+   (make-lsp-client
+    :new-connection
+    (lsp-stdio-connection (list "swipl"
+                                "-g" "use_module(library(lsp_server))."
+                                "-g" "lsp_server:main"
+                                "-t" "halt"
+                                "--" "stdio"))
+    :major-modes '(prolog-mode)
+    :priority 1
+    :multi-root t
+    :server-id 'prolog-ls))
   :init
-  (add-hook 'flycheck-mode-hook #'turn-on-flycheck-inline))
-
-(use-package flycheck :straight t
-  :config (global-flycheck-mode))
-
-(use-package epg :straight t :config (setq epg-gpgconf-program "gpg"))
-
-(use-package gradle-mode :straight t)
-(use-package flycheck-gradle :straight t)
-
-(use-package kotlin-mode :straight t)
-
-;; (use-package persistent-scratch :straight t
-;;   :config (persistent-scratch-setup-default))
-
-(use-package dashboard :straight t
-  :init
-  (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))
-        dashboard-org-agenda-categories '("Tasks" "Appointments")
-        ;; dashboard-projects-switch-function 'counsel-projectile-switch-project-by-name
-        dashboard-items '((bookmarks . 5)
-                          (projects . 5)
-                          (agenda . 5)
-                          (registers . 5)))
-  :config (dashboard-setup-startup-hook))
-
-(use-package dockerfile-mode :straight t)
-(use-package docker-compose-mode :straight t)
-(use-package dune :straight t)
-
-(use-package pass :straight t)
-(use-package password-store :straight t)
-(use-package password-store-otp :straight t)
-(use-package auth-source-pass :straight t :config (auth-source-pass-enable))
-
-(use-package graphviz-dot-mode :straight t)
-
-(use-package ripgrep :straight t)
-
-(use-package bnf-mode :straight t)
-
-(use-package emacsql-psql :straight t)
-(use-package emacsql-mysql :straight t)
-(use-package pcap-mode :straight t)
-
-;; (use-package magithub :straight t)
-;; (use-package ghub :straight t)
-;; (use-package ghub+ :straight t)
-(use-package github-browse-file :straight t)
-
-(use-package yaml-mode :straight t)
-
-(use-package typescript-mode :straight t
-  :init
-  (add-to-list 'auto-mode-alist '("\\.tsx$" . typescript-mode)))
-
-(use-package envrc :straight t)
-
-;; (use-package elfeed :straight t)
-;; (use-package elfeed-protocol :straight t)
-;; (use-package elfeed-org :straight t
-;;  :init
-;;  (setq rmh-elfeed-org-files (list "~/.emacs.d/research-papers.org")))
-;; (use-package elfeed-dashboard :straight t)
-
-(setq wl-copy-process nil)
-
-(defun wl-copy (text)
-  (setq wl-copy-process (make-process :name "wl-copy"
-                                      :buffer nil
-                                      :command '("wl-copy" "-f" "-n")
-                                      :connection-type 'pipe))
-  (process-send-string wl-copy-process text)
-  (process-send-eof wl-copy-process))
-
-
-(defun wl-paste ()
-  (if (and wl-copy-process (process-live-p wl-copy-process))
-      nil
-    (shell-command-to-string "wl-paste -n | tr -d \r")))
-
-(setq interprogram-cut-function 'wl-copy)
-(setq interprogram-paste-function 'wl-paste)
-
-;; (use-package gist :straight t
-;;   :config
-;;   (setq gist-list-format '((created "Created" 15 nil "%D" "%R")
-;;                            (id      "Id"      10 nil identity)
-;;                            (files   "Files"   35 nil (lambda (files) (mapconcat 'identity files ", ")))
-;;                            (visibility "Private" 8 nil (lambda (public) (or (and public "") "   Y")))
-;;                            (description "Description" 0 nil identity))))
-
-(use-package browse-at-remote :straight t)
-
-(use-package git-link :straight t)
-
-(use-package xclip :straight t :init (xclip-mode))
-
-(use-package spthy-mode
-  :init
-  (add-to-list 'auto-mode-alist '("\\.spthy" . spthy-mode))
-  :straight (spthy-mode :type git
-                        :host github :repo "tamarin-prover/tamarin-prover"
-                        :branch "develop"
-                        :files (("etc/spthy-mode.el" . "spthy-mode.el"))))
-
-;; (straight-use-package
-;;  '(lean-mode :type git
-;;              :host github :repo "leanprover/lean4"
-;;              :branch "master"
-;;              :files (:defaults "lean4-mode/*.el")))
-
-(use-package tla+-mode
-  :init
-  (add-to-list 'auto-mode-alist '("\\.tla\\'" . tla+-mode))
-  :config
-  (setq tla+-tlatools-path "~/.local/share/tlaplus/tla2tools.jar")
-  :straight (tla+-mode :type git
-                       :repo "https://git.sdf.org/bch/tlamode"
-                       :branch "master"
-                       :files (("lisp/tla+-mode.el" . "tla+-mode.el"))))
-
-(use-package fsharp-mode
-  :straight (fsharp-mode :type git
-                         :host github :repo "zerosign/emacs-fsharp-mode"
-                         :branch "master"))
-
-
-(global-set-key (kbd "C-c C-_") 'comment-or-uncomment-region)
-
-(use-package json-mode :straight t)
-
-(use-package jdecomp :straight t
-  :config
-  (setq
-   jdecomp-decompiler-paths '((fernflower . "/home/zerosign/.m2/repository/org/jetbrains/fernflower/fernflower/1.0/fernflower-1.0.jar"))
-   jdecomp-decompiler-type 'fernflower))
-
-
-(use-package editorconfig :straight t  :config (editorconfig-mode 1))
-(add-hook 'prog-mode-hook #'editorconfig-mode-apply)
-
-(use-package deft :straight t
-  :custom
-  (deft-extensions '("org"))
-  (deft-directory  "~/Repositories/notes/zerodevs")
-  (deft-use-filename-as-title t))
-
-(use-package zetteldeft
-  :straight t
-  :after deft
-  :config (zetteldeft-set-classic-keybindings))
-
-(use-package julia-mode :straight t)
-
-(use-package hcl-mode :straight t)
-
-(use-package meson-mode :straight t)
-
-(use-package lean-mode :straight t)
-
-(use-package org-roam :straight t)
-
-;; (straight-use-package
-;;  '(tsc :host github
-;;        :repo "mallt/mysql-to-org-mode"
-;;        :files ("*.el")))
-
-(use-package kubernetes :straight t)
-
-(use-package org-journal :straight t
-  :init
-  (setq org-journal-dir "~/org/journal"
-        org-journal-date-format "%A, %d %B %Y"))
-
-(use-package org-jira :straight t
-  :init
-  (setq jiralib-url "https://ruanggguru.atlassian.net"))
-
-(defun org-journal-find-location ()
-  ;; Open today's journal, but specify a non-nil prefix argument in order to
-  ;; inhibit inserting the heading; org-capture will insert the heading.
-  (org-journal-new-entry t)
-  (unless (eq org-journal-file-type 'daily)
-    (org-narrow-to-subtree))
-  (goto-char (point-max)))
-
-(setq org-capture-templates '(("j" "Journal entry" plain (function org-journal-find-location)
-                               "** %(format-time-string org-journal-time-format)%^{Title}\n%i%?"
-                               :jump-to-captured t :immediate-finish t)))
-
-;; (setq smooth-scroll-margin 0
-;;       scroll-margin 1
-;;       scroll-conservatively 10
-;;       mouse-wheel-scroll-amount '(1 ((shift) . 1))
-;;       mouse-wheel-progressive-speed nil
-;;       mouse-wheel-follow-mouse 't
-;;       scroll-step 2)
-
-;; (unless (display-graphic-p)
-;;   (defun scroll-mouse-up ()
-;;     (interactive)
-;;     (scroll-up 2))
-;;   (defun scroll-mouse-down ()
-;;     (interactive)
-;;     (scroll-down 2))
-;;   ;; activate mouse-based scrolling
-;;   (xterm-mouse-mode 1)
-
-;;   (global-set-key (kbd "<mouse-4>") 'scroll-mouse-down)
-;;   (global-set-key (kbd "<mouse-5>") 'scroll-mouse-up))
-
-;; (use-package vterm :straight t)
-
-
-(setq ad-redefinition-action 'accept)
-(put 'magit-clean 'disabled nil)
+  (setq lsp-rust-server 'rust-analyzer
+        lsp-rust-unstable-features t
+        lsp-rust-analyzer-proc-macro-enable t
+        read-process-output-max (* 4096 1024)
+        lsp-idle-delay 1.500
+        lsp-completion-provider :capf
+        lsp-lens-enable nil
+        lsp-ui-sideline-enable nil
+        lsp-ui-sideline-show-hover nil
+        lsp-enable-file-watchers nil
+        lsp-log-io nil
+        gc-cons-threshold (eval-when-compile (* 256 1024 1024)))
+  :hook ((crystal-mode . lsp)
+         (tuareg-mode . lsp)
+         (kotlin-mode . lsp)
+         (prolog-mode . lsp)
+         (typescript-mode . lsp)
+         (js-mode . lsp)
+         (rust-mode . lsp)
+         (haskell-mode . lsp)
+         (go-mode . lsp)
+         (prolog-mode . lsp)
+         (scala-mode . lsp)
+         (lsp-mode . lsp-enable-which-key-integration))
+  :commands lsp)
+
+;; tooling outside above
+(progn
+  (use-package restclient :straight t :defer t)
+  (add-to-list 'auto-mode-alist '("\\.http$'" . restclient-mode))
+  (use-package ob-restclient :straight t :defer t))

(add-to-list 'term-file-aliases '("alacritty" . "xterm"))

(setq auto-window-vscroll nil)
(global-auto-revert-mode t)
(menu-bar-mode -1)
;; (tool-bar-mode -1)
;; (scroll-bar-mode -1)
(global-linum-mode t)

(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
  (load custom-file))

(setq straight-recipes-gnu-elpa-use-mirror    t
      straight-repository-branch              "develop"
      straight-enable-use-package-integration t
      warning-minimum-level :error)

(defvar bootstrap-version)

(defconst default-snapshot-dir (expand-file-name "snapshots" user-emacs-directory))

(add-hook 'before-save-hook 'delete-trailing-whitespace)

(setq-default indent-tabs-mode nil
              tab-width 3)

(setq inhibit-startup-screen t
      initial-scratch-message nil
      initial-major-mode 'text-mode
      make-backup-files nil

      kept-old-versions 2
      version-control t)

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(require 'package)
(add-to-list 'package-archives
	     '("melpa" . "https://melpa.org/packages/"))

(progn
  (use-package poet-theme :straight t)
  (use-package mood-one-theme :straight t)
  (use-package github-theme :straight t)
  (use-package avk-emacs-themes :straight t)
  (use-package ayu-theme :straight t))

(load-theme 'github t)

(use-package prescient :straight t :defer t
  :config (prescient-persist-mode +1))

(use-package ivy :straight t :demand t :diminish ivy-mode
  :init
  (setq ivy-use-virtual-buffers t
        ivy-initial-inputs-alist nil
        ivy-re-builders-alist '((t . ivy--regex-fuzzy))
        ivy-extra-directories nil)
  :config
  (define-key ivy-minibuffer-map (kbd "C-l") (kbd "DEL"))
  (use-package flx :straight t :defer t)
  (use-package ivy-prescient :straight t :defer t)
  (ivy-mode)
  (ivy-prescient-mode)
  :bind (("C-c C-r" . ivy-resume)
         ("<f6>"    . ivy-resume)
         ("s-b"     . ivy-switch-buffer)
         :map ivy-minibuffer-map
         ("TAB"     . ivy-alt-done)
         ("<escape>" . minibuffer-keyboard-quit)
         ("C-j"      . ivy-next-line)
         ("C-k"      . ivy-previous-line)))

(use-package swiper :straight t
  :config
  (global-set-key "\C-s" 'swiper))

(use-package deadgrep :straight t :bind (("C-c C-s" . deadgrep)))

(use-package company
  :straight t
  :diminish
  :config
  (global-company-mode t)
  (setq ;; Only 2 letters required for completion to activate.
        company-minimum-prefix-length 3
        ;; Search other buffers for completion candidates
        company-dabbrev-other-buffers t
        company-dabbrev-code-other-buffers t
