From 39c6c8eae0bfe6b77b86c7aa257fc69556a9c02f Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Thu, 2 Jan 2020 17:06:35 -0500 Subject: [PATCH] Add dap-mode transient --- emacs/init.org | 56 ++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 34fa562..49567f1 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -211,6 +211,11 @@ Adds Evil commands to comment out lines of code: (general-def 'normal messages-buffer-mode-map "SPC" leader-map :keymaps 'override) #+END_SRC +* Transient +A framework for creating Magit-style popups: +#+BEGIN_SRC emacs-lisp + (use-package transient) +#+END_SRC * Magit Magit is objectively the best Git interface. #+BEGIN_SRC emacs-lisp @@ -1637,38 +1642,41 @@ Emacs support for the Language Server Protocol lsp-ui-sideline-update-mode 'point)) (use-package dap-mode - :after (lsp-mode) - :commands (dap-debug dap-debug-edit-template) - :hook (prog-mode . (lambda () - (dap-mode 1) - (dap-ui-mode 1) - (dap-tooltip-mode 1))) :init - (defvar dap-commands (make-sparse-keymap)) - (jdormit/define-prefix "cm" "dap") + (define-transient-command dap-dispatch + "Dispatcher popup for dap-mode commands" + ["Launching" + ("d" "Start debugger" dap-debug)] + ["Debugging" + ("n" "Next" dap-next) + ("i" "Step in" dap-step-in) + ("o" "Step out" dap-step-out) + ("c" "Continue" dap-continue) + ("r" "Restart frame" dap-restart-frame) + ("l" "View locals" dap-ui-locals) + ("e" "Eval" dap-eval) + ("x" "Inspect" dap-ui-inspect) + ("Q" "Disconnect" dap-disconnect)] + ["Breakpoints" + ("b" "Toggle breakpoint" dap-breakpoint-toggle) + ("B" "View breakpoints" dap-ui-breakpoints)] + ["Misc." + ("T" "Edit template" dap-debug-edit-template) + ("h" "Hydra" dap-hydra)]) :config (require 'dap-python) :general - (dap-commands - "d" 'dap-debug - "T" 'dap-debug-edit-template - "n" 'dap-next - "i" 'dap-step-in - "o" 'dap-step-out - "c" 'dap-continue - "r" 'dap-restart-frame - "l" 'dap-ui-locals - "h" 'dap-hydra - "b" 'dap-breakpoint-toggle - "B" 'dap-ui-breakpoints-ui-list - "e" 'dap-eval - "x" 'dap-ui-inspect) - (leader-map "cm" dap-commands)) + (leader-map "cm" 'dap-dispatch) + ((normal visual motion) "zd" 'dap-dispatch)) + + (dap-mode 1) + (dap-ui-mode 1) + (dap-tooltip-mode 1) (with-eval-after-load 'lsp-clients (defun lsp-typescript-javascript-tsx-jsx-activate-p (filename major-mode) "Checks if the javascript-typescript language server should be enabled - based on FILE-NAME and MAJOR-MODE" + based on FILE-NAME and MAJOR-MODE" (or (member major-mode '(typescript-mode typescript-tsx-mode js-mode js2-mode rjsx-mode)) (and (eq major-mode 'web-mode) (or (string-suffix-p ".tsx" filename t)