evil-commentary icon indicating copy to clipboard operation
evil-commentary copied to clipboard

doesn't work well with gj/gk

Open peterwu opened this issue 4 years ago • 2 comments

Let's say I have the following emacs-lisp code and the cursor rests at the letter t on the :ensure t line.

(use-package evil-commentary
  :ensure t
  :config
  (evil-commentary-mode +1))

If I do gcj, I'll get correct result. However, if I do gcgj, I'll get this:

(use-package evil-commentary
  :ensure ;; t
  ;; :config
  (evil-commentary-mode +1))

Note the ;; is in front of the letter t, instead for the entire line. This is not how vim behaves with the tpope/vim-commentary plugin.

This issue happens when (setq evil-respect-visual-line-mode t) as j/k are mapped to gj/gk respectively.

peterwu avatar Dec 22 '20 15:12 peterwu

Same issue here. An additional issue after using (setq evil-respect-visual-line-mode t) is that the number of commented lines changes. For example, if we use gc2j:

  • before setting the variable: 3 lines of text including the current line get commented
  • after setting the variable: 2 lines of text including the current line get commented

jdhao avatar Oct 03 '21 20:10 jdhao

Thanks for the report, this issues has been raised for several times so I'll have a look.

linktohack avatar Oct 04 '21 14:10 linktohack