LSP / treemacs / Helm / vterm and more
This commit is contained in:
+210
-50
@@ -16,7 +16,7 @@
|
|||||||
'(("GNU ELPA" . 10)
|
'(("GNU ELPA" . 10)
|
||||||
("MELPA" . 5)
|
("MELPA" . 5)
|
||||||
("MELPA Stable" . 0)))
|
("MELPA Stable" . 0)))
|
||||||
|
(add-to-list 'load-path "~/.emacs.default/git-packages")
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Theme
|
** Theme
|
||||||
@@ -32,16 +32,44 @@
|
|||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Completion
|
* Completion
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(use-package vertico)
|
** Yas-snippet
|
||||||
(use-package consult)
|
#+begin_src emacs-lisp
|
||||||
(use-package marginalia)
|
(use-package yasnippet
|
||||||
#+END_SRC
|
:ensure t
|
||||||
|
:config
|
||||||
|
(yas-global-mode 1))
|
||||||
|
(use-package yasnippet-snippets
|
||||||
|
:ensure t)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Helm
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package helm
|
||||||
|
:config (require 'helm-autoloads))
|
||||||
|
(global-set-key (kbd "M-x") #'helm-M-x)
|
||||||
|
(helm-mode 1)
|
||||||
|
|
||||||
|
(setq helm-recentf-fuzzy-match t
|
||||||
|
helm-locate-fuzzy-match nil ;; locate fuzzy is worthless
|
||||||
|
helm-M-x-fuzzy-match t
|
||||||
|
helm-buffers-fuzzy-matching t
|
||||||
|
helm-semantic-fuzzy-match t
|
||||||
|
helm-apropos-fuzzy-match t
|
||||||
|
helm-imenu-fuzzy-match t
|
||||||
|
helm-lisp-fuzzy-completion t
|
||||||
|
helm-completion-in-region-fuzzy-match t)
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Company
|
** Company
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(use-package company)
|
(use-package company
|
||||||
(company-mode 1)
|
:hook
|
||||||
|
(after-init . global-company-mode))
|
||||||
|
(use-package company-box
|
||||||
|
:hook
|
||||||
|
(company-mode . company-box-mode))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Smart parenthesis
|
** Smart parenthesis
|
||||||
@@ -56,37 +84,48 @@
|
|||||||
|
|
||||||
** LSP
|
** LSP
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp
|
(use-package lsp-mode
|
||||||
projectile hydra flycheck company avy which-key helm-xref dap-mode))
|
:init
|
||||||
|
;;set prefix
|
||||||
|
(setq lsp-keymap-prefix "C-c l")
|
||||||
|
(setq lsp-diagnostics-provider :flycheck) ; Use flycheck for diagnostics
|
||||||
|
(setq lsp-enable-snippet t) ; Enable snippet support
|
||||||
|
(setq company-idle-delay 0.2) ; Set delay for completion pop-up
|
||||||
|
(setq company-minimum-prefix-length 1)
|
||||||
|
(setq lsp-clients-clangd-executable "clangd")
|
||||||
|
|
||||||
(when (cl-find-if-not #'package-installed-p package-selected-packages)
|
:hook
|
||||||
(package-refresh-contents)
|
((c-mode . lsp)
|
||||||
(mapc #'package-install package-selected-packages))
|
(latex-mode . lsp)
|
||||||
|
(python-mode . lsp)
|
||||||
|
(lsp-mode . lsp-enable-which-key-integration)
|
||||||
|
(before-save . lsp-format-buffer))
|
||||||
|
:commands lsp
|
||||||
|
:bind
|
||||||
|
("C-<return>" . ff-find-other-file))
|
||||||
|
(use-package lsp-ui
|
||||||
|
:init
|
||||||
|
(setq lsp-ui-doc-enable t
|
||||||
|
lsp-ui-position 'at-point)
|
||||||
|
:hook
|
||||||
|
(lsp-mode . lsp-ui-mode))
|
||||||
|
|
||||||
;; sample `helm' configuration use https://github.com/emacs-helm/helm/ for details
|
(use-package helm-lsp
|
||||||
(helm-mode)
|
:commands helm-lsp-workspace-symbol)
|
||||||
(require 'helm-xref)
|
|
||||||
(define-key global-map [remap find-file] #'helm-find-files)
|
|
||||||
(define-key global-map [remap execute-extended-command] #'helm-M-x)
|
|
||||||
(define-key global-map [remap switch-to-buffer] #'helm-mini)
|
|
||||||
|
|
||||||
(which-key-mode)
|
|
||||||
(add-hook 'c-mode-hook 'lsp)
|
|
||||||
(add-hook 'c++-mode-hook 'lsp)
|
|
||||||
|
|
||||||
(setq gc-cons-threshold (* 100 1024 1024)
|
|
||||||
read-process-output-max (* 1024 1024)
|
|
||||||
treemacs-space-between-root-nodes nil
|
|
||||||
company-idle-delay 0.0
|
|
||||||
company-minimum-prefix-length 1
|
|
||||||
lsp-idle-delay 0.1) ;; clangd is fast
|
|
||||||
|
|
||||||
(with-eval-after-load 'lsp-mode
|
|
||||||
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
|
|
||||||
(require 'dap-cpptools)
|
|
||||||
(yas-global-mode))
|
|
||||||
|
|
||||||
|
(use-package which-key
|
||||||
|
:config
|
||||||
|
(which-key-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Eglot
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package eglot)
|
||||||
|
(add-to-list 'eglot-server-programs '((c-mode) "clangd"))
|
||||||
|
(add-hook 'c-mode-hook 'eglot-ensure)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Key-binds
|
* Key-binds
|
||||||
** C
|
** C
|
||||||
*** Dereference arrow
|
*** Dereference arrow
|
||||||
@@ -104,14 +143,6 @@
|
|||||||
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
*** Jump to def
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defun go-to-definition ()
|
|
||||||
if (eq major-mode 'c-mode)
|
|
||||||
('ff-find-other-file))
|
|
||||||
(keymap-local-set "C-<return>" 'go-to-definition)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Reload config
|
** Reload config
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
@@ -145,6 +176,12 @@
|
|||||||
(keymap-global-set "C-x à" 'delete-window)
|
(keymap-global-set "C-x à" 'delete-window)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** Switch window
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(keymap-global-set "C-x :" 'next-window-any-frame)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Org
|
* Org
|
||||||
|
|
||||||
** Org bullets
|
** Org bullets
|
||||||
@@ -219,19 +256,138 @@
|
|||||||
'(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
|
'(org-verbatim ((t (:inherit (shadow fixed-pitch))))))
|
||||||
#+end_src
|
#+end_src
|
||||||
* Terminal
|
* Terminal
|
||||||
#+begin_src
|
#+begin_src emacs-lisp
|
||||||
(use-package vterm)
|
(use-package vterm)
|
||||||
|
#+end_src
|
||||||
|
* Treemacs
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package treemacs
|
||||||
|
:ensure t
|
||||||
|
:defer t
|
||||||
|
:init
|
||||||
|
(with-eval-after-load 'winum
|
||||||
|
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
|
||||||
|
:config
|
||||||
|
(progn
|
||||||
|
(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))
|
||||||
|
: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)))
|
||||||
|
|
||||||
|
(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))
|
||||||
|
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
* Misceleaneous
|
* Misceleaneous
|
||||||
|
|
||||||
** Tool bar
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
(tool-bar-mode -1)
|
|
||||||
#+END_SRC
|
|
||||||
** Menu bar
|
** Menu bar
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
** Tool bar
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(tool-bar-mode -1)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
** Scroll bar
|
** Scroll bar
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(scroll-bar-mode -1)
|
(scroll-bar-mode -1)
|
||||||
@@ -241,4 +397,8 @@
|
|||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(set-face-attribute 'default nil :family "Cascadia Mono" :height 200)
|
(set-face-attribute 'default nil :family "Cascadia Mono" :height 200)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
** Icons
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package all-the-icons
|
||||||
|
:if (display-graphic-p))
|
||||||
|
#+end_src
|
||||||
|
|||||||
Reference in New Issue
Block a user