Emacs is the equivalent of Vim word movement and changing a line in a line

In Emacs, I can go one word back and forth using Mf and Mb , but if I need to go three words back or forward, I need to repeat the previous sequence three times, which seems inelegant. What is the equivalent of emacs to the concept of word-movement in vim? For example, in Vim, I can move forward in two words, releasing 2w and backward, releasing 2b while I'm in command mode.

  • What are the equivalent commands in Emacs to move between words (more than one at a time)?
  • In fact, I would like to go to a specific word and change it. In Vim, I can do this via ciw (change the word in the line). What would be the equivalent command in Emacs?
+4
source share
1 answer

You can use universal-argument . There are two ways to move three words forward:

  • Cu 3 Mf
  • C-3 Mf

But this is usually slower than doing Mf 3 times. You know you don't have an M release, right?

I don't know what vim civ does, but to jump to a word, just find it using Cs . If you like jumping, check out Ace Jump . It works the same as the following link function of browser plugins like vimperator. With it, you can go to lines, words, or even characters.


Well, I don’t think there is a built-in module for this. Perhaps this feature helps:

 (defun delete-word-at-point () "Delete word at point." (interactive) (let* ((p (point)) (beg (+ p (skip-syntax-backward "w_"))) (end (+ beg (skip-syntax-forward "w_")))) (kill-region beg end))) 

Put it in your ~/.emacs and bind it where you want. Maybe M-. :

 (global-set-key (read-kbd-macro "M-.") 'delete-word-at-point) 
+6
source

Source: https://habr.com/ru/post/1495086/


All Articles