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

shell: add support for vim/hybrid styles in term/ansi-term buffers. #10844

Closed
wants to merge 1 commit into from
Closed

shell: add support for vim/hybrid styles in term/ansi-term buffers. #10844

wants to merge 1 commit into from

Conversation

ellakk
Copy link
Contributor

@ellakk ellakk commented Jun 9, 2018

I was trying out the vim editing style today and noticed that the cursor is stuck in normal/visual mode in term buffers, you can't move around and you cant edit/copy anything. This solves it.
This commit also ensured the cursor goes to the prompt if the cursor enters insert/hybrid mode from a different line than the prompt line.
Fixes: #10779.

@giuscri
Copy link

giuscri commented Jun 25, 2018

Inside a project, a shell is no longer spawned with SPC '. Instead, current window is split and the same buffer is shown twice.

This is what's printed in *Messages*:

term-char-mode: Wrong type argument: processp, nil
Error in post-command-hook (evil-mode-check-buffers): (wrong-type-argument processp nil)

@ellakk
Copy link
Contributor Author

ellakk commented Jun 25, 2018

Well that sucks, I'm gonna have a look at it when i get home or tomorrow. Did this happen with the same setup you posted in #10956. I've been using it on emacs 26.1 and seems to work just fine but ill investigate.

@OkIdeal0
Copy link

I had the same issue as @giuscri. The problem seems to be that (term-char-mode) is called before the process is properly set up. Changing term-enable-char-mode-maby-goto-prompt to

(defun spacemacs//term-enable-char-mode-maby-goto-prompt ()
     (when (eq major-mode 'term-mode)
       (when (get-buffer-process (current-buffer))
         (term-char-mode)
         (if (not (eq (line-number-at-pos (point))
                      (line-number-at-pos (marker-position (term-process-mark)))))
             (goto-char (term-process-mark))))))

works for me. This is the approach taken by evil-collections.

@ellakk
Copy link
Contributor Author

ellakk commented Jun 29, 2018

Thanks @OkIdeal0, updated pr.

@giuscri
Copy link

giuscri commented Jun 29, 2018

It seems to work.

Yet, when I copy from a buffer using y and I use paste to a terminal using p the following happens
output
Basically pasting deletes the start of the line when in Normal mode. It reappears when you're back into Insert mode.

(when (eq major-mode 'term-mode)
(when (get-buffer-process (current-buffer))
(term-char-mode)
(if (not (eq (line-number-at-pos (point))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use term-goto-process-mark-maybe?

@jvillasante jvillasante mentioned this pull request Sep 7, 2018
@ellakk ellakk closed this Jan 2, 2019
@ellakk ellakk deleted the improve_term_for_vim_hybrid_styles branch January 2, 2019 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants