Files
memex/projects/dotemacs/emacs-shell.org

1.8 KiB

Shell Configuration

Shell

Bash completion

  (use-package bash-completion
    :config
    (require 'bash-completion)
    (bash-completion-setup)
    )
(defvar shell-dynamic-complete-functions t)

Eshell

Add programmable bash completion to Emacs shell-mode

  (require 'bash-completion)
  (add-hook 'eshell-mode-hook
          (lambda ()
            (add-hook 'completion-at-point-functions
                      'bash-completion-capf-nonexclusive nil t
                      )
            )
          )

Use colors in eshell

  (use-package xterm-color
    :commands (xterm-color-filter)
    )

  (use-package eshell
    :after xterm-color
    :config
    (define-key eshell-hist-mode-map (kbd "M-r") #'consult-history)
    (add-hook 'eshell-mode-hook
              (lambda ()
                (setenv "TERM" "xterm-256color")))
    (add-hook 'eshell-before-prompt-hook (setq xterm-color-preserve-properties t))
    (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
    (setq eshell-output-filter-functions
          (remove 'eshell-handle-ansi-color eshell-output-filter-functions)
          )
    )

Eshell completion

  (add-hook 'eshell-mode-hook
          (lambda ()
            (add-hook 'completion-at-point-functions
                      'bash-completion-capf-nonexclusive nil t)))

Emulate A Terminal (EAT)

  (use-package eat
    :config
    ;; For `eat-eshell-mode'.
    (add-hook 'eshell-load-hook #'eat-eshell-mode)

    ;; For `eat-eshell-visual-command-mode'.
    (add-hook 'eshell-load-hook #'eat-eshell-visual-command-mode)
    )