Update README.md
This commit is contained in:
139
README.md
139
README.md
@@ -73,6 +73,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's
|
|||||||
- [Configuring org-mode](#configuring-org-mode)
|
- [Configuring org-mode](#configuring-org-mode)
|
||||||
- [Configuring markdown-mode (e.g., README.md syntax)](#configuring-markdown-mode-eg-readmemd-syntax)
|
- [Configuring markdown-mode (e.g., README.md syntax)](#configuring-markdown-mode-eg-readmemd-syntax)
|
||||||
- [Tree-sitter Integration (Better Syntax Highlighting)](#tree-sitter-integration-better-syntax-highlighting)
|
- [Tree-sitter Integration (Better Syntax Highlighting)](#tree-sitter-integration-better-syntax-highlighting)
|
||||||
|
- [Treemacs, a tree layout file explorer (Sidebar file explorer)](#treemacs-a-tree-layout-file-explorer-sidebar-file-explorer)
|
||||||
- [Inhibit the mouse](#inhibit-the-mouse)
|
- [Inhibit the mouse](#inhibit-the-mouse)
|
||||||
- [Spell checker](#spell-checker)
|
- [Spell checker](#spell-checker)
|
||||||
- [Asynchronous code formatting without cursor disruption](#asynchronous-code-formatting-without-cursor-disruption)
|
- [Asynchronous code formatting without cursor disruption](#asynchronous-code-formatting-without-cursor-disruption)
|
||||||
@@ -878,7 +879,7 @@ This configuration sets up `markdown-mode` with deferred loading to improve star
|
|||||||
|
|
||||||
### Tree-sitter Integration (Better Syntax Highlighting)
|
### Tree-sitter Integration (Better Syntax Highlighting)
|
||||||
|
|
||||||
Tree-sitter in Emacs is an incremental parsing system introduced in Emacs 29 that provides precise, high-performance syntax analysis and highlighting by constructing concrete syntax trees from source code. It supports a broad set of programming languages, including Bash, C, C++, C#, CMake, CSS, Dockerfile, Go, Java, JavaScript, JSON, Python, Rust, TOML, TypeScript, YAML, Elisp, Lua, Markdown, and many others. Unlike traditional font-lock, which relies on regular expressions, Tree-sitter uses formal grammar definitions to build real-time parse trees, enabling accurate syntax highlighting, structural navigation, code folding, and foundational support for advanced editing features like refactoring.
|
Tree-sitter is an incremental parsing system introduced in Emacs 29 that provides precise, high-performance syntax analysis and highlighting by constructing concrete syntax trees from source code. It supports a broad set of programming languages, including Bash, C, C++, C#, CMake, CSS, Dockerfile, Go, Java, JavaScript, JSON, Python, Rust, TOML, TypeScript, YAML, Elisp, Lua, Markdown, and many others. Unlike traditional font-lock, which relies on regular expressions, Tree-sitter uses formal grammar definitions to build real-time parse trees, enabling accurate syntax highlighting, structural navigation, code folding, and foundational support for advanced editing features like refactoring.
|
||||||
|
|
||||||
The configuration below enables Tree-sitter support using the [treesit-auto](https://github.com/renzmann/treesit-auto) package. Setting `treesit-auto-add-to-auto-mode-alist` to `'all` ensures that all available Tree-sitter modes are automatically activated for their corresponding file types. Enabling `global-treesit-auto-mode` applies this behavior globally, improving syntax accuracy and consistency across supported languages.
|
The configuration below enables Tree-sitter support using the [treesit-auto](https://github.com/renzmann/treesit-auto) package. Setting `treesit-auto-add-to-auto-mode-alist` to `'all` ensures that all available Tree-sitter modes are automatically activated for their corresponding file types. Enabling `global-treesit-auto-mode` applies this behavior globally, improving syntax accuracy and consistency across supported languages.
|
||||||
|
|
||||||
@@ -899,6 +900,142 @@ To enable Tree-sitter, add the following to your `~/.emacs.d/post-init.el`:
|
|||||||
(global-treesit-auto-mode))
|
(global-treesit-auto-mode))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Treemacs, a tree layout file explorer (Sidebar file explorer)
|
||||||
|
|
||||||
|
The [treemacs](https://github.com/Alexander-Miller/treemacs) package is a file and project explorer for Emacs that provides a visually structured tree layout similar to file browsers in modern IDEs. It integrates well with various Emacs packages such as `projectile`, `lsp-mode`, and `magit`, allowing users to navigate their project structure efficiently.
|
||||||
|
|
||||||
|
[[file:]]
|
||||||
|

|
||||||
|
|
||||||
|
To configure **treemacs**, add the following to `~/.emacs.d/post-init.el`:
|
||||||
|
```elisp
|
||||||
|
(use-package treemacs
|
||||||
|
:commands (treemacs
|
||||||
|
treemacs-select-window
|
||||||
|
treemacs-delete-other-windows
|
||||||
|
treemacs-select-directory
|
||||||
|
treemacs-bookmark
|
||||||
|
treemacs-find-file
|
||||||
|
treemacs-find-tag)
|
||||||
|
|
||||||
|
:bind
|
||||||
|
(:map global-map
|
||||||
|
("M-0" . treemacs-select-window)
|
||||||
|
("C-x t 1" . treemacs-delete-other-windows)
|
||||||
|
("C-x t t" . treemacs)
|
||||||
|
("C-x t d" . treemacs-select-directory)
|
||||||
|
("C-x t B" . treemacs-bookmark)
|
||||||
|
("C-x t C-t" . treemacs-find-file)
|
||||||
|
("C-x t M-t" . treemacs-find-tag))
|
||||||
|
|
||||||
|
:init
|
||||||
|
(with-eval-after-load 'winum
|
||||||
|
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
||||||
|
|
||||||
|
:config
|
||||||
|
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
|
||||||
|
treemacs-deferred-git-apply-delay 0.5
|
||||||
|
treemacs-directory-name-transformer #'identity
|
||||||
|
treemacs-display-in-side-window t
|
||||||
|
treemacs-eldoc-display 'simple
|
||||||
|
treemacs-file-event-delay 2000
|
||||||
|
treemacs-file-extension-regex treemacs-last-period-regex-value
|
||||||
|
treemacs-file-follow-delay 0.2
|
||||||
|
treemacs-file-name-transformer #'identity
|
||||||
|
treemacs-follow-after-init t
|
||||||
|
treemacs-expand-after-init t
|
||||||
|
treemacs-find-workspace-method 'find-for-file-or-pick-first
|
||||||
|
treemacs-git-command-pipe ""
|
||||||
|
treemacs-goto-tag-strategy 'refetch-index
|
||||||
|
treemacs-header-scroll-indicators '(nil . "^^^^^^")
|
||||||
|
treemacs-hide-dot-git-directory t
|
||||||
|
treemacs-indentation 2
|
||||||
|
treemacs-indentation-string " "
|
||||||
|
treemacs-is-never-other-window nil
|
||||||
|
treemacs-max-git-entries 5000
|
||||||
|
treemacs-missing-project-action 'ask
|
||||||
|
treemacs-move-files-by-mouse-dragging t
|
||||||
|
treemacs-move-forward-on-expand nil
|
||||||
|
treemacs-no-png-images nil
|
||||||
|
treemacs-no-delete-other-windows t
|
||||||
|
treemacs-project-follow-cleanup nil
|
||||||
|
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
|
||||||
|
treemacs-position 'left
|
||||||
|
treemacs-read-string-input 'from-child-frame
|
||||||
|
treemacs-recenter-distance 0.1
|
||||||
|
treemacs-recenter-after-file-follow nil
|
||||||
|
treemacs-recenter-after-tag-follow nil
|
||||||
|
treemacs-recenter-after-project-jump 'always
|
||||||
|
treemacs-recenter-after-project-expand 'on-distance
|
||||||
|
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
|
||||||
|
treemacs-project-follow-into-home nil
|
||||||
|
treemacs-show-cursor nil
|
||||||
|
treemacs-show-hidden-files t
|
||||||
|
treemacs-silent-filewatch nil
|
||||||
|
treemacs-silent-refresh nil
|
||||||
|
treemacs-sorting 'alphabetic-asc
|
||||||
|
treemacs-select-when-already-in-treemacs 'move-back
|
||||||
|
treemacs-space-between-root-nodes t
|
||||||
|
treemacs-tag-follow-cleanup t
|
||||||
|
treemacs-tag-follow-delay 1.5
|
||||||
|
treemacs-text-scale nil
|
||||||
|
treemacs-user-mode-line-format nil
|
||||||
|
treemacs-user-header-line-format nil
|
||||||
|
treemacs-wide-toggle-width 70
|
||||||
|
treemacs-width 35
|
||||||
|
treemacs-width-increment 1
|
||||||
|
treemacs-width-is-initially-locked t
|
||||||
|
treemacs-workspace-switch-cleanup nil)
|
||||||
|
|
||||||
|
;; The default width and height of the icons is 22 pixels. If you are
|
||||||
|
;; using a Hi-DPI display, uncomment this to double the icon size.
|
||||||
|
;; (treemacs-resize-icons 44)
|
||||||
|
|
||||||
|
(treemacs-follow-mode t)
|
||||||
|
(treemacs-filewatch-mode t)
|
||||||
|
(treemacs-fringe-indicator-mode 'always)
|
||||||
|
|
||||||
|
;;(when treemacs-python-executable
|
||||||
|
;; (treemacs-git-commit-diff-mode t))
|
||||||
|
|
||||||
|
(pcase (cons (not (null (executable-find "git")))
|
||||||
|
(not (null treemacs-python-executable)))
|
||||||
|
(`(t . t)
|
||||||
|
(treemacs-git-mode 'deferred))
|
||||||
|
(`(t . _)
|
||||||
|
(treemacs-git-mode 'simple)))
|
||||||
|
|
||||||
|
(treemacs-hide-gitignored-files-mode nil))
|
||||||
|
|
||||||
|
;;(use-package treemacs-evil
|
||||||
|
;; :after (treemacs evil)
|
||||||
|
;; :ensure t)
|
||||||
|
;;
|
||||||
|
;; (use-package treemacs-projectile
|
||||||
|
;; :after (treemacs projectile)
|
||||||
|
;; :ensure t)
|
||||||
|
;;
|
||||||
|
;; (use-package treemacs-icons-dired
|
||||||
|
;; :hook (dired-mode . treemacs-icons-dired-enable-once)
|
||||||
|
;; :ensure t)
|
||||||
|
;;
|
||||||
|
;; (use-package treemacs-magit
|
||||||
|
;; :after (treemacs magit)
|
||||||
|
;; :ensure t)
|
||||||
|
;;
|
||||||
|
;; (use-package treemacs-persp ; treemacs-perspective if you use perspective.el vs. persp-mode
|
||||||
|
;; :after (treemacs persp-mode) ;;or perspective vs. persp-mode
|
||||||
|
;; :ensure t
|
||||||
|
;; :config (treemacs-set-scope-type 'Perspectives))
|
||||||
|
;;
|
||||||
|
;;(use-package treemacs-tab-bar ; treemacs-tab-bar if you use tab-bar-mode
|
||||||
|
;; :after (treemacs)
|
||||||
|
;; :ensure t
|
||||||
|
;; :config (treemacs-set-scope-type 'Tabs))
|
||||||
|
;;
|
||||||
|
;; (treemacs-start-on-boot)
|
||||||
|
```
|
||||||
|
|
||||||
### Inhibit the mouse
|
### Inhibit the mouse
|
||||||
|
|
||||||
The [inhibit-mouse](https://github.com/jamescherti/inhibit-mouse.el) package disables mouse input in Emacs.
|
The [inhibit-mouse](https://github.com/jamescherti/inhibit-mouse.el) package disables mouse input in Emacs.
|
||||||
|
|||||||
Reference in New Issue
Block a user