syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.59k stars 4.9k forks source link

Expand region changes behaviour of C-a on visual mode #9207

Closed henriquenj closed 4 years ago

henriquenj commented 7 years ago

Description :octocat:

After using SPC v at least once in a buffer, using C-SPC C-a to select a line to its beginning will not work. Closing the buffer and opening again will make C-SPC C-a work again as expected. Pressing C-SPC and C-a SEPARETELY (releasing control between SPC and a) will sometimes make it work again.

The bug also occurs if the user press v to enter visual mode.

Reproduction guide :beetle:

On a fresh install of spacemacs

Observed behaviour: :eyes: :broken_heart: C-a exits visual mode.

Expected behaviour: :heart: :smile: C-a should not exit visual mode, as before of using SPC v

System Info :computer:

I removed my dotspacemacs and ran git clean -fdx on .emacs.d directory to reproduce this bug.

My configuration uses C-a and C-e like vanilla Emacs, and the same behaviour happens with C-e. I usually use this sequence of keys to select a line.

$ and ^ seems to be working fine. As a workaround I could bind their commands to C-a and C-e

duianto commented 7 years ago

Confirmed

System Info :computer:

planigan commented 7 years ago

Confirmed on gnu/linux as well:

System Info :computer:

henriquenj commented 7 years ago

If more people are bothered by this behaviour, this code binds C-a and C-e to the evil versions, so it works mostly the same. You should add it to dotspacemacs/user-config

  (define-key evil-motion-state-map (kbd "C-e") 'evil-end-of-line)
  (define-key evil-motion-state-map (kbd "C-a") 'evil-first-non-blank)
  (define-key evil-insert-state-map (kbd "C-e") 'evil-end-of-visual-line)
  (define-key evil-insert-state-map (kbd "C-a") 'evil-first-non-blank)

If you want C-a to go to the first column even if it's a blank line, I think you can use evil-digit-argument-or-evil-beginning-of-line instead of evil-first-non-blank. But I haven't tested.

I found out that this setup works better when using multiple cursors, since vanilla C-a works only for one cursor (this might be a separeted bug)

henriquenj commented 7 years ago

Bug still present on develop, tested on e09385d29ef2c95cef14b992028ca85da142dad7

github-actions[bot] commented 4 years ago

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!

henriquenj commented 4 years ago

I don't see this behaviour anymore as of commit 27178f23e912d740ad77c0864122604a04576415. I think it can be closed.

duianto commented 4 years ago

Fell free to close any issue that you've opened, where you're unable to reproduce it on the latest develop branch.