Emacs Bliss

Posts tagged "Evil-mode":

02 Sep 2018

annoyance with paste in Evil visual mode

I like Evil mode and use it all the time with my Emacs configuration.

One thing I often do is copy some text with y and select some text in visual mode followed by using p or P to replace it with what I have just copied.

However what really annoys me is that every time after I press p or P , the content(ie. visual selection) being replaced is saved to the top of kill-ring which ruined my next paste operation with p or P since kill-ring has been changed.

After consulting the helpful, it shows that command invoked for pasting in visual mode is evil-visual-paste defined in evil-commands.el.

Skimming through the function, this line is what I’m looking for:

(when evil-kill-on-visual-paste
        (kill-new new-kill))

Basically it will save whatever in visual selection and push it to the top of kill-ring if variable evil-kill-on-visual-paste is true.

This variable is defined here as following (in evil-vars.el):

(defcustom evil-kill-on-visual-paste t
  "Whether ~evil-visual-paste' adds the replaced text to the kill
ring, making it the default for the next paste. The default, t,
replicates the default vim behavior."
  :type 'boolean
  :group 'evil)

So by setting this variable to false that annoyance goes away:

(setq evil-kill-on-visual-paste nil)
Tags: Emacs Evil-mode
03 Aug 2018

Go to column in Emacs

I was looking for a command/function to jump to a specific column in emacs. It turned out there is already one built in emacs: move-to-column and is bind to M-g Tab.

Even better Evil has already defined a command evil-goto-column and by default it’s bind to |.

So to jump to column 10 in evil normal mode, do this:

10 |

NOTE: column number is 0 based

Tags: Emacs Evil-mode
Other posts
Other posts
Creative Commons License
EmacsBliss by EmacsBliss is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.