Merge branch 'master' of github.com:AntoninRuan/dotfiles
This commit is contained in:
87
.emacs
87
.emacs
@@ -193,9 +193,9 @@
|
||||
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
|
||||
(global-set-key (kbd "C-S-n") 'mc/mark-next-like-this)
|
||||
(global-set-key (kbd "C-S-p") 'mc/mark-previous-like-this)
|
||||
;(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
|
||||
;(global-set-key (kbd "C-\"") 'mc/skip-to-next-like-this)
|
||||
;(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
|
||||
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
|
||||
(global-set-key (kbd "C-!") 'mc/skip-to-next-like-this)
|
||||
(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
|
||||
|
||||
;;; markdown
|
||||
(rc/require 'markdown-mode 'impatient-mode 'simple-httpd)
|
||||
@@ -293,7 +293,69 @@
|
||||
|
||||
;;; Typescript
|
||||
(rc/require 'typescript-mode)
|
||||
(add-to-list 'auto-mode-alist '("\\.mts\\'" . typescript-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))
|
||||
|
||||
(use-package treesit
|
||||
:mode (("\\.tsx\\'" . tsx-ts-mode)
|
||||
("\\.js\\'" . typescript-ts-mode)
|
||||
("\\.mjs\\'" . typescript-ts-mode)
|
||||
("\\.mts\\'" . typescript-ts-mode)
|
||||
("\\.cjs\\'" . typescript-ts-mode)
|
||||
("\\.ts\\'" . typescript-ts-mode)
|
||||
("\\.jsx\\'" . tsx-ts-mode)
|
||||
("\\.json\\'" . json-ts-mode)
|
||||
("\\.Dockerfile\\'" . dockerfile-ts-mode)
|
||||
("\\.prisma\\'" . prisma-ts-mode)
|
||||
;; More modes defined here...
|
||||
)
|
||||
:preface
|
||||
(defun os/setup-install-grammars ()
|
||||
"Install Tree-sitter grammars if they are absent."
|
||||
(interactive)
|
||||
(dolist (grammar
|
||||
'((css . ("https://github.com/tree-sitter/tree-sitter-css" "v0.20.0"))
|
||||
(bash "https://github.com/tree-sitter/tree-sitter-bash")
|
||||
(html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.20.1"))
|
||||
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2" "src"))
|
||||
(json . ("https://github.com/tree-sitter/tree-sitter-json" "v0.20.2"))
|
||||
(python . ("https://github.com/tree-sitter/tree-sitter-python" "v0.20.4"))
|
||||
(go "https://github.com/tree-sitter/tree-sitter-go" "v0.20.0")
|
||||
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
|
||||
(make "https://github.com/alemuller/tree-sitter-make")
|
||||
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
|
||||
(cmake "https://github.com/uyha/tree-sitter-cmake")
|
||||
(c "https://github.com/tree-sitter/tree-sitter-c")
|
||||
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
|
||||
(toml "https://github.com/tree-sitter/tree-sitter-toml")
|
||||
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.20.3" "tsx/src"))
|
||||
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.20.3" "typescript/src"))
|
||||
(yaml . ("https://github.com/ikatyang/tree-sitter-yaml" "v0.5.0"))
|
||||
(prisma "https://github.com/victorhqc/tree-sitter-prisma")))
|
||||
(add-to-list 'treesit-language-source-alist grammar)
|
||||
;; Only install `grammar' if we don't already have it
|
||||
;; installed. However, if you want to *update* a grammar then
|
||||
;; this obviously prevents that from happening.
|
||||
(unless (treesit-language-available-p (car grammar))
|
||||
(treesit-install-language-grammar (car grammar)))))
|
||||
|
||||
;; Optional, but recommended. Tree-sitter enabled major modes are
|
||||
;; distinct from their ordinary counterparts.
|
||||
;;
|
||||
;; You can remap major modes with `major-mode-remap-alist'. Note
|
||||
;; that this does *not* extend to hooks! Make sure you migrate them
|
||||
;; also
|
||||
(dolist (mapping
|
||||
'((css-mode . css-ts-mode)
|
||||
(typescript-mode . typescript-ts-mode)
|
||||
(js-mode . typescript-ts-mode)
|
||||
(js2-mode . typescript-ts-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(json-mode . json-ts-mode)
|
||||
(js-json-mode . json-ts-mode)))
|
||||
(add-to-list 'major-mode-remap-alist mapping))
|
||||
:config
|
||||
(os/setup-install-grammars))
|
||||
|
||||
;;; Tide
|
||||
(rc/require 'tide)
|
||||
@@ -364,10 +426,19 @@
|
||||
'helm-xref)
|
||||
|
||||
(which-key-mode)
|
||||
(setq lsp-keymap-prefix "s-i")
|
||||
(add-hook 'c-mode-hook 'lsp)
|
||||
(add-hook 'c++-mode-hook 'lsp)
|
||||
(add-hook 'python-mode 'lsp)
|
||||
(use-package lsp-mode
|
||||
:ensure t
|
||||
:hook ((c-mode
|
||||
c++-mode
|
||||
python-mode
|
||||
tsx-ts-mode
|
||||
typescript-ts-mode
|
||||
) . lsp-deferred)
|
||||
:custom
|
||||
(lsp-keymap-prefix "s-i")
|
||||
(lsp-keep-workspace-alive nil)
|
||||
(lsp-enable-xref t)
|
||||
)
|
||||
|
||||
;;; zoxide
|
||||
(rc/require 'zoxide)
|
||||
|
||||
Reference in New Issue
Block a user