-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Cannot edit shell commands in normal mode. Prompt not read-only (Evil) #8642
Comments
@cweill did you find any solution this problem? this is the only problems that's keeping me away from using ansi-term as my full time terminal |
@gtmshrm I tried too and couldn't get it working. If anyone else did please let us know! |
@mpereira You need to follow these 2 steps in order to make it work properly:
Note: If you need evil-mode to do some complex stuff inside ansi-term, you can enable evil-mode inside ansi-term by pressing C-z. Press the same key to disable evil-mode. Let me know if this works. |
@gtmshrm that was one of the things I tried but with the fish shell. I don't remember exactly the specific issues but it didn't work very well. Ideally we could have the full evil functionality available when editing commands, since these shell vi-modes are very limited. Maybe I'll try getting it working again this weekend. Thanks for your reply! |
@mpereira Please let me know if you fix this issue without disabling evil mode. Sometimes, I hate switching back and forth between evil mode and holy mode. |
I am encountering the same problem and would greatly appreciate it if this bug can be fixed. Being able to use terminal inside spacemacs will be a big boost to my workflow. I have tried using eshell instead, but it's not working as smoothly as bash inside ansi-term. |
@zhangdaiwei Enable vi-mode in your regular shell and in emacs, open ansi-term and then disable evil mode by pressing |
@gtmshrm I tried your solution and terminal worked fine. However, the space bar no longer works for sending key combinations as commands. I could use M-m but that's less convenient. The space bar is what I like the most about spacemacs. |
@zhangdaiwei There is a simple solution of this situation which I use. First remove |
@gtmshrm Yes, I was aware of that solution. However, when I use shell I need to edit commands frequently, so typing |
FWIW my solution was to switch to eshell. |
@mpereira I tried that, too. However, most of my work need to be done on remote servers, and eshell is not as convenient as ansi-term for this task. When I cd to the remote server, eshell is confused about |
Edit: This allows normal mode navigation in ansi-term with Evil-mode, but doesn't allow normal mode editing of text in the input line; the issue remains. For anyone still coming across this issue, the fix from #10779 worked for me in ansi-term. Simply set |
@kylegentle are you able to edit text in the input line after moving in normal mode? |
@mpereira, thanks for double checking--it looks like I was experiencing a separate issue. I'm not able to edit text in the input line while in normal mode. Sorry about the confusion! |
@kylegentle no worries! I was genuinely curious if you got that working. That issue was the main reason I found eshell to be more ergonomic. |
@kylegentle interesting. I'll try that out later tonight, thanks for sharing! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
Someone solve this problem? |
It's still an issue on the latest This error message appears:
Not only in evil normal state when one tries to change a word:
PopOS 19.10#### System Info :computer: - OS: gnu/linux - Emacs: 26.3.50 - Spacemacs: 0.300.0 - Spacemacs branch: develop (rev. b7fd2fab6) - Graphic display: t - Distribution: spacemacs - Editing style: vim - Completion: helm - Layers: ```elisp ((auto-completion :variables auto-completion-use-company-box t) command-log emacs-lisp git helm markdown multiple-cursors (org :variables org-agenda-files '("~/org/notes.org")) python (shell :variables shell-default-shell 'term shell-default-height 30 shell-default-position 'bottom) spell-checking syntax-checking treemacs version-control) ``` - System configuration features: XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS |
Do we have at least a work around to get editing commands working in evil mode? I'm trying using line mode when I need to edit a command but when I come back to char mode it's not actually edited. |
No one might have implemented evil support in term (yet). The evil-collection lists it as a TODO item:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
As of now (August 2023) this works for me: (with-eval-after-load 'multi-term
(mapcar
(lambda (map)
(evil-collection-define-key 'insert map (kbd "S-<up>") #'previous-line)
(evil-collection-define-key 'insert map (kbd "S-<down>") #'next-line)
(evil-collection-define-key 'insert map (kbd "C-<up>") #'previous-line)
(evil-collection-define-key 'insert map (kbd "C-<down>") #'next-line)
(evil-collection-define-key 'insert map (kbd "<delete>") #'term-send-del)
(evil-collection-define-key 'insert map (kbd "<prior>") #'evil-scroll-page-up)
(evil-collection-define-key 'insert map (kbd "<next>") #'evil-scroll-page-down))
'(term-raw-map))) ;; term-mode-map is apparently not needed The |
Description
Shell prompt in
term, ansi-term, multi-tem
not protected from normal/command mode in Evil. Cannot edit shell commands in normal mode. This is not an issue when the shell iseshell
, where the expected behavior works.Reproduction guide 🪲
multi-term, term, ansi-term
SPC '
to open shellESC
to enter command modeObserved behaviour: 👀 💔
cc
will delete promptExpected behaviour: ❤️ 😄
eshell
.System Info 💻
The text was updated successfully, but these errors were encountered: