summaryrefslogtreecommitdiff
path: root/lisp/init-external.el
blob: b9dc5f0e3e1863efc23dc0e35f4f590ce7f51ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(defvar km/terminal "urxvt")

(defun km/open-external-terminal ()
  (interactive)
  (start-process "ext-term" nil km/terminal))

(defadvice recompile (around restore-windows activate)
  "Prevent recompiling from spawning new windows."
  (save-window-excursion
    ad-do-it))

(defadvice shell-command (around shell-command-restore-windows activate)
  "Restore window configuraiton after shell-command.
The hides the *Async Shell Command* buffer that is opened in the
other window when an asynchronous command is run."
  (window-configuration-to-register :before-shell-command)
  ad-do-it
  (jump-to-register :before-shell-command))

(define-prefix-command 'external-map)
(global-set-key (kbd "C-c x") 'external-map)

(defun km/zsh-ansi-term ()
  (interactive)
  (ansi-term "/bin/zsh"))

(define-key external-map "a" 'km/zsh-ansi-term)
(define-key external-map "t" 'km/open-external-terminal)
(define-key external-map "r" 'shell-command-on-region)
(define-key external-map "s" 'shell-command)
(define-key external-map "S" 'shell)

(define-key external-map "a" 'km/zsh-ansi-term)
(define-key external-map "t" 'km/open-external-terminal)
(define-key external-map "r" 'shell-command-on-region)
(define-key external-map "s" 'shell-command)
(define-key external-map "S" 'shell)

(define-key external-map "c" 'compile)
(define-key external-map "g" 'recompile)

;; Give frequently-used recompile a shorter binding.
(global-set-key (kbd "C-c g") 'recompile)

(provide 'init-external)