Compare commits

...

7 Commits

Author SHA1 Message Date
Jeremy Dormitzer
c021061dc5 Make run-command-recipe-scripts understand non-executable shebang scripts 2022-05-05 14:41:14 -04:00
Jeremy Dormitzer
a2e0b17332 Add run-command recipe for project script files 2022-05-05 14:21:40 -04:00
Jeremy Dormitzer
a67e30d0dd Add wrap-with-angle-bracket function + binding 2022-05-05 14:21:24 -04:00
Jeremy Dormitzer
129c5c5975 Remove broken keybinding 2022-04-26 11:56:35 -04:00
Jeremy Dormitzer
cc6db44752 Add skip tests mvn install command 2022-04-26 11:56:25 -04:00
Jeremy Dormitzer
c4b7b41521 Unset SYSTEM_VERSION_COMPAT 2022-04-25 13:46:43 -04:00
Jeremy Dormitzer
b114fd0d71 Add rake run-command recipe 2022-04-25 13:46:35 -04:00
4 changed files with 56 additions and 5 deletions

View File

@ -20,6 +20,9 @@
(defun sp-wrap-single-quote ()
(interactive)
(sp-wrap-with-pair "'"))
(defun sp-wrap-angle-bracket ()
(interactive)
(sp-wrap-with-pair "<"))
(defun sp-after-equals-p (_id action _context)
(when (memq action '(insert navigate))
(sp--looking-back-p "=>" 2)))
@ -66,7 +69,8 @@
"g[" #'sp-wrap-square
"g{" #'sp-wrap-curly
"g\"" #'sp-wrap-double-quote
"g'" #'sp-wrap-single-quote))
"g'" #'sp-wrap-single-quote
"g<" #'sp-wrap-angle-bracket))
(use-package evil-smartparens
:after (evil smartparens)

View File

@ -10,7 +10,6 @@
:custom
(prodigy-completion-system 'default)
:config
(evil-collection-prodigy-setup)
(general-def 'normal prodigy-mode-map "`" #'prodigy-display-process-file-or-buffer))
(evil-collection-prodigy-setup))
(provide 'init-prodigy)

View File

@ -241,6 +241,9 @@
(list :command-name "install"
:command-line "mvn install"
:working-dir local-pom-dir)
(list :command-name "install (skip tests)"
:command-line "mvn install -DskipTests"
:working-dir local-pom-dir)
(list :command-name "deploy"
:command-line "mvn deploy"
:working-dir local-pom-dir)
@ -313,6 +316,50 @@
:command-line "cargo build --release"
:working-dir project-dir)))))
(defun run-command-recipe-rake ()
(when-let* ((rake-dir (or (locate-dominating-file default-directory "Rakefile")
(locate-dominating-file default-directory "Rakefile.rb")))
(cmds (->> (shell-command-to-string "rake -T")
(s-split "\n")
(-map (lambda (s) (s-split-up-to " " s 2)))
(-map (lambda (l) (s-join " " (-take 2 l))))
(-filter (-not 'string-empty-p)))))
(-map (lambda (cmd)
(list :command-name (cadr (s-split " " cmd))
:command-line cmd
:working-dir rake-dir))
cmds)))
(defvar run-command-recipe-scripts--script-dirs '("." "bin" "scripts"))
(defun get-script-run-command (file)
(with-temp-buffer
(insert-file-contents-literally file)
(when-let* ((line (s-trim (thing-at-point 'line t))))
(cadr (s-match (rx "#!" (group (1+ anychar))) line)))))
(defun run-command-recipe-scripts ()
(let* ((root-dir (expand-file-name (or (projectile-project-root) default-directory)))
(shell (or (getenv "SHELL") "/usr/bin/env bash"))
(scripts (-mapcat
(lambda (dir)
(let ((dir (f-join root-dir dir)))
(when (f-dir? dir)
(f-files
dir
(lambda (file)
(or (file-executable-p file)
(get-script-run-command file)))))))
run-command-recipe-scripts--script-dirs)))
(-map
(lambda (file)
(list :command-name (f-relative file root-dir)
:command-line (if (file-executable-p file)
file
(format "%s %s" (get-script-run-command file) file))
:working-dir root-dir))
scripts)))
:general
(leader-map "\"" #'run-command)
:custom
@ -332,6 +379,8 @@
run-command-recipe-web-ext
run-command-recipe-pip
run-command-recipe-maven
run-command-recipe-cargo)))
run-command-recipe-cargo
run-command-recipe-rake
run-command-recipe-scripts)))
(provide 'init-run-command)

View File

@ -5,5 +5,4 @@ fi
export PATH="$PATH:/Users/jdormit/.local/bin"
eval "$(pyenv init --path)"
[[ -d "/opt/homebrew/opt/openjdk@17" ]] && export JAVA_HOME="/opt/homebrew/opt/openjdk@17"
export SYSTEM_VERSION_COMPAT=1
ulimit -n 524288