Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C-j and C-k history commands in shells #3794

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions layers/+distribution/spacemacs-base/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
;; don't display eldoc on modeline
(spacemacs|hide-lighter eldoc-mode))))


(defun spacemacs-base/init-evil ()
(use-package evil
:init
Expand Down Expand Up @@ -382,7 +381,15 @@ Example: (evil-map visual \"<\" \"<gv\")"
;; free variable reference. The line above fixes this
(if smartparens-strict-mode
(call-interactively 'sp-backward-delete-char)
ad-do-it))))))
ad-do-it)))

;; Define history commands for comint
(evil-define-key 'insert comint-mode-map
(kbd "C-k") 'comint-next-input
(kbd "C-j") 'comint-previous-input)
(evil-define-key 'normal comint-mode-map
(kbd "C-k") 'comint-next-input
(kbd "C-j") 'comint-previous-input))))

(defun spacemacs-base/init-evil-escape ()
(use-package evil-escape
Expand Down
17 changes: 15 additions & 2 deletions layers/shell/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ is achieved by adding the relevant text properties."

;; automatically truncate buffer after output
(when (boundp 'eshell-output-filter-functions)
(push 'eshell-truncate-buffer eshell-output-filter-functions)))))
(push 'eshell-truncate-buffer eshell-output-filter-functions))

;; These don't work well in normal state
;; due to evil/emacs cursor incompatibility
(evil-define-key 'insert eshell-mode-map
(kbd "C-k") 'eshell-previous-matching-input-from-input
(kbd "C-j") 'eshell-next-matching-input-from-input))))

(defun shell/init-esh-help ()
(use-package esh-help
Expand Down Expand Up @@ -283,7 +289,14 @@ is achieved by adding the relevant text properties."
;; work in term
(evil-define-key 'normal term-raw-map "p" 'term-paste)
(evil-define-key 'insert term-raw-map (kbd "C-c C-d") 'term-send-eof)
(evil-define-key 'insert term-raw-map (kbd "<tab>") 'term-send-tab))
(evil-define-key 'insert term-raw-map (kbd "<tab>") 'term-send-tab)

(evil-define-key 'insert term-raw-map
(kbd "C-k") 'term-send-up
(kbd "C-j") 'term-send-down)
(evil-define-key 'normal term-raw-map
(kbd "C-k") 'term-send-up
(kbd "C-j") 'term-send-down))

(defun shell/pre-init-magit ()
(spacemacs|use-package-add-hook magit
Expand Down