| @@ -1691,18 +1691,30 @@ Optional prefix ARG says how many lines to unflag; default is one line." | |||||
| (defun eshell/v () | (defun eshell/v () | ||||
| (view-mode 1)) | (view-mode 1)) | ||||
| (defun eshell/aaa (&rest args) | |||||
| (message "%S" | |||||
| args)) | |||||
| (defun eshell/git (&rest args) | (defun eshell/git (&rest args) | ||||
| (if (require 'git-command nil t) | |||||
| (git-command (mapconcat 'shell-quote-argument | |||||
| args | |||||
| " ")) | |||||
| (apply 'eshell-git-fallback args))) | |||||
| (defun eshell-git-fallback (&rest args) | |||||
| "" | "" | ||||
| (if (member (car args) | (if (member (car args) | ||||
| '("di" "diff" "log" "show")) | |||||
| '("di" "diff" "log" "show" "graph")) | |||||
| (apply 'eshell-exec-visual "git" args) | (apply 'eshell-exec-visual "git" args) | ||||
| (shell-command (mapconcat 'shell-quote-argument | |||||
| `("git" ,@args) | |||||
| " ") | |||||
| t) | |||||
| (shell-command-to-string (mapconcat 'shell-quote-argument | |||||
| `("git" ,@args) | |||||
| " ")) | |||||
| ;; (eshell-external-command "git" args) | ;; (eshell-external-command "git" args) | ||||
| )) | )) | ||||
| (defalias 'eshell/g 'eshell/git) | |||||
| (defalias 'eshell/: 'ignore) | (defalias 'eshell/: 'ignore) | ||||
| (defalias 'eshell/type 'eshell/which) | (defalias 'eshell/type 'eshell/which) | ||||
| ;; (defalias 'eshell/vim 'eshell/vi) | ;; (defalias 'eshell/vim 'eshell/vi) | ||||
| @@ -1714,6 +1726,23 @@ Optional prefix ARG says how many lines to unflag; default is one line." | |||||
| (interactive) | (interactive) | ||||
| (goto-char (point-max))) | (goto-char (point-max))) | ||||
| (defun eshell-delete-char-or-logout (n) | |||||
| (interactive "p") | |||||
| (if (equal (eshell-get-old-input) | |||||
| "") | |||||
| (progn | |||||
| (insert "exit") | |||||
| (eshell-send-input)) | |||||
| (delete-char n))) | |||||
| (defun eshell-kill-input () | |||||
| (interactive) | |||||
| (delete-region (point) | |||||
| (progn (eshell-bol) | |||||
| (point)))) | |||||
| (defalias 'eshell/logout 'eshell/exit) | |||||
| (defun eshell-cd-default-directory (&optional eshell-buffer-or-name) | (defun eshell-cd-default-directory (&optional eshell-buffer-or-name) | ||||
| "open eshell and change wd | "open eshell and change wd | ||||
| if arg given, use that eshell buffer, otherwise make new eshell buffer." | if arg given, use that eshell buffer, otherwise make new eshell buffer." | ||||
| @@ -1745,14 +1774,14 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." | |||||
| (let (p1 p2 p3 p4) | (let (p1 p2 p3 p4) | ||||
| (insert ":: [") | (insert ":: [") | ||||
| (setq p1 (point)) | (setq p1 (point)) | ||||
| (insert (abbreviate-file-name default-directory)) | |||||
| (setq p2 (point)) | |||||
| (insert ":") | |||||
| (setq p3 (point)) | |||||
| (insert user-login-name | (insert user-login-name | ||||
| "@" | "@" | ||||
| system-name | system-name | ||||
| ) | ) | ||||
| (setq p2 (point)) | |||||
| (insert ":") | |||||
| (setq p3 (point)) | |||||
| (insert (abbreviate-file-name default-directory)) | |||||
| (setq p4 (point)) | (setq p4 (point)) | ||||
| (insert "]") | (insert "]") | ||||
| (insert "\n:: " | (insert "\n:: " | ||||
| @@ -1775,20 +1804,21 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." | |||||
| ;; (define-key eshell-mode-map (kbd "C-x C-x") (lambda () | ;; (define-key eshell-mode-map (kbd "C-x C-x") (lambda () | ||||
| ;; (interactive) | ;; (interactive) | ||||
| ;; (switch-to-buffer (other-buffer)))) | ;; (switch-to-buffer (other-buffer)))) | ||||
| (define-key eshell-mode-map (kbd "C-u") (lambda () | |||||
| (interactive) | |||||
| (eshell-goto-prompt) | |||||
| (eshell-kill-input))) | |||||
| (define-key eshell-mode-map (kbd "C-g") (lambda () | |||||
| (interactive) | |||||
| (eshell-goto-prompt) | |||||
| (my-keyboard-quit))) | |||||
| (define-key eshell-mode-map | |||||
| (kbd "DEL") 'my-eshell-backward-delete-char) | |||||
| (define-key eshell-mode-map | |||||
| (kbd "C-p") 'eshell-previous-matching-input-from-input) | |||||
| (define-key eshell-mode-map | |||||
| (kbd "C-n") 'eshell-next-matching-input-from-input) | |||||
| ;; (define-key eshell-mode-map (kbd "C-g") (lambda () | |||||
| ;; (interactive) | |||||
| ;; (eshell-goto-prompt) | |||||
| ;; (keyboard-quit))) | |||||
| (define-key eshell-mode-map (kbd "C-u") | |||||
| 'eshell-kill-input) | |||||
| (define-key eshell-mode-map (kbd "C-d") | |||||
| 'eshell-delete-char-or-logout) | |||||
| (define-key eshell-mode-map (kbd "DEL") | |||||
| 'my-eshell-backward-delete-char) | |||||
| ;; (define-key eshell-mode-map | |||||
| ;; (kbd "C-p") 'eshell-previous-matching-input-from-input) | |||||
| ;; (define-key eshell-mode-map | |||||
| ;; (kbd "C-n") 'eshell-next-matching-input-from-input) | |||||
| (apply 'eshell/addpath exec-path) | (apply 'eshell/addpath exec-path) | ||||
| (set (make-local-variable 'scroll-margin) 0) | (set (make-local-variable 'scroll-margin) 0) | ||||
| ;; (eshell/export "GIT_PAGER=") | ;; (eshell/export "GIT_PAGER=") | ||||
| @@ -1819,7 +1849,6 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." | |||||
| ; ("ll" "ls -l $*") | ; ("ll" "ls -l $*") | ||||
| ; ("la" "ls -a $*") | ; ("la" "ls -a $*") | ||||
| ; ("lla" "ls -al $*") | ; ("lla" "ls -al $*") | ||||
| ("aptin" "apt-get install $*") | |||||
| ("eless" | ("eless" | ||||
| (concat "cat >>> (with-current-buffer " | (concat "cat >>> (with-current-buffer " | ||||
| "(get-buffer-create \"*eshell output\") " | "(get-buffer-create \"*eshell output\") " | ||||
| @@ -1827,7 +1856,6 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." | |||||
| "(setq buffer-read-only nil) " | "(setq buffer-read-only nil) " | ||||
| "(current-buffer)) " | "(current-buffer)) " | ||||
| "(view-buffer (get-buffer \"*eshell output*\"))") | "(view-buffer (get-buffer \"*eshell output*\"))") | ||||
| ("g" "git $*") | |||||
| )) | )) | ||||
| ))) | ))) | ||||
| ) ; eval after load eshell | ) ; eval after load eshell | ||||