Compare commits
3 Commits
2c7518fa76
...
a28f84ae1e
Author | SHA1 | Date | |
---|---|---|---|
a28f84ae1e | |||
1ff9236250 | |||
20a68e5755 |
@ -36,7 +36,13 @@
|
|||||||
(goto-char mb)
|
(goto-char mb)
|
||||||
(sp--looking-back-p "=" 1))))
|
(sp--looking-back-p "=" 1))))
|
||||||
|
|
||||||
|
(defun sp-web-mode-is-code-context (id action context)
|
||||||
|
(and (eq action 'insert)
|
||||||
|
(not (or (get-text-property (point) 'part-side)
|
||||||
|
(get-text-property (point) 'block-side)))))
|
||||||
|
|
||||||
(sp-local-pair '(web-mode) "<" nil
|
(sp-local-pair '(web-mode) "<" nil
|
||||||
|
:when '(sp-web-mode-is-code-context)
|
||||||
:unless '(:add sp-after-equals-p)
|
:unless '(:add sp-after-equals-p)
|
||||||
:skip-match 'sp-after-equals-skip-p)
|
:skip-match 'sp-after-equals-skip-p)
|
||||||
:hook
|
:hook
|
||||||
|
@ -8,6 +8,22 @@
|
|||||||
(defvar-local run-command-project-local-commands nil)
|
(defvar-local run-command-project-local-commands nil)
|
||||||
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
|
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
|
||||||
:config
|
:config
|
||||||
|
;; Add ability to edit command line with prefix arg
|
||||||
|
(defvar run-command-edit? nil)
|
||||||
|
|
||||||
|
(defun run-command-core-run-advice (orig-fun command-spec &rest args)
|
||||||
|
(let ((spec (if run-command-edit?
|
||||||
|
(plist-put command-spec :command-line (read-string "Command: " (plist-get command-spec :command-line)))
|
||||||
|
command-spec)))
|
||||||
|
(apply orig-fun spec args)))
|
||||||
|
|
||||||
|
(defun run-command-advice (orig-fun &rest args)
|
||||||
|
(let ((run-command-edit? (not (null current-prefix-arg))))
|
||||||
|
(apply orig-fun args)))
|
||||||
|
|
||||||
|
(advice-add 'run-command :around #'run-command-advice)
|
||||||
|
(advice-add 'run-command-core-run :around #'run-command-core-run-advice)
|
||||||
|
|
||||||
(defun run-command-recipe-terraform ()
|
(defun run-command-recipe-terraform ()
|
||||||
(when (directory-files default-directory
|
(when (directory-files default-directory
|
||||||
nil
|
nil
|
||||||
@ -385,7 +401,8 @@
|
|||||||
|
|
||||||
(defun run-command-recipe-rspec ()
|
(defun run-command-recipe-rspec ()
|
||||||
(when
|
(when
|
||||||
(and (derived-mode-p 'ruby-mode)
|
(and (or (derived-mode-p 'ruby-mode)
|
||||||
|
(derived-mode-p 'ruby-ts-mode))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(re-search-forward "RSpec" nil t)))
|
(re-search-forward "RSpec" nil t)))
|
||||||
|
@ -26,42 +26,31 @@
|
|||||||
(dolist (lang (mapcar #'car treesit-language-source-alist))
|
(dolist (lang (mapcar #'car treesit-language-source-alist))
|
||||||
(treesit-install-language-grammar lang)))
|
(treesit-install-language-grammar lang)))
|
||||||
|
|
||||||
(defvar treesit-langs-by-mode '((sh-mode . bash)
|
(defvar treesit-langs-mode-overrides '((sh-mode . bash)
|
||||||
(sh-ts-mode . bash)
|
(sh-ts-mode . bash)
|
||||||
(cmake-mode . cmake)
|
(css-mode . css)
|
||||||
(cmake-ts-mode . cmake)
|
(emacs-lisp-mode . elisp)
|
||||||
(css-mode . css)
|
(emacs-lisp-ts-mode . elisp)
|
||||||
(css-ts-mode . css)
|
(js-mode . javascript)
|
||||||
(emacs-lisp-mode . elisp)
|
(js-ts-mode . javascript)
|
||||||
(emacs-lisp-ts-mode . elisp)
|
(json-mode . json)
|
||||||
(go-mode . go)
|
(makefile-mode . make)
|
||||||
(go-ts-mode . go)
|
(makefile-ts-mode . make)))
|
||||||
(html-mode . html)
|
|
||||||
(html-ts-mode . html)
|
|
||||||
(js-mode . javascript)
|
|
||||||
(js-ts-mode . javascript)
|
|
||||||
(json-mode . json)
|
|
||||||
(json-ts-mode . json)
|
|
||||||
(makefile-mode . make)
|
|
||||||
(makefile-ts-mode . make)
|
|
||||||
(markdown-mode . markdown)
|
|
||||||
(markdown-ts-mode . markdown)
|
|
||||||
(python-mode . python)
|
|
||||||
(python-ts-mode . python)
|
|
||||||
(ruby-mode . ruby)
|
|
||||||
(ruby-ts-mode . ruby)
|
|
||||||
(toml-mode . toml)
|
|
||||||
(toml-ts-mode . toml)
|
|
||||||
(typescript-mode . typescript)
|
|
||||||
(typescript-ts-mode . typescript)
|
|
||||||
(yaml-mode . yaml)
|
|
||||||
(yaml-ts-mode . yaml)
|
|
||||||
(astro-mode . astro)
|
|
||||||
(astro-ts-mode . astro)))
|
|
||||||
|
|
||||||
|
(defun treesit-parse-lang-from-mode (mode)
|
||||||
|
(let* ((mode (if (symbolp mode) (symbol-name mode) mode))
|
||||||
|
(lang (save-match-data
|
||||||
|
(string-match "\\(.*?\\)\\(-ts\\)?-mode" mode)
|
||||||
|
(match-string 1 mode))))
|
||||||
|
(intern lang)))
|
||||||
|
|
||||||
|
(defun treesit-lang-for-mode (mode)
|
||||||
|
(or (cdr (assoc mode treesit-langs-mode-overrides))
|
||||||
|
(treesit-parse-lang-from-mode mode)
|
||||||
|
(error "Unable to determine tree-sitter parser for %s" mode)))
|
||||||
|
|
||||||
(defun treesit-parser ()
|
(defun treesit-parser ()
|
||||||
(if-let ((lang (cdr (assoc major-mode treesit-langs-by-mode))))
|
(if-let ((lang (treesit-lang-for-mode major-mode)))
|
||||||
(treesit-parser-create lang (current-buffer))
|
(treesit-parser-create lang (current-buffer))
|
||||||
(user-error "No tree-sitter parser for %s" major-mode)))
|
(user-error "No tree-sitter parser for %s" major-mode)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user