I like ansi-term in emacs. It is the closest to a "real" terminal, offering all the goodness that bash, zsh, or whatever your favorite shell can give you. However, you definitely lose a few things in going to it. The following emacs code restores at least the things I find most useful: dabbrev-completion, yanking, and correct colors.
When you use this code, note that dabbrev-completion is C-c /, and yanking is C-c C-y.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ash-term-hooks () | |
;; dabbrev-expand in term | |
(define-key term-raw-escape-map "/" | |
(lambda () | |
(interactive) | |
(let ((beg (point))) | |
(dabbrev-expand nil) | |
(kill-region beg (point))) | |
(term-send-raw-string (substring-no-properties (current-kill 0))))) | |
;; yank in term (bound to C-c C-y) | |
(define-key term-raw-escape-map "\C-y" | |
(lambda () | |
(interactive) | |
(term-send-raw-string (current-kill 0)))) | |
(setq term-default-bg-color (face-background 'default)) | |
(setq term-default-fg-color (face-foreground 'default))) | |
(add-hook 'term-mode-hook 'ash-term-hooks) |