Compare commits
3 Commits
ce43480bb5
...
baf34a00e9
Author | SHA1 | Date | |
---|---|---|---|
|
baf34a00e9 | ||
|
8ba027565b | ||
|
af3b0669c7 |
@ -1740,6 +1740,7 @@ A function to kill all buffers except the current one from [[https://www.emacswi
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(leader-def-key "!" 'shell-command)
|
||||
(leader-def-key "|" 'shell-command-on-region)
|
||||
(general-def 'normal shell-mode-map "q" #'bury-buffer)
|
||||
#+END_SRC
|
||||
|
||||
** Toggles
|
||||
@ -6512,6 +6513,11 @@ current buffer:
|
||||
(use-package run-command
|
||||
:straight (run-command :host github :repo "bard/emacs-run-command"
|
||||
:fork (:host github :repo "jdormit/emacs-run-command" :branch "master"))
|
||||
:init
|
||||
(defvar-local run-command-local-commands nil)
|
||||
(put 'run-command-local-commands 'safe-local-variable (lambda (_) t))
|
||||
(defvar-local run-command-project-local-commands nil)
|
||||
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
|
||||
:config
|
||||
(defun run-command-recipe-terraform ()
|
||||
(when (directory-files default-directory
|
||||
@ -6529,9 +6535,6 @@ current buffer:
|
||||
(list :command-name "destroy"
|
||||
:command-line "terraform destroy"))))
|
||||
|
||||
(defvar-local run-command-local-commands nil)
|
||||
(put 'run-command-local-commands 'safe-local-variable (lambda (_) t))
|
||||
|
||||
(defun run-command-recipe-local ()
|
||||
(when run-command-local-commands
|
||||
(mapcar (cl-function
|
||||
@ -6600,9 +6603,6 @@ current buffer:
|
||||
:working-dir (projectile-compilation-dir))))
|
||||
'("test" "run" "compilation" "configure" "install" "package"))))
|
||||
|
||||
(defvar-local run-command-project-local-commands nil)
|
||||
(put 'run-command-project-local-commands 'safe-local-variable (lambda (_) t))
|
||||
|
||||
(defun run-command-recipe-project-local ()
|
||||
(when (and run-command-project-local-commands (projectile-project-root))
|
||||
(mapcar (cl-function
|
||||
@ -6657,6 +6657,29 @@ current buffer:
|
||||
(list :command-name "edit"
|
||||
:command-line (format "sops %s" (buffer-file-name))))))
|
||||
|
||||
(defun run-command-recipe-pytest ()
|
||||
(when (and (derived-mode-p 'python-mode)
|
||||
(= 0 (call-process "python" nil nil nil "-c" "import pytest")))
|
||||
(let ((test-file-p (string-match-p "test" (or (buffer-file-name) ""))))
|
||||
(list
|
||||
(when (and (projectile-project-root)
|
||||
(file-exists-p (concat (file-name-as-directory (projectile-project-root))
|
||||
"tests")))
|
||||
(list :command-name "test all"
|
||||
:command-line "pytest tests"
|
||||
:working-dir (projectile-project-root)))
|
||||
(when test-file-p
|
||||
(list :command-name "test this file"
|
||||
:command-line (format "pytest %s" (buffer-file-name))))
|
||||
(when (and test-file-p (python-info-current-defun))
|
||||
(list :command-name "test this function"
|
||||
:command-line (format "pytest %s::%s"
|
||||
(buffer-file-name)
|
||||
(replace-regexp-in-string
|
||||
"\\."
|
||||
"::"
|
||||
(python-info-current-defun)))))))))
|
||||
|
||||
:general
|
||||
(leader-map "\"" #'run-command)
|
||||
(run-command-term-minor-mode-map [remap recompile] #'run-command-term-recompile)
|
||||
@ -6671,7 +6694,8 @@ current buffer:
|
||||
run-command-recipe-executables
|
||||
run-command-recipe-obelix
|
||||
run-command-recipe-kustomize
|
||||
run-command-recipe-sops)))
|
||||
run-command-recipe-sops
|
||||
run-command-recipe-pytest)))
|
||||
#+end_src
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user