Skip to content

Commit

Permalink
gud set up
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Mar 18, 2014
1 parent 6152739 commit 983f276
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions init-evil.el
Expand Up @@ -171,6 +171,7 @@ to replace the symbol under cursor"
"ht" 'helm-etags-select
"cg" 'helm-ls-git-ls
"ud" '(lambda ()(interactive) (gud-gdb (concat "gdb --fullname " (cppcm-get-exe-path-current-buffer))))
"uk" 'gud-kill-yes
"ur" 'gud-remove
"ub" 'gud-break
"uu" 'gud-run
Expand Down
29 changes: 26 additions & 3 deletions init-gud.el
Expand Up @@ -40,21 +40,44 @@
(hack-gud-mode))
;; }}

(defun gud-cls ()
(defun gud-cls (&optional num)
"clear gud screen"
(interactive)
(interactive "p")
(let ((old-window (selected-window)))
(save-excursion
(cond
((buffer-live-p (get-buffer "*gud-main*"))
(select-window (get-buffer-window "*gud-main*"))
(end-of-buffer)
(recenter-top-bottom)
(if (> num 1) (recenter-top-bottom))
(select-window old-window))
(t (error "GUD buffer doesn't exist!"))
))
))

(eval-after-load 'gud
'(progn
(gud-def gud-kill "kill" "\C-k" "Kill the debugee")
))

(defun gud-kill-yes ()
"gud-kill and confirm with y"
(interactive)
(let ((old-window (selected-window)))
(save-excursion
(cond
((buffer-live-p (get-buffer "*gud-main*"))
(gud-kill nil)
(select-window (get-buffer-window "*gud-main*"))
(insert "y")
(comint-send-input)
(recenter-top-bottom)
(select-window old-window))
(t (error "GUD buffer doesn't exist!"))
))
))

(global-set-key "\C-x\C-a\C-g" 'gud-run)

(provide 'init-gud)
(provide 'init-gud)

0 comments on commit 983f276

Please sign in to comment.