diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index e2b862a..2d5925e 100755 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1593,7 +1593,7 @@ Interfacing with Pass, the "standard Unix password manager". This should also be :if (executable-find "pass") :commands pass :general - ('(normal motion visual) pass-mode-map "S" #'password-store-synchronize)) + (normal pass-mode-map "S" #'password-store-synchronize)) (leader-def-key "ap" #'pass) @@ -2593,8 +2593,11 @@ Visual programs: (defun eshell-setup () (add-to-list 'eshell-visual-commands "crawl") (add-to-list 'eshell-visual-commands "ssh") + (add-to-list 'eshell-visual-commands "watch") (add-to-list 'eshell-visual-subcommands '("kubectl" "exec")) - (add-to-list 'eshell-visual-subcommands '("k" "exec"))) + (add-to-list 'eshell-visual-subcommands '("k" "exec")) + (add-to-list 'eshell-visual-subcommands '("docker" "build")) + (add-to-list 'eshell-visual-subcommands '("docker" "push"))) (add-hook 'eshell-mode-hook #'eshell-setup) #+END_SRC @@ -2715,7 +2718,9 @@ Like [[help:electric-indent-mode][electric-indent-mode]] but reindents after eve * JSON #+BEGIN_SRC emacs-lisp (use-package json-mode - :mode (("\\.json\\'" . json-mode))) + :mode (("\\.json\\'" . json-mode)) + :config + (setq js-indent-level 2)) (use-package json-navigator :commands (json-navigator-navigator @@ -5372,10 +5377,17 @@ Switch AWS profiles: (defvar aws-current-profile nil "Currently active AWS profile") - (setq aws-current-profile (getenv "AWS_PROFILE")) - (add-to-list 'aws-profiles "personal") + (defun aws-local-profile () + (make-local-variable 'aws-current-profile)) - (add-to-list 'aws-profiles "cde") + (add-hook 'eshell-mode-hook #'aws-local-profile) + (add-hook 'vterm-mode-hook #'aws-local-profile) + (add-hook 'term-mode-hook #'aws-local-profile) + + (setq aws-current-profile (getenv "AWS_PROFILE")) + + (add-to-list 'aws-profiles "personal") + (add-to-list 'aws-profiles "lola-cde") (defun aws-switch-profile (profile) (interactive (list (completing-read "Profile: " aws-profiles))) @@ -6264,33 +6276,39 @@ A better terminal emulator for Emacs. Replaces ansi-term, not EShell. #+BEGIN_SRC emacs-lisp (defun eshell-exec-in-vterm (&rest args) (let* ((program (car args)) - (buf (generate-new-buffer - (concat "*" (file-name-nondirectory program) "*")))) + (buf (generate-new-buffer + (concat "*" (file-name-nondirectory program) "*")))) (with-current-buffer buf - (vterm-mode) - (vterm-send-string (concat (s-join " " args) "\n"))) + (vterm-mode) + (vterm-send-string (concat (s-join " " args) "\n"))) (switch-to-buffer buf))) + (defun vterm-send-interactively (key) + (interactive "cSend key: ") + (vterm-send (format "%c" key))) + (use-package vterm :if module-file-suffix :init (with-eval-after-load 'em-term (defun eshell-exec-visual (&rest args) - (apply #'eshell-exec-in-vterm args))) - :commands (vterm vterm-other-window vterm-mode)) + (apply #'eshell-exec-in-vterm args))) + :commands (vterm vterm-other-window vterm-mode) + :general + (vterm-mode-map "M-\\" #'vterm-send-interactively)) (defun run-vterm (&optional new-buffer) (interactive "P") (let ((buffer-name (when (not new-buffer) "vterm"))) (if (and buffer-name (get-buffer buffer-name)) - (switch-to-buffer buffer-name) - (vterm buffer-name)))) + (switch-to-buffer buffer-name) + (vterm buffer-name)))) (defun open-vterm (&optional arg) (interactive "P") (if (and (fboundp 'projectile-project-root) - (projectile-project-root)) - (projectile-run-vterm arg) + (projectile-project-root)) + (projectile-run-vterm arg) (run-vterm arg))) (leader-def-key "sv" 'open-vterm)