Skip to content

Instantly share code, notes, and snippets.

@bravosierrasierra
Created May 17, 2017 09:49
Show Gist options
  • Save bravosierrasierra/ed0d438f6791e19ca1d22f13b061dc71 to your computer and use it in GitHub Desktop.
Save bravosierrasierra/ed0d438f6791e19ca1d22f13b061dc71 to your computer and use it in GitHub Desktop.
;;;; shell settings
(setq eshell-visual-commands
'("vim" "vi" "screen" "top" "less" "more" "lynx" "ncftp" "pine"
"tin" "trn" "elm" "tmux" "nano" "mc" ("git" ("log" "diff" "show")) ))
(use-package eshell)
(require 'em-smart)
(setq eshell-where-to-jump 'begin)
(setq eshell-review-quick-commands nil)
(setq eshell-smart-space-goes-to-end t)
(setq comint-prompt-read-only t)
(use-package better-shell
;; https://github.com/killdash9/better-shell
:disabled
:ensure t
:bind (("C-'" . better-shell-shell)
("C-;" . better-shell-remote-open)
))
;; ansi-term
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
;; term
(defface term-color-black
'((t (:foreground "#3f3f3f" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-red
'((t (:foreground "#cc9393" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-green
'((t (:foreground "#7f9f7f" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-yellow
'((t (:foreground "#f0dfaf" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-blue
'((t (:foreground "#6d85ba" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-magenta
'((t (:foreground "#dc8cc3" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-cyan
'((t (:foreground "#93e0e3" :background "#272822")))
"Unhelpful docstring.")
(defface term-color-white
'((t (:foreground "#dcdccc" :background "#272822")))
"Unhelpful docstring.")
'(term-default-fg-color ((t (:inherit term-color-white))))
'(term-default-bg-color ((t (:inherit term-color-black))))
;; ansi-term colors
(setq ansi-term-color-vector
[term term-color-black term-color-red term-color-green term-color-yellow
term-color-blue term-color-magenta term-color-cyan term-color-white])
;; shell: C-d on an empty line in the shell terminates the process.
(defun comint-delchar-or-eof-or-kill-buffer (arg)
(interactive "p")
(if (null (get-buffer-process (current-buffer)))
(kill-buffer)
(comint-delchar-or-maybe-eof arg)))
(add-hook 'shell-mode-hook (lambda () (define-key shell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)))
(add-hook 'eshell-mode-hook (lambda () (define-key eshell-mode-map (kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)))
;; eshell marks http://mbork.pl/2017-03-04_Bookmarking_directories_in_Eshell
;; http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
(defun eshell/jump (mark)
"Jump to a directory symlinked to by a file called ~/.marks/MARK."
(eshell/cd (file-symlink-p (concat "~/.marks/" mark))))
(defun pcomplete/jump ()
"Complete a command that wants a name of a file in ~/.marks."
(pcomplete-here* (directory-files "~/.marks/")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment