Compare commits

...

3 Commits

3 changed files with 46 additions and 34 deletions

View File

@ -36,7 +36,13 @@
(goto-char mb)
(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
:when '(sp-web-mode-is-code-context)
:unless '(:add sp-after-equals-p)
:skip-match 'sp-after-equals-skip-p)
:hook

View File

@ -8,6 +8,22 @@
(defvar-local run-command-project-local-commands nil)
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
: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 ()
(when (directory-files default-directory
nil
@ -385,7 +401,8 @@
(defun run-command-recipe-rspec ()
(when
(and (derived-mode-p 'ruby-mode)
(and (or (derived-mode-p 'ruby-mode)
(derived-mode-p 'ruby-ts-mode))
(save-excursion
(goto-char (point-min))
(re-search-forward "RSpec" nil t)))

View File

@ -26,42 +26,31 @@
(dolist (lang (mapcar #'car treesit-language-source-alist))
(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)
(cmake-mode . cmake)
(cmake-ts-mode . cmake)
(css-mode . css)
(css-ts-mode . css)
(emacs-lisp-mode . elisp)
(emacs-lisp-ts-mode . elisp)
(go-mode . go)
(go-ts-mode . go)
(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)))
(makefile-ts-mode . make)))
(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 ()
(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))
(user-error "No tree-sitter parser for %s" major-mode)))